4.5 KiB
module blake2b
Contents
- Constants
- new160
- new256
- new384
- new512
- new_digest
- new_pmac160
- new_pmac256
- new_pmac384
- new_pmac512
- pmac160
- pmac256
- pmac384
- pmac512
- sum160
- sum256
- sum384
- sum512
- Digest
Constants
const size160 = 20
size160 is the size, in bytes, of a Blake2b 160 checksum.
const size256 = 32
size256 is the size, in bytes, of a Blake2b 256 checksum.
const size384 = 48
size384 is the size, in bytes, of a Blake2b 384 checksum.
const size512 = 64
size512 is the size, in bytes, of a Blake2b 512 checksum.
const block_size = 128
block_size is the block size, in bytes, of the Blake2b hash functions.
new160
fn new160() !&Digest
new160 initializes the digest structure for a Blake2b 160 bit hash
new256
fn new256() !&Digest
new256 initializes the digest structure for a Blake2b 256 bit hash
new384
fn new384() !&Digest
new384 initializes the digest structure for a Blake2b 384 bit hash
new512
fn new512() !&Digest
new512 initializes the digest structure for a Blake2b 512 bit hash
new_digest
fn new_digest(hash_size u8, key []u8) !&Digest
new_digest creates an initialized digest structure based on the hash size and whether or not you specify a MAC key.
hash_size - the number of bytes in the generated hash. Legal values are between 1 and 64.
key - key used for generating a prefix MAC. A zero length key is used for just generating a hash. A key of 1 to 64 bytes can be used for generating a prefix MAC.
new_pmac160
fn new_pmac160(key []u8) !&Digest
new_pmac160 initializes the digest structure for a Blake2b 160 bit prefix MAC
new_pmac256
fn new_pmac256(key []u8) !&Digest
new_pmac256 initializes the digest structure for a Blake2b 256 bit prefix MAC
new_pmac384
fn new_pmac384(key []u8) !&Digest
new_pmac384 initializes the digest structure for a Blake2b 384 bit prefix MAC
new_pmac512
fn new_pmac512(key []u8) !&Digest
new_pmac512 initializes the digest structure for a Blake2b 512 bit prefix MAC
pmac160
fn pmac160(data []u8, key []u8) []u8
pmac160 returns the Blake2b 160 bit prefix MAC of the data.
pmac256
fn pmac256(data []u8, key []u8) []u8
pmac256 returns the Blake2b 256 bit prefix MAC of the data.
pmac384
fn pmac384(data []u8, key []u8) []u8
pmac384 returns the Blake2b 384 bit prefix MAC of the data.
pmac512
fn pmac512(data []u8, key []u8) []u8
pmac512 returns the Blake2b 512 bit prefix MAC of the data.
sum160
fn sum160(data []u8) []u8
sum160 returns the Blake2b 160 bit checksum of the data.
sum256
fn sum256(data []u8) []u8
sum256 returns the Blake2b 256 bit checksum of the data.
sum384
fn sum384(data []u8) []u8
sum384 returns the Blake2b 384 bit checksum of the data.
sum512
fn sum512(data []u8) []u8
sum512 returns the Blake2b 512 bit checksum of the data.
Digest
str
fn (d Digest) str() string
string makes a formatted string representation of a Digest structure
write
fn (mut d Digest) write(data []u8) !
write adds bytes to the hash
checksum
fn (mut d Digest) checksum() []u8
checksum finalizes the hash and returns the generated bytes.