algo

package
v0.0.0-...-43c9aad Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UseSimd bool

Functions

func MerkleTreeChildren

func MerkleTreeChildren(m MerkleTree, idx int) (left int, right int)

func MerkleTreeHash

func MerkleTreeHash(m MerkleTree) *[]byte

Types

type Edit

type Edit struct {
	Slice Range
	With  Range
}

func HashDiff

func HashDiff(source, dest []HashBlock) []Edit

func HashDiff2

func HashDiff2(source, dest []HashBlock) []Edit

type EditOp

type EditOp int
const (
	EditOpInsert EditOp = iota
	EditOpDelete
)

type HashBlock

type HashBlock struct {
	Hash   []byte
	Length uint32
}

func HashSplit

func HashSplit(r io.Reader, splitBits uint, hashFun hash.Hash) (blocks []HashBlock, err error)

func MerkleTreeAt

func MerkleTreeAt(m MerkleTree, idx int) (block HashBlock, length uint32)

func MerkleTreeRoot

func MerkleTreeRoot(m MerkleTree) (HashBlock, int)

func (*HashBlock) String

func (h *HashBlock) String() string

type MerkleTree

type MerkleTree struct {
	DataLength uint32
	Blocks     []HashBlock
}

func MerkleTreeFromFile

func MerkleTreeFromFile(name string, splitBits uint) (MerkleTree, error)

func MerkleTreeFromReader

func MerkleTreeFromReader(r io.Reader, splitBits uint) (MerkleTree, error)

type Range

type Range struct {
	Start  uint32
	Length uint32
}

Jump to

Keyboard shortcuts

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