blake2b

package module
v0.0.0-...-8ae7938 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2017 License: MIT Imports: 3 Imported by: 0

README

Godoc Reference

The BLAKE2b hash algorithm

BLAKE2b is a fast cryptographic hash function described in RFC 7963. BLAKE2b can be directly keyed, making it functionally equivalent to a Message Authentication Code (MAC).

Recommendation

This BLAKE2b implementation was submitted to the golang x/crypto repo. I recommend to use the official x/crypto/blake2b package if possible.

Installation

Install in your GOPATH: go get -u github.com/aead/blake2b

Performance

AMD64
Hardware: Intel i7-6500U 2.50GHz x 2
System: Linux Ubuntu 16.04 - kernel: 4.4.0-64-generic
Go version: 1.8.0

AVX2
name        speed           cpb
Write128-4  756MB/s ± 1%    3.15
Write1K-4   842MB/s ± 0%    2.83
Sum128-4    658MB/s ± 0%    3.62
Sum1K-4     825MB/s ± 0%    2.89

SSE4.1
name        speed           cpb
Write128-4  654MB/s ± 1%    3.65
Write1K-4   739MB/s ± 0%    3.23
Sum128-4    578MB/s ± 0%    4.12
Sum1K-4     728MB/s ± 0%    3.27

Documentation

Overview

Package blake2b implemnets the BLAKE2b hash algorithm as defined in RFC 7693.

RFC 7693 defines BALKE2b-160 with 160 bit hash size, but it's recommend to use hash sizes >= 256 bit to prevent birthday attacks.

Index

Constants

View Source
const (
	// BlockSize is the blocksize of BLAKE2b in bytes.
	BlockSize = 128
	// Size is the hash size of BLAKE2b-512 in bytes.
	Size = 64
	// Size384 is the hash size of BLAKE2b-384 in bytes.
	Size384 = 48
	// Size256 is the hash size of BLAKE2b-256 in bytes.
	Size256 = 32
	// Size160 is the hash size of BLAKE2b-160 in bytes.
	Size160 = 20
)

Variables

This section is empty.

Functions

func New160

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

New160 returns a new hash.Hash computing the BLAKE2b-160 checksum. A non-nil key turns the hash into a MAC. The key must between 0 and 64 byte.

func New256

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

New256 returns a new hash.Hash computing the BLAKE2b-256 checksum. A non-nil key turns the hash into a MAC. The key must between 0 and 64 byte.

func New384

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

New384 returns a new hash.Hash computing the BLAKE2b-384 checksum. A non-nil key turns the hash into a MAC. The key must between 0 and 64 byte.

func New512

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

New512 returns a new hash.Hash computing the BLAKE2b-512 checksum. A non-nil key turns the hash into a MAC. The key must between 0 and 64 byte.

func Sum160

func Sum160(data []byte) [Size160]byte

Sum160 returns the BLAKE2b-160 checksum of the data.

func Sum256

func Sum256(data []byte) [Size256]byte

Sum256 returns the BLAKE2b-256 checksum of the data.

func Sum384

func Sum384(data []byte) [Size384]byte

Sum384 returns the BLAKE2b-384 checksum of the data.

func Sum512

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

Sum512 returns the BLAKE2b-512 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