blob: 90c44e75ae66564bd02451eef7e00cb60f67e170 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package main
import (
"encoding/json"
"flag"
"fmt"
"github.com/mediocregopher/blog.mediocregopher.com/srv/chat"
)
func main() {
secret := flag.String("secret", "", "Secret to use when calculating UserIDs")
name := flag.String("name", "", "")
password := flag.String("password", "", "")
flag.Parse()
calc := chat.NewUserIDCalculator([]byte(*secret))
userID := calc.Calculate(*name, *password)
b, err := json.Marshal(userID)
if err != nil {
panic(err)
}
fmt.Println(string(b))
}
|