paxpamir/encrypt_token.go

31 lines
425 B
Go
Raw Permalink Normal View History

2024-12-27 01:07:47 +04:00
// 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)
}