Last active
June 20, 2022 12:27
-
-
Save mjosaarinen/cd684cbfa559712f6a599d5ed6562471 to your computer and use it in GitHub Desktop.
110 leadig zero bits on Algorand's SumHash-512
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sumhash0.go | |
// 2022-06-18 Markku-Juhani O. saarinen <mjos@mjos.fi> | |
// === A sumhash-512 with 110 leading zero bits (from left) | |
/* | |
input = AA4F827EE71BF78B816E767A24B271AD046A3C52DA8B25EAB2D59A86C8B93F02FB73184B74A5F8F227FD1500000000 | |
H(x) = 000000000000000000000000000385D978E7FF3D3239DB4F1C357EA40940EAB592F34AEC646DED668859B622341566A838B566490E2AC71DBA89B067E647FC31 | |
*/ | |
package main | |
import ( | |
"encoding/hex" | |
"fmt" | |
"github.com/algorand/go-sumhash" | |
) | |
func main() { | |
// fixed 47-byte input | |
x,_ := hex.DecodeString("AA4F827EE71BF78B816E767A24B271AD" + | |
"046A3C52DA8B25EAB2D59A86C8B93F02" + | |
"FB73184B74A5F8F227FD1500000000") | |
fmt.Printf("input = %X\n", x) | |
// call sumhash | |
h := sumhash.New512(nil) | |
_, _ = h.Write(x) | |
sum := h.Sum(nil) | |
// print the result | |
fmt.Printf("H(x) = %X\n", sum) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment