You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
526 B
32 lines
526 B
package main
|
|
|
|
import (
|
|
"bufio"
|
|
"encoding/base64"
|
|
"fmt"
|
|
"os"
|
|
|
|
"golang.org/x/crypto/scrypt"
|
|
)
|
|
|
|
const (
|
|
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))
|
|
}
|