blake3

package
v1.0.2023 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The size of blake3 hash in bytes.
	Size = 32

	// The block size of the hash algorithm in bytes.
	BlockSize = 64
)
View Source
const (
	CHUNK_START         = 1 << 0
	CHUNK_END           = 1 << 1
	PARENT              = 1 << 2
	ROOT                = 1 << 3
	KEYED_HASH          = 1 << 4
	DERIVE_KEY_CONTEXT  = 1 << 5
	DERIVE_KEY_MATERIAL = 1 << 6
)
View Source
const BLAKE3_BLOCK_LEN = 64
View Source
const BLAKE3_CHUNK_LEN = 1024
View Source
const BLAKE3_KEY_LEN = 32
View Source
const BLAKE3_MAX_DEPTH = 54
View Source
const BLAKE3_OUT_LEN = 32

Variables

View Source
var MSG_SCHEDULE = [7][16]uint32{
	{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
	{2, 6, 3, 10, 7, 0, 4, 13, 1, 11, 12, 5, 9, 14, 15, 8},
	{3, 4, 10, 12, 13, 2, 7, 14, 6, 5, 9, 0, 11, 15, 8, 1},
	{10, 7, 12, 9, 14, 3, 13, 15, 4, 0, 11, 2, 5, 8, 1, 6},
	{12, 13, 9, 11, 15, 10, 14, 8, 7, 2, 5, 3, 0, 1, 6, 4},
	{9, 14, 11, 5, 8, 12, 15, 1, 13, 3, 0, 10, 2, 6, 4, 7},
	{11, 15, 5, 0, 1, 9, 8, 6, 14, 10, 2, 12, 3, 4, 7, 13},
}

Functions

func New

func New() hash.Hash

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

func NewWithDeriveKey

func NewWithDeriveKey(context []byte) hash.Hash

NewWithDeriveKey is like New but initializes context

func NewWithDeriveKeyAndSize

func NewWithDeriveKeyAndSize(context []byte, size int) hash.Hash

NewWithDeriveKeyAndSize is like New but initializes context

func NewWithKeyed

func NewWithKeyed(key []byte) (hash.Hash, error)

NewWithKeyed is like New but initializes key with the given 32-byte slice.

func NewWithKeyedAndSize

func NewWithKeyedAndSize(key []byte, size int) (hash.Hash, error)

NewWithKeyedAndSize is like New but initializes key with the given 32-byte slice.

func NewWithSize

func NewWithSize(size int) hash.Hash

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

func Sum

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

Sum returns the blake3 checksum of the data.

func SumWithDeriveKey

func SumWithDeriveKey(data []byte, context []byte) (out [Size]byte)

SumWithDeriveKey returns the blake3 checksum of the data.

func SumWithKeyed

func SumWithKeyed(data []byte, key []byte) (out [Size]byte, err error)

SumWithKeyed returns the blake3 checksum of the data.

Types

This section is empty.

Jump to

Keyboard shortcuts

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