Playground
gnomod.toml
module = "gno.land/p/g1udyt8ywv489087rn5td39m8t3peve3hxjz08w2/probesha" gno = "0.9" [addpkg] creator = "g1udyt8ywv489087rn5td39m8t3peve3hxjz08w2" height = 1385554 max_deposit = "100000000ugnot"
probesha.gno
package probesha
import "crypto/sha256"
// Sum is the smallest possible use of crypto/sha256 in a gno package.
func Sum(s string) string {
h := sha256.Sum256([]byte(s))
return string(h[:4])
}
probesha_test.gno
package probesha
import "testing"
func TestSum(t *testing.T) {
if len(Sum("kolektif")) != 4 {
t.Fatalf("unexpected length")
}
}