tool: Change b2s to output exact variable used

- Use correct name.
- Don't declare it as static.
- Lose the toolchain
- Use only basename of path in the b2s comment
This commit is contained in:
Michael Cardell Widerkrantz 2025-08-27 11:31:20 +02:00
parent 13767ee7df
commit d3492e2a34
No known key found for this signature in database
GPG key ID: D3DB3DDF57E704E5
2 changed files with 4 additions and 4 deletions

View file

@ -7,6 +7,7 @@ import (
"flag" "flag"
"fmt" "fmt"
"os" "os"
"path"
"golang.org/x/crypto/blake2s" "golang.org/x/crypto/blake2s"
) )
@ -16,8 +17,9 @@ func usage() {
} }
func printCDigest(digest [blake2s.Size]byte, fileName string) { func printCDigest(digest [blake2s.Size]byte, fileName string) {
fmt.Printf("// BLAKE2s digest of %v\n", fileName) fmt.Printf("#include <stdint.h>\n\n")
fmt.Printf("const uint8_t digest[32] = {\n") fmt.Printf("// BLAKE2s digest of %v\n", path.Base(fileName))
fmt.Printf("const uint8_t allowed_app_digest[32] = {\n")
for _, n := range digest { for _, n := range digest {
fmt.Printf("0x%02x, ", n) fmt.Printf("0x%02x, ", n)

View file

@ -2,8 +2,6 @@ module b2s
go 1.23.0 go 1.23.0
toolchain go1.23.7
require golang.org/x/crypto v0.36.0 require golang.org/x/crypto v0.36.0
require golang.org/x/sys v0.31.0 // indirect require golang.org/x/sys v0.31.0 // indirect