packages/@greenpandastudios/aug-blake3/0.2.0/api.aug
Hashing with Rust BLAKE3 · Dependency source and specification
This is the exact dependency version used by this example.
Code
// Generated by aug spec. This is a copy of the installed dependency source.
// aug-spec: "api.aug.md" explains this file. Read it before changes; refresh with aug spec.
import HashError from contracts
extern C _hash(Bytes input) returns string unless HashError
/** Return a lowercase 64-character BLAKE3 digest, computed by the Rust crate. */
hash(Bytes input) returns string:
unsafe:
return _hash(input)
test hash:
when "vectors":
it "hashes_abc":
Bytes input = "abc".bytes()
assert(
hash(input) == "6437b3ac38465133ffb63b75273a8db548c558465d79db03fd359c6cd5bd9d85"
)// Generated by aug spec. This is a copy of the installed dependency source.
// aug-spec: "api.aug.md" explains this file. Read it before changes; refresh with aug spec.
import HashError from contracts
extern C _hash(Bytes input) returns string unless HashError
/** Return a lowercase 64-character BLAKE3 digest, computed by the Rust crate. */
hash(Bytes input) returns string {
unsafe {
return _hash(input)
}
}
test hash {
when "vectors" {
it "hashes_abc" {
Bytes input = "abc".bytes()
assert(
hash(input) == "6437b3ac38465133ffb63b75273a8db548c558465d79db03fd359c6cd5bd9d85"
)
}
}
}Compiled specification
hash · source
Return a lowercase 64-character BLAKE3 digest, computed by the Rust crate. It takes input as Bytes. Failures can raise HashError.
Within an unsafe block, it returns _hash with input. Native operations must satisfy their declared C contracts. source
Checked interface
hash(Bytes input) returns string unless HashErrorIt takes input as Bytes. Failures can raise HashError.
_hash · source
It is private to its defining scope. It takes input as Bytes. It returns string. Failures can raise HashError.
Native implementation: @greenpandastudios/aug-blake3@0.2.0, 1.8.7. Supported targets: linux arm64 glibc 2.36+, linux x64 glibc 2.36+, macos arm64 14.0+. Binding contract: native.abi.json (SHA-256 3bf8dea97cde70a03021bf77ea08314d6d37fe7b4935ff16030b2ab929c21279). It calls aug_blake3_hash_v1 through the C ABI on the caller thread; a blocking native call blocks that thread. August copies the returned buffer, then calls aug_blake3_text_release_v1 to release it. Its contract does not permit worker entry. The compiler checks the provider, descriptor digest, signature and ownership at August call sites. The native author promises not to retain inputs, enter August from foreign threads, or unwind across the C boundary; internal native workers may run. The compiler does not prove those promises.
test hash · source
Tests hash. Each case gets fresh setup and dependencies.
vectors
It sets input of type Bytes to bytes on "abc". The test requires hash with input equals "6437b3ac38465133ffb63b75273a8db548c558465d79db03fd359c6cd5bd9d85". source
Dependencies
It uses HashError from contracts.
Built-in operations follow the language reference.