Skip to content

Latest commit

 

History

History
83 lines (58 loc) · 1.92 KB

File metadata and controls

83 lines (58 loc) · 1.92 KB

API: Common Hash Utilities

Status: Shared

Purpose

Shared hashing traits, constants, and helpers used by sketches/frameworks.

Type/Struct

  • SketchHasher
  • DefaultXxHasher
  • MatrixHashMode
  • MatrixHashType (see matrix storage)

Constructors

Not applicable.

Insert/Update

Not applicable.

Query

pub const SEEDLIST: [u64; 20]
pub const CANONICAL_HASH_SEED: usize
pub const BOTTOM_LAYER_FINDER: usize
pub const HYDRA_SEED: usize

fn hash64_seeded(d: usize, key: &DataInput) -> u64
fn hash128_seeded(d: usize, key: &DataInput) -> u128
fn hash_item64_seeded(d: usize, key: &HeapItem) -> u64
fn hash_item128_seeded(d: usize, key: &HeapItem) -> u128
fn hash_mode_for_matrix(rows: usize, cols: usize) -> MatrixHashMode
fn hash_for_matrix(rows: usize, cols: usize, key: &DataInput) -> MatrixHashType
fn hash_for_matrix_seeded(seed_idx: usize, rows: usize, cols: usize, key: &DataInput) -> MatrixHashType
fn hash_for_matrix_seeded_with_mode(seed_idx: usize, mode: MatrixHashMode, rows: usize, key: &DataInput) -> MatrixHashType
fn hash_for_matrix_seeded_with_mode_generic<H: SketchHasher>(
    seed_idx: usize,
    mode: MatrixHashMode,
    rows: usize,
    key: &DataInput,
) -> MatrixHashType
fn hash_for_matrix_generic<H: SketchHasher>(rows: usize, cols: usize, key: &DataInput) -> MatrixHashType
fn hash_for_matrix_seeded_generic<H: SketchHasher>(
    seed_idx: usize,
    rows: usize,
    cols: usize,
    key: &DataInput,
) -> MatrixHashType

Merge

Not applicable.

Serialization

Not applicable.

Examples

use asap_sketchlib::{hash64_seeded, DataInput, CANONICAL_HASH_SEED};

let h = hash64_seeded(CANONICAL_HASH_SEED, &DataInput::U64(42));
assert!(h > 0 || h == 0);

Caveats

  • Matrix hash helper selection depends on row/column shape.

See Also

Status

Canonical shared hash utility layer.