GitXplorerGitXplorer
r

rustc-stable-hash

public
5 stars
4 forks
0 issues

Commits

List of commits on branch main.
Unverified
24e9848c89917abca155c8f854118e6d00ad4a30

chore: bump to 0.1.1

wweihanglo committed a month ago
Unverified
6780c967c1b9b0f5b49c9cc24d1b97ed584ec3ae

feat: derive `Clone` for `StableHasher`

wweihanglo committed a month ago
Unverified
cc85b7a5940308df8329d3812bc27dc0a2fd3a50

Create v0.1.0 release in CHANGELOG

UUrgau committed 6 months ago
Unverified
923cd0e6d3b642042941104b54887703fe254911

Fix CHANGELOG.md links to pull-requests

UUrgau committed 6 months ago
Unverified
9e8274d71c21517cc45cdb9780b8d2593d191cc2

Improve README with usage section and more descriptive section

UUrgau committed 6 months ago
Unverified
2490f484d4a5f92d2c9f9a3614b2fe4704819120

Deny unreachable `pub`s

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();