This commit is contained in:
2025-09-02 07:28:13 +02:00
parent ff1b343a95
commit b0f82ac834
92 changed files with 27608 additions and 0 deletions

View File

@@ -0,0 +1,254 @@
# module blake2s
## Contents
- [Constants](#Constants)
- [new128](#new128)
- [new160](#new160)
- [new224](#new224)
- [new256](#new256)
- [new_digest](#new_digest)
- [new_pmac128](#new_pmac128)
- [new_pmac160](#new_pmac160)
- [new_pmac224](#new_pmac224)
- [new_pmac256](#new_pmac256)
- [pmac128](#pmac128)
- [pmac160](#pmac160)
- [pmac224](#pmac224)
- [pmac256](#pmac256)
- [sum128](#sum128)
- [sum160](#sum160)
- [sum224](#sum224)
- [sum256](#sum256)
- [Digest](#Digest)
- [str](#str)
- [write](#write)
- [checksum](#checksum)
## Constants
```v
const size128 = 16
```
size128 is the size, in bytes, of a Blake2s 128 checksum.
[[Return to contents]](#Contents)
```v
const size160 = 20
```
size160 is the size, in bytes, of a Blake2s 160 checksum.
[[Return to contents]](#Contents)
```v
const size224 = 28
```
size224 is the size, in bytes, of a Blake2s 224 checksum.
[[Return to contents]](#Contents)
```v
const size256 = 32
```
size256 is the size, in bytes, of a Blake2s 256 checksum.
[[Return to contents]](#Contents)
```v
const block_size = 64
```
block_size is the block size, in bytes, of the Blake2s hash functions.
[[Return to contents]](#Contents)
## new128
```v
fn new128() !&Digest
```
new126 initializes the digest structure for a Blake2s 128 bit hash
[[Return to contents]](#Contents)
## new160
```v
fn new160() !&Digest
```
new160 initializes the digest structure for a Blake2s 160 bit hash
[[Return to contents]](#Contents)
## new224
```v
fn new224() !&Digest
```
new224 initializes the digest structure for a Blake2s 224 bit hash
[[Return to contents]](#Contents)
## new256
```v
fn new256() !&Digest
```
new256 initializes the digest structure for a Blake2s 256 bit hash
[[Return to contents]](#Contents)
## new_digest
```v
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 32.
key - key used for generating a prefix MAC. A zero length key is used for just generating a hash. A key of 1 to 32 bytes can be used for generating a prefix MAC.
[[Return to contents]](#Contents)
## new_pmac128
```v
fn new_pmac128(key []u8) !&Digest
```
new_pmac128 initializes the digest structure for a Blake2s 128 bit prefix MAC
[[Return to contents]](#Contents)
## new_pmac160
```v
fn new_pmac160(key []u8) !&Digest
```
new_pmac160 initializes the digest structure for a Blake2s 160 bit prefix MAC
[[Return to contents]](#Contents)
## new_pmac224
```v
fn new_pmac224(key []u8) !&Digest
```
new_pmac224 initializes the digest structure for a Blake2s 224 bit prefix MAC
[[Return to contents]](#Contents)
## new_pmac256
```v
fn new_pmac256(key []u8) !&Digest
```
new_pmac256 initializes the digest structure for a Blake2s 256 bit prefix MAC
[[Return to contents]](#Contents)
## pmac128
```v
fn pmac128(data []u8, key []u8) []u8
```
pmac128 returns the Blake2s 128 bit prefix MAC of the data.
[[Return to contents]](#Contents)
## pmac160
```v
fn pmac160(data []u8, key []u8) []u8
```
pmac160 returns the Blake2s 160 bit prefix MAC of the data.
[[Return to contents]](#Contents)
## pmac224
```v
fn pmac224(data []u8, key []u8) []u8
```
pmac224 returns the Blake2s 224 bit prefix MAC of the data.
[[Return to contents]](#Contents)
## pmac256
```v
fn pmac256(data []u8, key []u8) []u8
```
pmac256 returns the Blake2s 256 bit prefix MAC of the data.
[[Return to contents]](#Contents)
## sum128
```v
fn sum128(data []u8) []u8
```
sum128 returns the Blake2s 128 bit checksum of the data.
[[Return to contents]](#Contents)
## sum160
```v
fn sum160(data []u8) []u8
```
sum160 returns the Blake2s 160 bit checksum of the data.
[[Return to contents]](#Contents)
## sum224
```v
fn sum224(data []u8) []u8
```
sum224 returns the Blake2s 224 bit checksum of the data.
[[Return to contents]](#Contents)
## sum256
```v
fn sum256(data []u8) []u8
```
sum256 returns the Blake2s 256 bit checksum of the data.
[[Return to contents]](#Contents)
## Digest
## str
```v
fn (d Digest) str() string
```
string makes a formatted string representation of a Digest structure
[[Return to contents]](#Contents)
## write
```v
fn (mut d Digest) write(data []u8) !
```
write adds bytes to the hash
[[Return to contents]](#Contents)
## checksum
```v
fn (mut d Digest) checksum() []u8
```
checksum finalizes the hash and returns the generated bytes.
[[Return to contents]](#Contents)
#### Powered by vdoc. Generated on: 2 Sep 2025 07:18:17