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.gnogno
    1package wesh23import "crypto/sha256"45// blockSize is SHA-256's internal block size, the padding width HMAC uses.6const blockSize = 6478// HMACSHA256 computes HMAC-SHA256 as specified in RFC 2104.9//10// gno's standard library exposes sha256.Sum256 but no streaming hash.Hash and11// no crypto/hmac, so the construction is spelled out here:12//13//	HMAC(K, m) = H((K' ⊕ opad) ‖ H((K' ⊕ ipad) ‖ m))14//15// with K' the key hashed down when longer than the block size, then16// zero-padded up to it. This is the primitive weshnet's rendezvous point17// derivation is built on, so it has to agree byte-for-byte; see18// [RendezvousPoint].19func HMACSHA256(key, msg []byte) []byte {20	k := key21	if len(k) > blockSize {22		sum := sha256.Sum256(k)23		k = sum[:]24	}2526	ipad := make([]byte, blockSize)27	opad := make([]byte, blockSize)28	copy(ipad, k)29	copy(opad, k)30	for i := 0; i < blockSize; i++ {31		ipad[i] ^= 0x3632		opad[i] ^= 0x5c33	}3435	inner := sha256.Sum256(append(ipad, msg...))36	outer := sha256.Sum256(append(opad, inner[:]...))37	return outer[:]38}39

    Functions

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

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