paxpamir/encrypt_token.go
2024-12-27 00:07:47 +03:00

31 lines
425 B
Go

// go:build token
package main
import (
"crypto/sha256"
"fmt"
"io"
"os"
"git.niplace.ru/XoxJlopeZi4BB/paxpamir/token"
)
func Must[T any](v T, err error) T {
if err != nil {
panic(err)
}
return v
}
func main() {
hash := sha256.Sum256(token.Password())
s, err := token.Encrypt(
string(Must(io.ReadAll(Must(os.Open("token/token.plaintext"))))),
hash[:],
)
if err != nil {
panic(err)
}
fmt.Println(s)
}