#blake2 #blake2b #blake2sp #blake2bp

app blake2_bin

a command line implementation of BLAKE2b/s/bp/sp and all their parameters

14 releases (5 stable)

Uses new Rust 2024

1.0.4 Jan 10, 2026
1.0.3 Feb 4, 2025
1.0.2 Sep 10, 2023
1.0.1 Feb 9, 2023
0.5.5 Jul 22, 2019

#165 in Algorithms

MIT license

315KB
6.5K SLoC

blake2_bin

The blake2_bin crate provides the blake2 command line utility, based on the blake2b_simd and blake2s_simd implementations of BLAKE2. It supports BLAKE2b, BLAKE2s, BLAKE2bp, and BLAKE2sp.

Installation

cargo install blake2_bin

Example

# Hash standard input, using BLAKE2b by default.
$ echo hello world | blake2
fec91c70284c72d0d4e3684788a90de9338a5b2f47f01fedbe203cafd68708718ae5672d10eca804a8121904047d40d1d6cf11e7a76419357a9469af41f22d01

# Since BLAKE2b is the default, explicitly adding the -b flag gives the same result.
$ echo hello world | blake2 -b
fec91c70284c72d0d4e3684788a90de9338a5b2f47f01fedbe203cafd68708718ae5672d10eca804a8121904047d40d1d6cf11e7a76419357a9469af41f22d01

# Using the -s and -p flags together gives BLAKE2sp.
$ echo hello world | blake2 -sp
43958a843c00345bae4492cc04ecd1e47453469afeae277e067cad66244625eb

# The full set of command line options.
$ blake2 --help
Usage: blake2 [OPTIONS] [INPUTS]...

Arguments:
  [INPUTS]...  Any number of filepaths, or empty for standard input

Options:
  -b                                           Use the BLAKE2b hash function (default)
  -s                                           Use the BLAKE2s hash function
  -p                                           Use the parallel variant, BLAKE2bp or BLAKE2sp
      --length <LENGTH>                        Set the length of the output in bytes
      --key <KEY>                              Set the key parameter with a hex string
      --salt <SALT>                            Set the salt parameter with a hex string
      --personal <PERSONAL>                    Set the personalization parameter with a hex string
      --fanout <FANOUT>                        Set the fanout parameter
      --max-depth <MAX_DEPTH>                  Set the max depth parameter
      --max-leaf-length <MAX_LEAF_LENGTH>      Set the max leaf length parameter
      --node-offset <NODE_OFFSET>              Set the node offset parameter
      --node-depth <NODE_DEPTH>                Set the node depth parameter
      --inner-hash-length <INNER_HASH_LENGTH>  Set the inner hash length parameter
      --last-node                              Set the last node flag
      --mmap                                   Read input with memory mapping
  -h, --help                                   Print help
  -V, --version                                Print version

Dependencies

~1.3–2MB
~35K SLoC