Comments (3)
Output size is associated type in the Digest
trait, so you can write generic functions over it like this:
extern crate digest;
extern crate generic_array;
use digest::Digest;
use generic_array::GenericArray;
use generic_array::typenum::U512;
pub fn digest512<D>(data: &[u8]) -> GenericArray<u8, U512>
where D: Digest<OutputSize=U512> + Default {
let mut state = D::default();
state.input(data);
state.result()
}
from hashes.
Oh, awesome! Thanks for explaining this.
from hashes.
Slowfix: of course you need to use U64
, not U512
. Output and block sizes are given as bytes, not bits.
from hashes.
Related Issues (20)
- NIST Test vectors FIPS 202 output mismatch HOT 2
- warning: `cpufeatures v0.2.2` is yanked for newest sha2 = "0.10.6" HOT 2
- sha3: Incorrect type alias for Xof readers? HOT 2
- reuse the hasher after finalized? HOT 5
- std::io::Write is not implemented for DynDigest HOT 2
- [Q&A] Is the SHA1 implementation 'hardened'? HOT 2
- Blake2 method `KeyInit::new` is incorrect and not tested HOT 2
- sha-1 vs sha1 HOT 8
- docs for hasher states could use a reference to the `Digest` trait HOT 1
- sha2: Illegal instruction in windows server 2019 HOT 9
- DynDigest not stringable: The trait `LowerHex` is not implemented for `Box<[u8]>` HOT 2
- Cannot build on x86_64-unknown-uefi target HOT 10
- Hash functions not working on bare metal HOT 6
- The speed of calculating in rust seems like not as fast as in Node. HOT 2
- ring affected by CVE-2022-37454? HOT 3
- Upgrade issues from sha-1 0.9.8 to sha1 0.10.x HOT 2
- [Feature Request] SHA-3 KMAC HOT 1
- Performance issue on SHA3-Keccak256 since v0.10.7 HOT 12
- comparing after dereferencing or unsafely indexing, which is faster? HOT 1
- Blake2 parameters cannot be used without a key HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hashes.