-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
490b56a
commit 8c287d8
Showing
9 changed files
with
756 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
museair.cpp -linguist-detectable | ||
museair.cpp -linguist-detectable | ||
results/** -linguist-detectable | ||
results/*.log -diff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,66 @@ | ||
# MuseAir | ||
|
||
[![](https://img.shields.io/crates/v/museair)](https://crates.io/crates/museair) | ||
[![](https://img.shields.io/crates/d/museair)](https://crates.io/crates/museair) | ||
[![](https://img.shields.io/crates/l/museair)](#) | ||
[![](https://img.shields.io/docsrs/museair)](https://docs.rs/museair) | ||
[![](https://img.shields.io/github/stars/eternal-io/museair?style=social)](https://github.com/eternal-io/museair) | ||
|
||
This is the new fastest portable hash: immune to blinding multiplication, even faster then wyhash, SMHasher3 passed. | ||
|
||
See [repository](https://github.com/eternal-io/museair) for details. | ||
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](https://github.com/eternal-io/museair) 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 | ||
|
||
``` | ||
```rust | ||
let seed: u64 = 42; | ||
|
||
let one_shot = museair::hash_128("MuseAir hash!".as_bytes(), seed); | ||
let one_shot = museair::hash_128("K--Aethiax".as_bytes(), seed); | ||
let streamed = { | ||
let mut hasher = museair::Hasher::with_seed(seed); | ||
hasher.write("MuseAir".as_bytes()); | ||
hasher.write(" hash!".as_bytes()); | ||
hasher.write("K--Ae".as_bytes()); | ||
hasher.write("thiax".as_bytes()); | ||
hasher.finish_128() | ||
}; | ||
|
||
assert_eq!(one_shot, streamed); | ||
``` | ||
|
||
|
||
## Benchmarks | ||
|
||
| Hash | Digest length | Throughput | | ||
|:----------------- | -------------:| -------------------------------:| | ||
| MuseAir | 64-bit | 29.1 GiB/s <sub>(0.88)</sub> | | ||
| MuseAir-128 | 128-bit | 29.0 GiB/s <sub>(0.88)</sub> | | ||
| MuseAir-BFast | 64-bit |**33.0 GiB/s** <sub>(1.00)</sub> | | ||
| MuseAir-BFast-128 | 128-bit |**33.0 GiB/s** <sub>(1.00)</sub> | | ||
| [WyHash] | 64-bit | 29.0 GiB/s <sub>(0.88)</sub> | | ||
| [WyHash]-condom | 64-bit | 24.3 GiB/s <sub>(0.74)</sub> | | ||
| [KomiHash] | 64-bit | 27.7 GiB/s <sub>(0.84)</sub> | | ||
|
||
(These results are obtained by running `cargo bench` on AMD Ryzen 7 5700G 4.6GHz Desktop.) | ||
## Security | ||
|
||
[WyHash]: https://crates.io/crates/wyhash-final4 | ||
[KomiHash]: https://crates.io/crates/komihash | ||
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: | ||
|
||
## Security | ||
- Persistent file format | ||
- Communication protocol | ||
- ... | ||
|
||
MuseAir is ***NOT*** intended for cryptographic security. | ||
_Until then, it should only be used for local sessions!_ | ||
|
||
- 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. | ||
|
||
## Benchmarks | ||
|
||
## Versioning policy | ||
| 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 | | ||
|
||
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. | ||
<img src="https://github.com/eternal-io/museair/blob/master/results/bench-smallkeys.png?raw=true" alt="Bench small keys" width="100%" /> | ||
|
||
The `-BFast` variant will never be stable, you should only use this on local sessions. | ||
For persistent storage, you should always use the `-Standard` variant (after it is stable). | ||
|
||
[wyhash]: https://crates.io/crates/wyhash-final4 | ||
[komihash]: https://crates.io/crates/komihash |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.