Skip to content

MuseAir is the new fastest portable hash: immune to blinding multiplication, even faster then wyhash, passed SMHasher3.

Notifications You must be signed in to change notification settings

eternal-io/museair

Repository files navigation

MuseAir

  • Portable, does NOT rely on machine-specific instructions such as SSE, AVX, CLMUL, CRC32, etc.

  • Completely immune to blinding multiplication, and accumulates the full 128-bit multiplication results instead of prematurely "compressing" them into 64-bit, this helps maintain the differentiation between consecutive states and reduces entropy loss.

  • As fast as WyHash and its successor RapidHash on bulks, but they suffer from blinding multiplication.

  • Inputs are never simply mixed with constants, and the algorithm correctly implements seeding. This prevents seed-independent attacks and does not require additional secret[] to be remedied.

  • Inputs are not divided into stripes while processing, this results in better confusion and diffusion.

  • Produces either 64-bit or 128-bit results with nearly the same performance overhead.

Actually, MuseAir has two variants: Standard (this suffix is ​​omitted where it does not cause confusion) and BFast.

As its name suggests, the BFast variant is faster but less immune to blinding multiplication. ("less" here means when it actually happens, it will only result in the most recent 8 bytes being lost, rather than all the past state of a stripe being catastrophically lost!)

Benchmarks

Bulk datas

Hash Digest length Throughput (C++ - SMHasher3) Throughput (Rust - Criterion.rs)
MuseAir 64-bit 31.8 GiB/s (0.96) 29.1 GiB/s (0.88)
MuseAir-128 128-bit 31.8 GiB/s (0.96) 29.0 GiB/s (0.88)
MuseAir-BFast 64-bit 33.2 GiB/s (1.00) 33.0 GiB/s (1.00)
MuseAir-BFast-128 128-bit 33.2 GiB/s (1.00) 33.0 GiB/s (1.00)
WyHash 64-bit 31.9 GiB/s (0.96) 29.0 GiB/s (0.88)
WyHash-condom 64-bit 25.3 GiB/s (0.76) 24.3 GiB/s (0.74)
KomiHash 64-bit 25.5 GiB/s (0.77) 27.7 GiB/s (0.84)

(These results are obtained by running ./SMHasher3 --test=Speed <HASH> and cargo bench on AMD Ryzen 7 5700G 4.6GHz Desktop.)

Small datas

Currently there is no targeted design, it is simply modified from rapidhash.

Therefore, for short inputs no more than 16 bytes, the performance is similar to rapidhash.

For short inputs larger than 16 bytes, the function call overhead makes them slower because there is a function that should not be inlined (otherwise the entire hash performance will be slower on all input sizes). This is the next step to focus on optimization.

Quality

They all passed SMHasher3 with --extra option.

And no bad seeds were found (took too long, so only MuseAir-BFast was searched).

The museair.cpp in the repository root is for use with SMHasher3, so you can reproduce these results on your computer. Since it relies on the entire SMHasher3, it is not very usable in production.

Update: They also passed SMHasher with --extra option, with only one false positive.

(For keys shorter than 16 bytes, MuseAir and MuseAir-BFast have the same output.)

Security

MuseAir is NOT intended for cryptographic security.

  • To resist HashDoS, your hash must comes with a private seed.
  • To ensure the protection of your data, it is recommended to use a well-established algorithm, such as SHA-3.

Versioning policy

The Standard variant (functions listed in the crate root) is not scheduled to be stable until version 1.0.0 is released. That is, the result of the hash may change from minor version to minor version. Don't use it for persistent storage yet.

The BFast variant will never be stable, you should only use this on local sessions.

Implementations

This repository provides the official Rust implementation of MuseAir. You can find this crate on crates.io.

0.2

Language Author Link
C K--Aethiax https://github.com/eternal-io/museair-c
C++ Twilight-Dream-Of-Magic https://github.com/Twilight-Dream-Of-Magic/museair-cpp

License

MuseAir algorithm itself is released into the public domain under the CC0 license.

These codes (implementation) in this repository are released under the MIT or Apache 2.0 dual license, at your option.

About

MuseAir is the new fastest portable hash: immune to blinding multiplication, even faster then wyhash, passed SMHasher3.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published