Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Fails in simple cases #1

Closed
till-metaco opened this issue Nov 22, 2023 · 2 comments
Closed

Fails in simple cases #1

till-metaco opened this issue Nov 22, 2023 · 2 comments

Comments

@till-metaco
Copy link

sha256 fails already on moderately sized arrays:

fn main() {
    let text_bytes = b"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
    let hash = sha256_rs::sha256(text_bytes);
    println!("Hello, world!, {:02X?}", hash);
}

Results in a panic:
thread 'main' panicked at 'source slice length (256) does not match destination slice length (32)', /<REDACTED>/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sha256-rs-1.0.1/src/lib.rs:112:12

@deadblackclover
Copy link
Member

@till-metaco Yes, the problem was a faulty implementation of the algorithm. Fixed in v1.0.2

@till-metaco
Copy link
Author

thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants