Add linx-genkey
This commit is contained in:
parent
2b0135697b
commit
ae02f537f7
33
linx-genkey/linx-genkey.go
Normal file
33
linx-genkey/linx-genkey.go
Normal file
@ -0,0 +1,33 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"golang.org/x/crypto/scrypt"
|
||||
)
|
||||
|
||||
const (
|
||||
authPrefix = "Linx "
|
||||
scryptSalt = "linx-server"
|
||||
scryptN = 16384
|
||||
scryptr = 8
|
||||
scryptp = 1
|
||||
scryptKeyLen = 32
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Printf("Enter key to hash: ")
|
||||
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
scanner.Scan()
|
||||
|
||||
checkKey, err := scrypt.Key([]byte(scanner.Text()), []byte(scryptSalt), scryptN, scryptr, scryptp, scryptKeyLen)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(base64.StdEncoding.EncodeToString(checkKey))
|
||||
}
|
Loading…
Reference in New Issue
Block a user