github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/stdlibs/crypto/sha256/sha256_test.gno (about)

     1  package sha256
     2  
     3  import (
     4  	"crypto/sha256"
     5  	"encoding/hex"
     6  	"std"
     7  	"testing"
     8  )
     9  
    10  func TestSha256Sum(t *testing.T) {
    11  	got := sha256.Sum256([]byte("sha256 this string"))[:]
    12  	expected := "1af1dfa857bf1d8814fe1af8983c18080019922e557f15a8a0d3db739d77aacb"
    13  
    14  	if hex.EncodeToString(got) != expected {
    15  		t.Errorf("got %v(%T), expected %v(%T)", hex.EncodeToString(got), got, expected, expected)
    16  	}
    17  }