blake2s

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Overview

Package blake2s implements the BLAKE2s secure hashing algorithm with support for salting and personalization. BLAKE2s is optimized for 8- to 32-bit platforms and produces digests of any size between 1 and 32 bytes

Index

Constants

View Source
const (
	// The length of the key field.
	KeyLength = 32
	// The maximum number of bytes to produce.
	MaxOutput = 32
	// Max size of the salt, in bytes
	SaltLength = 8
	// Max size of the personalization string, in bytes
	SeparatorLength = 8
	// Number of G function rounds for BLAKE2s.
	RoundCount = 10
	// Size of a block buffer in bytes
	BlockSize = 64

	// Initialization vector for BLAKE2s
	IV0 uint32 = 0x6a09e667
	IV1 uint32 = 0xbb67ae85
	IV2 uint32 = 0x3c6ef372
	IV3 uint32 = 0xa54ff53a
	IV4 uint32 = 0x510e527f
	IV5 uint32 = 0x9b05688c
	IV6 uint32 = 0x1f83d9ab
	IV7 uint32 = 0x5be0cd19
)

The constant values will be different for other BLAKE2 variants. These are appropriate for BLAKE2s.

Variables

This section is empty.

Functions

This section is empty.

Types

type Digest

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

Digest represents the internal state of the BLAKE2s algorithm.

func NewDigest

func NewDigest(key, salt, personalization []byte, outputBytes int) (*Digest, error)

NewDigest constructs a new instance of a BLAKE2s hash with the provided configuration.

func (*Digest) BlockSize

func (d *Digest) BlockSize() int

BlockSize returns the hash's underlying block size. The Write method must be able to accept any amount of data, but it may operate more efficiently if all writes are a multiple of the block size.

func (*Digest) Reset

func (d *Digest) Reset()

Reset resets the Hash to its initial state.

func (*Digest) Size

func (d *Digest) Size() int

Size returns the digest output size in bytes.

func (*Digest) Sum

func (d *Digest) Sum(b []byte) (out []byte)

Sum appends the current hash to b and returns the resulting slice. It does not change the underlying hash state.

func (*Digest) Write

func (d *Digest) Write(input []byte) (n int, err error)

Write adds more data to the running hash.

Jump to

Keyboard shortcuts

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