Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • seahash seahash
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3
    • Issues 3
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • redox-osredox-os
  • seahashseahash
  • Issues
  • #5
Closed
Open
Issue created Feb 04, 2020 by shribe@shribe

is chunking really fixed?

I was under the impression that with the changes in 4.0, the following should work:

#[test]
fn hash_chunking() {
    let c1: &[u8] = b"This hashing algorithm was extracted from the Rustc compiler.";
    let c2: &[u8] = b" This is the same hashing algoirthm used for some internal operations in FireFox.";
    let c3: &[u8] = b" The strength of this algorithm is in hashing 8 bytes at a time on 64-bit platforms, where the FNV algorithm works on one byte at a time.";

    let mut h1 = H::with_seeds(HASH_SEED_1, HASH_SEED_2, HASH_SEED_3, HASH_SEED_4);
    h1.write(c1);
    h1.write(c2);
    h1.write(c3);
    let hash1 = h1.finish();

    let mut c4 = Vec::<u8>::new();
    c4.extend_from_slice(c1);
    c4.extend_from_slice(c2);
    c4.extend_from_slice(c3);

    let mut h2 = H::with_seeds(HASH_SEED_1, HASH_SEED_2, HASH_SEED_3, HASH_SEED_4);
    h2.write(&c4);
    let hash2 = h2.finish();

    println!("hash1: {}, hash2: {}", hash1, hash2);

    assert!(hash1 == hash2);
}

But it fails on that last line. Is chunking still broken?

Assignee
Assign to
Time tracking