30 lines
412 B
Go
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)
|
||
|
}
|