GitXplorerGitXplorer
r

rustc-stable-hash

public
5 stars
4 forks
0 issues

Commits

List of commits on branch main.
Unverified
221cfac94096bf81d70af4120af7f49bdb9eea11

Improve continuous integration checks (rustfmt, rustdoc, clippy)

UUrgau committed 6 months ago
Unverified
3805516b78c7b2946ae2071d71ffc8235399652d

Rename `StableHasherResult` to `FromStableHash`

UUrgau committed 6 months ago
Unverified
5185cef1d17921b43d73231e759f9ca774ca2a41

Introduce new-type for the hash of `SipHasher128(Hash)`

UUrgau committed 6 months ago
Unverified
f30cf8e853eed9fb486758e7f85d825f6295cc7b

Properly expose `SipHasher128` and `StableSipHasher128`

UUrgau committed 6 months ago
Unverified
916f7549389669f647f801e13940e2c8d8721bf3

Support multiple hasher implementation

UUrgau committed 7 months ago
Unverified
8a310f21ba04529e50f869a6ba7eb4151437bbfe

Document `SipHasher128::finish_inner` safety

UUrgau committed 6 months ago

README

The README file for this repository.

rustc-stable-hash

crates.io Documentation

A stable hashing algorithm used by rustc: cross-platform, deterministic, not secure.

This crate provides facilities with the StableHasher structure to create stable hashers over unstable hashers by abstracting over them the handling of endian-ness and the target usize/isize bit size difference.

Currently, this crate provides it's own implementation of 128-bit SipHasher: SipHasher128; with StableSipHasher128 for the stable variant.

Usage

use rustc_stable_hash::hashers::{StableSipHasher128, SipHasher128Hash};
use rustc_stable_hash::FromStableHash;
use std::hash::Hasher;

struct Hash128([u64; 2]);
impl FromStableHash for Hash128 {
    type Hash = SipHasher128Hash;

    fn from(SipHasher128Hash(hash): SipHasher128Hash) -> Hash128 {
        Hash128(hash)
    }
}

let mut hasher = StableSipHasher128::new();
hasher.write_usize(0xFA);

let hash: Hash128 = hasher.finish();