anyhash

Crates.ioanyhash
lib.rsanyhash
version
sourcesrc
created_at2024-01-14 13:58:47.925071
updated_at2024-11-12 01:43:57.70868
descriptionTraits and utilities for making hashes of any type
homepage
repositoryhttps://github.com/maia-s/anyhash
max_upload_size
id1099446
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Maia (maia-s)

documentation

https://docs.rs/anyhash

README

Traits and utilities for making hashes of any type

This crate provides the [Hash], [Hasher] and [BuildHasher] traits, which are almost exactly like their counterparts in core/std, except that [Hasher] and [BuildHasher] are generic over the type of the hash, and [Hash] can be used with any type of hash. A derive macro for [Hash] is available.

The [Hash] trait uses the [HasherWrite] trait for hashing, which has all the write methods you're familiar with from Hasher in core except for the finish method, because [Hash] doesn't know the type of the hash.

Hashing algorithms implement the [Hasher] and [HasherWrite] traits. [Hasher] is generic over the type of the hash and only contains the finish method. It depends on [HasherWrite], so you can use it just like Hasher from core.

This crate also provides tools for working with endian independent hashes, and a few hasher implementations.

Features

The crate is no_std and doesn't enable any features by default. The following features are available:

  • alloc: Enable trait implementations for the standard alloc crate.
  • std: Enable trait implementations for the standard std crate. Implies alloc.

Optional integrations:

  • bnum: Implement [Hash] for the bnum crate's types, and add support for using them as the hash type for the built-in hashers that can use them.

Built-in hashers:

  • fnv: Hashers using the Fnv1 and Fnv1a algorithms.
  • spooky: Hashers using the SpookyHash algorithm. V1 and V2 are available.
  • xxh64: Hasher using the Xxh64 algorithm.
Commit count: 112

cargo fmt