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

30 lines
412 B
Go

// go:build token
package main
import (
"crypto/sha256"
"fmt"
"git.niplace.ru/XoxJlopeZi4BB/paxpamir/token"
"io"
"os"
)
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.Decrypt(
string(Must(io.ReadAll(Must(os.Open("encrypted"))))),
hash[:],
)
if err != nil {
panic(err)
}
fmt.Println(s)
}