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
README.mdPreviewRaw
# MurmurHash3 Package

Package implements Austin Appleby's MurmurHash3 algorithm.

MurmurHash3 is a fast, non-cryptographic hash function well suited for hash tables,
bloom filters, data partitioning, and deduplication where speed and good distribution
matter more than cryptographic security.

Repository can be found at [jeronimoalbi/gnome](https://github.com/jeronimoalbi/gnome),
as part of `jeronimoalbi`'s Gno smart contracts monorepo.

## Usage

[embedmd]:# (filetests/readme_filetest.gno go)
```go
package main

import "gno.land/p/g17khqpukees4237dtn3astzapmp462vjhsz6st4/murmur3"

func main() {
	data := []byte("Hello, world!")
	seed := uint32(42)

	// Hash32 without seed
	h32 := murmur3.New32()
	h32.Write(data)
	sum32 := uint64(h32.Sum32())
	println(murmur3.EncodeToString(sum32))

	// Hash32 with seed
	h32 = murmur3.NewWithSeed32(seed)
	h32.Write(data)
	sum32 = uint64(h32.Sum32())
	println(murmur3.EncodeToString(sum32))

	// Hash32 without seed using a helper function
	sum32 = uint64(murmur3.Sum32(data))
	println(murmur3.EncodeToString(sum32))

	// Hash32 with seed using a helper function
	sum32 = uint64(murmur3.Sum32WithSeed(data, seed))
	println(murmur3.EncodeToString(sum32))

	// Hash64 without seed
	h64 := murmur3.New64()
	h64.Write(data)
	sum64 := h64.Sum64()
	println(murmur3.EncodeToString(sum64))

	// Hash64 with seed
	h64 = murmur3.NewWithSeed64(0, seed)
	h64.Write(data)
	sum64 = h64.Sum64()
	println(murmur3.EncodeToString(sum64))

	// Hash64 without seed using a helper function
	sum64 = murmur3.Sum64(data)
	println(murmur3.EncodeToString(sum64))

	// Hash64 with seed using a helper function
	sum64 = murmur3.Sum64WithSeed(data, 0, seed)
	println(murmur3.EncodeToString(sum64))
}

// Output:
// c0363e43
// 2c8c8533
// c0363e43
// 2c8c8533
// c0363e43aa5dc85b
// c0363e432c8c8533
// c0363e43aa5dc85b
// c0363e432c8c8533
```

Functions

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

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