hidrivehash

package
v0.0.0-...-b4aeae5 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package hidrivehash implements the HiDrive hashing algorithm which combines SHA-1 hashes hierarchically to a single top-level hash.

Note: This implementation does not grant access to any partial hashes generated.

See: https://developer.hidrive.com/wp-content/uploads/2021/07/HiDrive_Synchronization-v3.3-rev28.pdf (link to newest version: https://static.hidrive.com/dev/0001)

Index

Constants

View Source
const (
	// BlockSize of the checksum in bytes.
	BlockSize = 4096
	// Size of the checksum in bytes.
	Size = sha1.Size
)

Variables

View Source
var (

	// ErrorInvalidEncoding is returned when a hash should be decoded from a binary form that is invalid.
	ErrorInvalidEncoding = errors.New("encoded binary form is invalid for this hash")
	// ErrorHashFull is returned when a hash reached its capacity and cannot accept any more input.
	ErrorHashFull = errors.New("hash reached its capacity")
)

Functions

func New

func New() hash.Hash

New returns a new hash.Hash computing the HiDrive checksum.

func NewLevel

func NewLevel() hash.Hash

NewLevel returns a new hash.Hash computing any level-n hash, except level-0.

func Sum

func Sum(data []byte) [Size]byte

Sum returns the HiDrive checksum of the data.

Types

This section is empty.

Directories

Path Synopsis
Package internal provides utilities for HiDrive.
Package internal provides utilities for HiDrive.

Jump to

Keyboard shortcuts

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