hashing.aug
Hashing with Rust BLAKE3 · Source and specification
Files in this project
Code
aug
// aug-spec: "hashing.aug.md" explains this file. Read it before changes; refresh with aug spec.
import HashError and hash from "https://github.com/GreenPandaStudios/aug-blake3#e9f7b92d98a2f9c36de530f4dfc1740012fb5e5e"
/** Hash UTF-8 text with the real Rust BLAKE3 implementation. */
hashText(string value) returns string unless HashError:
return hash(input=value.bytes())
test hashText:
when "vectors":
it "matches_the_published_abc_vector":
assert(
hashText(value="abc") == "6437b3ac38465133ffb63b75273a8db548c558465d79db03fd359c6cd5bd9d85"
)aug
// aug-spec: "hashing.aug.md" explains this file. Read it before changes; refresh with aug spec.
import HashError and hash from "https://github.com/GreenPandaStudios/aug-blake3#e9f7b92d98a2f9c36de530f4dfc1740012fb5e5e"
/** Hash UTF-8 text with the real Rust BLAKE3 implementation. */
hashText(string value) returns string unless HashError {
return hash(input=value.bytes())
}
test hashText {
when "vectors" {
it "matches_the_published_abc_vector" {
assert(
hashText(value="abc") == "6437b3ac38465133ffb63b75273a8db548c558465d79db03fd359c6cd5bd9d85"
)
}
}
}Compiled specification
hashText · source
Hash UTF-8 text with the real Rust BLAKE3 implementation. It takes value as a string. Failures can raise HashError. It returns hash with input from the UTF-8 bytes of value. source
Checked interface
text
hashText(string value) returns string unless HashErrorIt takes value as a string. Failures can raise HashError.
test hashText · source
Tests hashText. Each case gets fresh setup and dependencies.
vectors
The test requires hashText with value "abc" equals "6437b3ac38465133ffb63b75273a8db548c558465d79db03fd359c6cd5bd9d85". source
Dependencies
It uses hash and HashError from https://github.com/GreenPandaStudios/aug-blake3#e9f7b92d98a2f9c36de530f4dfc1740012fb5e5e.
Built-in operations follow the language reference.