Help us shape the future of Go! Take the 2026 Go Developer Survey

hash

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2018 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMod

func AddMod(x, y, mod uint32) uint32

AddMod adds two numbers in Z mod assuming 0 <= x,y < mod

func MulMod

func MulMod(x, y, mod uint32) uint32

MulMod multiplies two numbers in Z mod

func Run

func Run(item IHashable, level int)

Run compresses items that have the same hash and level th parent

Types

type Hash

type Hash struct {
	// contains filtered or unexported fields
}

Hash is a struct for calculating hashing strings

func (*Hash) Calc

func (hash *Hash) Calc(string string) Node

Calc calculates a hash of a string

func (*Hash) Join

func (hash *Hash) Join(first, second Node) Node

Join calculates hash of two joined strings

type IHashable

type IHashable interface {
	// ToString should return string representation of a value of a node
	// return:
	//   string identifying a value of a node
	ToString() string

	// Compress should compress child of a node
	// args:
	//   1. IHashable - source (node to compress the other node to)
	//   2. IHashable - destination (node to compress)
	Compress(IHashable, IHashable)

	// GetChildren should return children of a node
	// return:
	//   array of children of a node
	GetChildren() []IHashable
}

IHashable represent tree node can be hashed

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node represents hashed value and length of a string

Source Files

  • hash.go
  • ihash.go
  • tree.go
  • util.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL