mediocre-blog/srv/cmd/userid-calc-cli/main.go

29 lines
501 B
Go
Raw Normal View History

2021-08-19 00:13:18 +00:00
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", "", "")
2022-05-06 02:17:59 +00:00
2021-08-19 00:13:18 +00:00
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))
}