PathrockNetwork Gno Explorer
HomeBlocksTransactionsTokensRealmsPackagesValidatorsAnalytics

PathrockNetwork Gno Explorer — an independent explorer for Gno.land Mainnet (gnoland-1), operated by PathrockNetwork. Not an official Gno.land service.

gnowebarchive RPC

gno.land/p/moul/x/wesh/v0

Package
Open in gnoweb ↗

Overview

Kind
Pure package
Name
v0
Namespace
moul / x / wesh
Files
12 (README)(gnomod.toml)
Exported functions
n/a — not supported for pure packages by the node (vm/qfuncs)
Module
gno.land/p/moul/x/wesh/v0
gno
0.9

Files (12)

  • README.mdmarkdown
  • gnomod.tomltoml
  • hmac.gnogno
  • link.gnogno
  • rendezvous.gnogno
  • statement.gnogno
  • wesh.gnogno
  • hmac_test.gnogno
  • link_test.gnogno
  • rendezvous_test.gnogno
  • statement_test.gnogno
  • wesh_test.gnogno
  • hmac_test.gnogno
    1package wesh23import (4	"encoding/hex"5	"testing"67	"gno.land/p/nt/uassert/v0"8)910// TestHMACSHA256RFC4231 checks the HMAC construction against the published11// RFC 4231 vectors. Case 6 matters most: its key is longer than the block12// size, which is the branch that hashes the key down first and the one most13// easily got wrong.14func TestHMACSHA256RFC4231(t *testing.T) {15	cases := []struct {16		name string17		key  []byte18		data []byte19		want string20	}{21		{22			"rfc4231 case 1",23			repeat(0x0b, 20),24			[]byte("Hi There"),25			"b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7",26		},27		{28			"rfc4231 case 2",29			[]byte("Jefe"),30			[]byte("what do ya want for nothing?"),31			"5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843",32		},33		{34			"rfc4231 case 6 (key longer than the block size)",35			repeat(0xaa, 131),36			[]byte("Test Using Larger Than Block-Size Key - Hash Key First"),37			"60e431591ee0b67f0d8a26aacbf5b77f8e0bc6213728c5140546040f0ee37f54",38		},39	}40	for _, tc := range cases {41		got := hex.EncodeToString(HMACSHA256(tc.key, tc.data))42		uassert.Equal(t, tc.want, got, tc.name)43	}44}4546// repeat returns n copies of b.47func repeat(b byte, n int) []byte {48	out := make([]byte, n)49	for i := range out {50		out[i] = b51	}52	return out53}54

    Functions

    not supported for pure packages by the node (vm/qfuncs)

    Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.