33 lines
571 B
Go
33 lines
571 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"github.com/atlasos/calypso/internal/common/config"
|
|
"github.com/atlasos/calypso/internal/common/password"
|
|
)
|
|
|
|
func main() {
|
|
if len(os.Args) < 2 {
|
|
fmt.Fprintf(os.Stderr, "Usage: %s <password>\n", os.Args[0])
|
|
os.Exit(1)
|
|
}
|
|
|
|
pwd := os.Args[1]
|
|
params := config.Argon2Params{
|
|
Memory: 64 * 1024,
|
|
Iterations: 3,
|
|
Parallelism: 4,
|
|
SaltLength: 16,
|
|
KeyLength: 32,
|
|
}
|
|
|
|
hash, err := password.HashPassword(pwd, params)
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
fmt.Println(hash)
|
|
}
|