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/g17khqpukees4237dtn3astzapmp462vjhsz6st4/murmur3

Package
Open in gnoweb ↗

Overview

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

Files (5)

  • README.mdmarkdown
  • gnomod.tomltoml
  • murmur3_32.gnogno
  • murmur3_64.gnogno
  • murmur32.gnogno
murmur3_64.gnogno
1package murmur323import "hash"45const hashSize64 = 867type digest64 struct {8	d1 digest329	d2 digest3210}1112// New64 returns a new hash.Hash64 computing a 64-bit MurmurHash313// hash using two 32-bit hashes with different seeds.14// It can generate 2 to the power of 64 unique 64-bit values.15// Hash is not collision safe, so it's recommended to handle potential16// collisions when dealing with more than 4_294_967_296 values which is17// when probability raises.18func New64() hash.Hash64 {19	return &digest64{20		d1: digest32{},21		d2: digest32{seed: 1, h1: 1},22	}23}2425// NewWithSeed64 returns a new hash.Hash64 computing a 64-bit26// MurmurHash3 hash. The first 32-bit hash uses seed1 and the27// second uses seed2. The two seeds should ideally be different.28// It can generate 2 to the power of 64 unique 64-bit values.29// Hash is not collision safe, so it's recommended to handle potential30// collisions when dealing with more than 4_294_967_296 values which is31// when provability raises.32func NewWithSeed64(seed1, seed2 uint32) hash.Hash64 {33	return &digest64{34		d1: digest32{seed: seed1, h1: seed1},35		d2: digest32{seed: seed2, h1: seed2},36	}37}3839// Sum64 returns the 64-bit MurmurHash3 hash of the specified data.40func Sum64(data []byte) uint64 {41	return Sum64WithSeed(data, 0, 1)42}4344// Sum64WithSeed returns the 64-bit MurmurHash3 hash of the specified45// data using the given seeds.46func Sum64WithSeed(data []byte, seed1, seed2 uint32) uint64 {47	h := NewWithSeed64(seed1, seed2)48	h.Write(data)49	return h.Sum64()50}5152func (digest64) BlockSize() int {53	// Use a 32-bit hash block size because writes are54	// done to two hash32 hashes using the same data.55	return blockSize3256}5758func (digest64) Size() int {59	return hashSize6460}6162func (d *digest64) Reset() {63	d.d1.Reset()64	d.d2.Reset()65}6667func (d *digest64) Write(bz []byte) (int, error) {68	d.d1.Write(bz)69	return d.d2.Write(bz)70}7172func (d digest64) Sum64() uint64 {73	return uint64(d.d1.Sum32())<<32 | uint64(d.d2.Sum32())74}7576func (d digest64) Sum(bz []byte) []byte {77	s := d.Sum64()78	return append(bz,79		byte(s), byte(s>>8), byte(s>>16), byte(s>>24),80		byte(s>>32), byte(s>>40), byte(s>>48), byte(s>>56),81	)82}83

Functions

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

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