#hashing #hash #hasher #algorithm #portable #byte #quality

no-std museair

Fast portable hash algorithm with highest bulk throughput and lowest small key latency (1-32 bytes) among portable hashes listed in SMHasher3, and made improvements for quality and usability

3 unstable releases

0.3.0 Dec 20, 2024
0.3.0-rc6 Nov 20, 2024
0.2.0 Aug 14, 2024

#1231 in Algorithms

Download history 40/week @ 2024-09-03 16/week @ 2024-09-10 21/week @ 2024-09-17 21/week @ 2024-09-24 8/week @ 2024-10-01 5/week @ 2024-10-08 2/week @ 2024-10-29 42/week @ 2024-11-05 125/week @ 2024-11-19 4/week @ 2024-11-26 1/week @ 2024-12-03 23/week @ 2024-12-10 108/week @ 2024-12-17

137 downloads per month
Used in musemap

MIT/Apache

25KB
495 lines

MuseAir

A fast portable hash algorithm with highest bulk throughput and lowest small key latency (1-32 bytes) among portable hashes listed in SMHasher3, and made improvements for quality and usability. See repository for details.

It provides two variants: Standard (items listed in crate root) and BFast. The former offers better quality and the latter offers better performance. Both variants offer 64-bit and 128-bit output with essentially the same overhead.

Usage

let seed: u64 = 42;

let one_shot = museair::hash_128("K--Aethiax".as_bytes(), seed);
let streamed = {
    let mut hasher = museair::Hasher::with_seed(seed);
    hasher.write("K--Ae".as_bytes());
    hasher.write("thiax".as_bytes());
    hasher.finish_128()
};

assert_eq!(one_shot, streamed);

Security

MuseAir is NOT designed for cryptographic security. You shouldn't use this for security purposes, such as ensuring that files have not been maliciously tampered with. For these use cases, consider SHA-3, Ascon or Blake3.

Besides, MuseAir-Standard is planned to be stable after some time (1.0.0). Due to its improved quality, it will then be available for the following purposes:

  • Persistent file format
  • Communication protocol
  • ...

Until then, it should only be used for local sessions!

Benchmarks

Hash Digest length Throughput
MuseAir 64-bit 30.5 GiB/s
MuseAir-128 128-bit 30.4 GiB/s
MuseAir-BFast 64-bit 36.4 GiB/s
MuseAir-BFast-128 128-bit 36.3 GiB/s
wyhash 4.2 64-bit 28.4 GiB/s
wyhash.condom 4.2 64-bit 22.8 GiB/s
komihash 5.10 64-bit 26.8 GiB/s
Bench small keys

No runtime deps