#sha256 #hash #asynchronous #stream

async-hash

Traits and helper functions for SHA256 hashing of async data types

6 releases (3 breaking)

0.4.1 Jan 21, 2023
0.4.0 Jan 21, 2023
0.3.1 Jan 5, 2022
0.2.1 Dec 21, 2021
0.1.0 Dec 20, 2021

#658 in Cryptography

Download history 63/week @ 2022-11-27 66/week @ 2022-12-04 70/week @ 2022-12-11 46/week @ 2022-12-18 36/week @ 2022-12-25 35/week @ 2023-01-01 77/week @ 2023-01-08 66/week @ 2023-01-15 54/week @ 2023-01-22 66/week @ 2023-01-29 48/week @ 2023-02-05 48/week @ 2023-02-12 73/week @ 2023-02-19 93/week @ 2023-02-26 40/week @ 2023-03-05 12/week @ 2023-03-12

222 downloads per month
Used in 10 crates (6 directly)

Apache-2.0

10KB
247 lines

async-hash

A Rust library for SHA256 hashing of data structures which only support async access


lib.rs:

Provides traits Hash, HashStream, and HashTryStream for SHA-2 hashing of data that must be accessed asynchronously, e.g. a [Stream] or database table.

Hash is implemented for standard Rust types:

  • Primitive types:
    • bool
    • i8, i16, i32, i64, i128, isize
    • u8, u16, u32, u64, u128, usize
    • f32, f64
    • &str
    • String
  • Common standard library types:
    • Option<T>
    • PhantomData<T>
  • Compound types:
    • [T; 0] through [T; 32]
    • tuples up to size 16
  • Collection types:
    • BTreeMap<K, V>
    • BTreeSet<T>
    • BinaryHeap<T>
    • LinkedList<T>
    • VecDeque<T>
    • Vec<T>

IMPORTANT: hashing is order-dependent. Do not implement the traits in this crate for any data structure which does not have a consistent order. Consider using the collate crate if you need to use a type which does not implement [Ord].

Dependencies

~1MB
~25K SLoC