Skip to content

Commit

Permalink
v0.3 is ready.
Browse files Browse the repository at this point in the history
  • Loading branch information
eternal-io committed Dec 20, 2024
1 parent 490b56a commit 8c287d8
Show file tree
Hide file tree
Showing 9 changed files with 756 additions and 284 deletions.
4 changes: 3 additions & 1 deletion .gitattributes
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
64 changes: 34 additions & 30 deletions CRATES.IO-README.md
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
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 11 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "museair"
version = "0.3.0-rc6"
version = "0.3.0"
edition = "2021"
authors = ["K--Aethiax"]
publish = true

description = "Blazingly™ fast portable hash function designed by K--Aethiax."
description = "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."

documentation = "https://docs.rs/museair"
repository = "https://github.com/eternal-io/museair"
Expand All @@ -15,17 +15,21 @@ readme = "CRATES.IO-README.md"
keywords = ["hash", "hasher", "museair"]
categories = ["algorithms", "no-std"]

exclude = ["smhasher*", "results/*", "*.cpp", "*.md", "!CRATES.IO-README.md"]


# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
exclude = [
"smhasher*",
"results/*",
"*.png",
"*.cpp",
"*.md",
"!CRATES.IO-README.md",
]


[dev-dependencies]
hashverify = "0.1.0"
criterion = "0.5.1"
komihash = "0.4.1"
wyhash-final4 = "0.2.1"
wyhash-final4 = "0.2.2"
wyhash = "0.5.0"


Expand Down
Loading

0 comments on commit 8c287d8

Please sign in to comment.