bmt

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2020 License: BSD-3-Clause Imports: 2 Imported by: 1

README

# Binary Merkle Tree hash

This package provides an interface and a selection of implementations of the Binary Merkle Tree hash

Documentation

Overview

Package bmt defines the interface for the Binary Merkle Tree hash.

Index

Constants

View Source
const (
	SpanSize = 8
)

Variables

View Source
var ErrOverflow = errors.New("BMT hash capacity exceeded")

Functions

This section is empty.

Types

type Hash

type Hash interface {
	hash.Hash

	// SetSpan sets the length prefix of BMT hash.
	SetSpan(int64) error

	// SetSpanBytes sets the length prefix of BMT hash in byte form.
	SetSpanBytes([]byte) error

	// Capacity returns the maximum amount of bytes that will be processed by the implementation.
	Capacity() int

	// WriteSection writes to a specific section of the data to be hashed.
	WriteSection(idx int, data []byte) error
}

Hash provides the necessary extension of the hash interface to add the length-prefix of the BMT hash.

Any implementation should make it possible to generate a BMT hash using the hash.Hash interface only. However, the limitation will be that the Span of the BMT hash always must be limited to the amount of bytes actually written.

Directories

Path Synopsis
cmd
Command main_legacy executes the BMT hash algorithm on the given data and writes the binary result to standard output Up to 4096 bytes will be read If a filename is given as argument, it reads data from the file.
Command main_legacy executes the BMT hash algorithm on the given data and writes the binary result to standard output Up to 4096 bytes will be read If a filename is given as argument, it reads data from the file.
generate-hashes
Command generate_legacy generates bmt hashes of sequential byte inputs for every possible length of legacy bmt hasher
Command generate_legacy generates bmt hashes of sequential byte inputs for every possible length of legacy bmt hasher
Binary Merkle Tree Hash is a hash function over arbitrary datachunks of limited size.
Binary Merkle Tree Hash is a hash function over arbitrary datachunks of limited size.
Package reference is a simple nonconcurrent reference implementation for hashsize segment based Binary Merkle tree hash on arbitrary but fixed maximum chunksize n where 0 <= n <= 4096 This implementation does not take advantage of any paralellisms and uses far more memory than necessary, but it is easy to see that it is correct.
Package reference is a simple nonconcurrent reference implementation for hashsize segment based Binary Merkle tree hash on arbitrary but fixed maximum chunksize n where 0 <= n <= 4096 This implementation does not take advantage of any paralellisms and uses far more memory than necessary, but it is easy to see that it is correct.

Jump to

Keyboard shortcuts

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