Skip to content Search Apps Documentation Source Content Run Reset Eval Playground File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

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")
	}
}