Skip to content

Commit fef8423

Browse files
committed
add rust reference implementation in package
1 parent f1a31cb commit fef8423

File tree

8 files changed

+450
-0
lines changed

8 files changed

+450
-0
lines changed

packages/blake3-wasm/.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
vendor

packages/blake3-wasm/vendor/Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "blake3-example"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[lib]
7+
name = "reference_impl"
8+
path = "src/lib.rs"
9+
10+
[[bin]]
11+
name = "blake3-example"
12+
path = "src/main.rs"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# BLAKE3 Example
2+
3+
This is a simple example that demonstrates using the BLAKE3 hash function with empty input.
4+
5+
## Prerequisites
6+
7+
- Rust and Cargo installed on your system. You can install them from [rustup.rs](https://rustup.rs/)
8+
9+
## Running the Example
10+
11+
1. Open a terminal in this directory
12+
2. Run the following command:
13+
```bash
14+
cargo run
15+
```
16+
17+
The program will output a 32-byte hash in hexadecimal format. For empty input, the expected output should be:
18+
```
19+
af1349b9f5f9a1a6a0404dea36dcc9499bcb25c9adc112b7cc9a93cae41f3262
20+
```
21+
22+
## What the Code Does
23+
24+
1. Creates a new BLAKE3 hasher
25+
2. Updates it with empty input
26+
3. Finalizes the hash into a 32-byte buffer
27+
4. Prints the hash in hexadecimal format

0 commit comments

Comments
 (0)