Daryl Fung
initial commit
39f3704
raw
history blame
602 Bytes
package main
import (
"crypto/sha256"
"encoding/hex"
"fmt"
"io"
"os"
)
func main() {
var buf [32]byte
h := sha256.New()
lst := make([]any, 0, 64)
for _, fname := range files {
f, err := os.Open("assets/" + fname)
if err != nil {
panic(err)
}
_, err = io.Copy(h, f)
if err != nil {
panic(err)
}
s := hex.EncodeToString(h.Sum(buf[:0]))
fmt.Println("sha256 of", fname, "=", s)
lst = append(lst, s)
h.Reset()
f.Close()
}
f, err := os.Create("sha256.env")
if err != nil {
panic(err)
}
_, err = fmt.Fprintf(f, envtmpl, lst...)
if err != nil {
panic(err)
}
}