{"id":13470706,"url":"https://github.com/BLAKE3-team/BLAKE3","last_synced_at":"2025-03-26T11:33:04.766Z","repository":{"id":37588015,"uuid":"220778874","full_name":"BLAKE3-team/BLAKE3","owner":"BLAKE3-team","description":"the official Rust and C implementations of the BLAKE3 cryptographic hash function","archived":false,"fork":false,"pushed_at":"2024-10-08T12:05:59.000Z","size":1800,"stargazers_count":5096,"open_issues_count":146,"forks_count":349,"subscribers_count":78,"default_branch":"master","last_synced_at":"2024-10-25T06:24:48.280Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Assembly","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BLAKE3-team.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE_A2","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-10T11:15:44.000Z","updated_at":"2024-10-24T22:58:26.000Z","dependencies_parsed_at":"2024-01-05T23:56:06.038Z","dependency_job_id":"f28f041b-619a-4f32-bfb9-d1366b592c21","html_url":"https://github.com/BLAKE3-team/BLAKE3","commit_stats":{"total_commits":640,"total_committers":64,"mean_commits":10.0,"dds":0.3609375,"last_synced_commit":"aa3e8ec32a389461babde3789d6ac50ee3c38662"},"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BLAKE3-team%2FBLAKE3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BLAKE3-team%2FBLAKE3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BLAKE3-team%2FBLAKE3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BLAKE3-team%2FBLAKE3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BLAKE3-team","download_url":"https://codeload.github.com/BLAKE3-team/BLAKE3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221410421,"owners_count":16815434,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T16:00:34.702Z","updated_at":"2024-10-30T00:31:37.290Z","avatar_url":"https://github.com/BLAKE3-team.png","language":"Assembly","funding_links":[],"categories":["Assembly","others","Frameworks and Libs","Cryptography"],"sub_categories":["Rust","Hash Function"],"readme":"# BLAKE3\n\nBLAKE3 is a cryptographic hash function that is:\n\n- **Much faster** than MD5, SHA-1, SHA-2, SHA-3, and BLAKE2.\n- **Secure**, unlike MD5 and SHA-1. And secure against length extension,\n  unlike SHA-2.\n- **Highly parallelizable** across any number of threads and SIMD lanes,\n  because it's a Merkle tree on the inside.\n- Capable of **verified streaming** and **incremental updates**, again\n  because it's a Merkle tree.\n- A **PRF**, **MAC**, **KDF**, and **XOF**, as well as a regular hash.\n- **One algorithm with no variants**, which is fast on x86-64 and also\n  on smaller architectures.\n\nThe [chart below](https://github.com/BLAKE3-team/BLAKE3-specs/blob/master/benchmarks/bar_chart.py)\nis an example benchmark of 16 KiB inputs on a Cascade Lake-SP 8275CL server CPU\nfrom 2019. For more detailed benchmarks, see the\n[BLAKE3 paper](https://github.com/BLAKE3-team/BLAKE3-specs/blob/master/blake3.pdf).\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"media/speed.svg\" alt=\"performance graph\"\u003e\n\u003c/p\u003e\n\nBLAKE3 is based on an optimized instance of the established hash\nfunction [BLAKE2](https://blake2.net) and on the [original Bao tree\nmode](https://github.com/oconnor663/bao/blob/master/docs/spec_0.9.1.md).\nThe specifications and design rationale are available in the [BLAKE3\npaper](https://github.com/BLAKE3-team/BLAKE3-specs/blob/master/blake3.pdf).\nThe default output size is 256 bits. The current version of\n[Bao](https://github.com/oconnor663/bao) implements verified streaming\nwith BLAKE3.\n\nThis repository is the official implementation of BLAKE3. It includes:\n\n* The [`blake3`](https://crates.io/crates/blake3) Rust crate, which\n  includes optimized implementations for SSE2, SSE4.1, AVX2, AVX-512,\n  and NEON, with automatic runtime CPU feature detection on x86. The\n  `rayon` feature provides multithreading.\n\n* The [`b3sum`](https://crates.io/crates/b3sum) Rust crate, which\n  provides a command line interface. It uses multithreading by default,\n  making it an order of magnitude faster than e.g. `sha256sum` on\n  typical desktop hardware.\n\n* The [C implementation](c), which like the Rust implementation includes\n  SIMD code and runtime CPU feature detection on x86. Unlike the Rust\n  implementation, it's [not currently multithreaded](c#multithreading). See\n  [`c/README.md`](c/README.md).\n\n* The [Rust reference implementation](reference_impl/reference_impl.rs),\n  which is discussed in Section 5.1 of the [BLAKE3\n  paper](https://github.com/BLAKE3-team/BLAKE3-specs/blob/master/blake3.pdf).\n  This implementation is much smaller and simpler than the optimized\n  ones above. If you want to see how BLAKE3 works, or you're writing a\n  port that doesn't need multithreading or SIMD optimizations, start\n  here. Ports of the reference implementation to other languages are\n  hosted in separate repositories\n  ([C](https://github.com/oconnor663/blake3_reference_impl_c),\n  [Python](https://github.com/oconnor663/pure_python_blake3)).\n\n* A [set of test\n  vectors](https://github.com/BLAKE3-team/BLAKE3/blob/master/test_vectors/test_vectors.json)\n  that covers extended outputs, all three modes, and a variety of input\n  lengths.\n\n* [![Actions Status](https://github.com/BLAKE3-team/BLAKE3/workflows/tests/badge.svg)](https://github.com/BLAKE3-team/BLAKE3/actions)\n\nBLAKE3 was designed by:\n\n* [@oconnor663] (Jack O'Connor)\n* [@sneves] (Samuel Neves)\n* [@veorq] (Jean-Philippe Aumasson)\n* [@zookozcash] (Zooko)\n\nThe development of BLAKE3 was sponsored by [Electric Coin Company](https://electriccoin.co).\n\nBLAKE3 is also [specified](https://c2sp.org/BLAKE3) in the [Community\nCryptography Specification Project (C2SP)](https://c2sp.org).\n\n*NOTE: BLAKE3 is not a password hashing algorithm, because it's\ndesigned to be fast, whereas password hashing should not be fast. If you\nhash passwords to store the hashes or if you derive keys from passwords,\nwe recommend [Argon2](https://github.com/P-H-C/phc-winner-argon2).*\n\n## Usage\n\n### The `b3sum` utility\n\nThe `b3sum` command line utility prints the BLAKE3 hashes of files or of\nstandard input. Prebuilt binaries are available for Linux, Windows, and\nmacOS (requiring the [unidentified developer\nworkaround](https://support.apple.com/guide/mac-help/open-a-mac-app-from-an-unidentified-developer-mh40616/mac))\non the [releases page](https://github.com/BLAKE3-team/BLAKE3/releases).\nIf you've [installed Rust and\nCargo](https://doc.rust-lang.org/cargo/getting-started/installation.html),\nyou can also build `b3sum` yourself with:\n\n```bash\ncargo install b3sum\n```\n\nIf `rustup` didn't configure your `PATH` for you, you might need to go\nlooking for the installed binary in e.g. `~/.cargo/bin`. You can test\nout how fast BLAKE3 is on your machine by creating a big file and\nhashing it, for example:\n\n```bash\n# Create a 1 GB file.\nhead -c 1000000000 /dev/zero \u003e /tmp/bigfile\n# Hash it with SHA-256.\ntime openssl sha256 /tmp/bigfile\n# Hash it with BLAKE3.\ntime b3sum /tmp/bigfile\n```\n\n### The `blake3` crate [![docs.rs](https://docs.rs/blake3/badge.svg)](https://docs.rs/blake3)\n\nTo use BLAKE3 from Rust code, add a dependency on the `blake3` crate to\nyour `Cargo.toml`. Here's an example of hashing some input bytes:\n\n```rust\n// Hash an input all at once.\nlet hash1 = blake3::hash(b\"foobarbaz\");\n\n// Hash an input incrementally.\nlet mut hasher = blake3::Hasher::new();\nhasher.update(b\"foo\");\nhasher.update(b\"bar\");\nhasher.update(b\"baz\");\nlet hash2 = hasher.finalize();\nassert_eq!(hash1, hash2);\n\n// Extended output. OutputReader also implements Read and Seek.\nlet mut output = [0; 1000];\nlet mut output_reader = hasher.finalize_xof();\noutput_reader.fill(\u0026mut output);\nassert_eq!(hash1, output[..32]);\n\n// Print a hash as hex.\nprintln!(\"{}\", hash1);\n```\n\nBesides `hash`, BLAKE3 provides two other modes, `keyed_hash` and\n`derive_key`. The `keyed_hash` mode takes a 256-bit key:\n\n```rust\n// MAC an input all at once.\nlet example_key = [42u8; 32];\nlet mac1 = blake3::keyed_hash(\u0026example_key, b\"example input\");\n\n// MAC incrementally.\nlet mut hasher = blake3::Hasher::new_keyed(\u0026example_key);\nhasher.update(b\"example input\");\nlet mac2 = hasher.finalize();\nassert_eq!(mac1, mac2);\n```\n\nThe `derive_key` mode takes a context string and some key material (not a\npassword). The context string should be hardcoded, globally unique, and\napplication-specific. A good default format for the context string is\n`\"[application] [commit timestamp] [purpose]\"`:\n\n```rust\n// Derive a couple of subkeys for different purposes.\nconst EMAIL_CONTEXT: \u0026str = \"BLAKE3 example 2020-01-07 17:10:44 email key\";\nconst API_CONTEXT: \u0026str = \"BLAKE3 example 2020-01-07 17:11:21 API key\";\nlet input_key_material = b\"usually at least 32 random bytes, not a password\";\nlet email_key = blake3::derive_key(EMAIL_CONTEXT, input_key_material);\nlet api_key = blake3::derive_key(API_CONTEXT, input_key_material);\nassert_ne!(email_key, api_key);\n```\n\n### The C implementation\n\nSee [`c/README.md`](c/README.md).\n\n### Other implementations\n\nWe post links to third-party bindings and implementations on the\n[@BLAKE3team Twitter account](https://twitter.com/BLAKE3team) whenever\nwe hear about them. Some highlights include [an optimized Go\nimplementation](https://github.com/zeebo/blake3), [Wasm bindings for\nNode.js and browsers](https://github.com/connor4312/blake3), [binary\nwheels for Python](https://github.com/oconnor663/blake3-py), [.NET\nbindings](https://github.com/xoofx/Blake3.NET), and [JNI\nbindings](https://github.com/sken77/BLAKE3jni).\n\n## Contributing\n\nPlease see [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## Licenses\n\nThis work is released into the public domain with [CC0 1.0](./LICENSE_CC0).\nAlternatively, it is licensed under any of the following:\n\n* [Apache 2.0](./LICENSE_A2)\n* [Apache 2.0 with LLVM exceptions](./LICENSE_A2LLVM)\n\n\n## Adoption \u0026 deployment\n\nHere's a (non-exhaustive) list of protocols and software that use BLAKE3:\n\n* [Alephium](https://github.com/alephium/alephium/blob/master/crypto/src/main/scala/org/alephium/crypto/Blake3.scala)\n* [Bazel](https://github.com/bazelbuild/bazel/releases/tag/6.4.0)\n* [Chia](https://github.com/Chia-Network/chia-blockchain/blob/main/CHANGELOG.md#10beta8-aka-beta-18---2020-07-16)\n* [IPFS](https://github.com/ipfs/go-verifcid/issues/13)\n* [Farcaster](https://www.farcaster.xyz/)\n* [LLVM](https://reviews.llvm.org/D121510)\n* [Nym](https://github.com/nymtech/nym/blob/59056a22c5e6b01a38da2124662bd1fa3c8abef2/common/nymsphinx/params/src/lib.rs#L5)\n* [OpenZFS](https://github.com/openzfs/zfs/)\n* [Redox](https://www.redox-os.org/news/pkgar-introduction/)\n* [Saito](https://saito.tech/)\n* [Skale](https://github.com/skalenetwork/skale-consensus/pull/284)\n* [Solana](https://docs.rs/solana-program/1.9.5/solana_program/blake3/index.html)\n* [Tekken 8](https://en.bandainamcoent.eu/tekken/tekken-8)\n* [Wasmer](https://github.com/wasmerio/wasmer/blob/4f935a8c162bf604df223003e434e4f7ca253688/lib/cache/src/hash.rs#L21)\n\n\n## Miscellany\n\n- [@veorq] and [@oconnor663] did [an interview with Cryptography FM](https://www.cryptography.fm/3).\n- [@oconnor663] did [an interview with Saito](https://www.youtube.com/watch?v=cJkmIt7yN_E).\n\n[@oconnor663]: https://github.com/oconnor663\n[@sneves]: https://github.com/sneves\n[@veorq]: https://github.com/veorq\n[@zookozcash]: https://github.com/zookozcash\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBLAKE3-team%2FBLAKE3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBLAKE3-team%2FBLAKE3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBLAKE3-team%2FBLAKE3/lists"}