#hash

hash-algorithms

Hash, generally translated as hash, hash, or transliterated as hash, is to transform any length of input (also known as pre image) into fixed length output through hash algorithm, and the output is the hash value. This transformation is a kind of compression mapping, that is, the space of hash value is usually much smaller than the space of input, different inputs may hash into the same output, so it is impossible to determine the unique input value from hash value. In short, it is a function that compresses messages of any length to a message digest of a fixed length.

1 unstable release

0.1.0 Jun 12, 2021

#581 in #hash

Download history 416/week @ 2024-07-22 317/week @ 2024-07-29 361/week @ 2024-08-05 296/week @ 2024-08-12 86/week @ 2024-08-19 81/week @ 2024-08-26 41/week @ 2024-09-02 21/week @ 2024-09-09 4/week @ 2024-09-16 61/week @ 2024-09-23 14/week @ 2024-09-30 20/week @ 2024-10-07 30/week @ 2024-10-14 25/week @ 2024-10-21 30/week @ 2024-10-28 23/week @ 2024-11-04

108 downloads per month

MIT license

10KB
203 lines

hash-algorithms

Description

Hash, generally translated as hash, hash, or transliterated as hash, is to transform any length of input (also known as pre image) into fixed length output through hash algorithm, and the output is the hash value. This transformation is a kind of compression mapping, that is, the space of hash value is usually much smaller than the space of input, different inputs may hash into the same output, so it is impossible to determine the unique input value from hash value. In short, it is a function that compresses messages of any length to a message digest of a fixed length.

How To Use

fn main() {
    let hello = "hello";
    println!("additive_hash {}", additive_hash(hello, 131));
    println!("rotating_hash {}", rotating_hash(hello, 131));
    println!("one_by_one_hash {}", one_by_one_hash(hello));
    println!("bernstein {}", bernstein(hello));
    println!("int_hash {}", int_hash(73));
    // println!("{}", rs_hash(hello));
    println!("js_hash {}", js_hash(hello));
    println!("pjw_hash {}", pjw_hash(hello));
    println!("elf_hash {}", elf_hash(hello));
    println!("sdbm_hash {}", sdbm_hash(hello));
    println!("djb_hash {}", djb_hash(hello));
    println!("djb_hash {}", dek_hash(hello));
    println!("ap_hash: {}", ap_hash(hello));
    println!("java_hash {}", java_hash(hello));
}

License

This library is licensed under MIT license. See LICENSE for details.

No runtime deps