orion-rs / orion

Usable, easy and safe pure-Rust crypto
MIT License
538 stars 29 forks source link

`Digest` to `&[u8]` #355

Closed Fraccaman closed 9 months ago

Fraccaman commented 10 months ago

Probably I'm overseeing this, but is there a way to get a &[u8] from a Digest ?

brycx commented 9 months ago

All Digests should implement AsRef<[u8]>, so you should be able to get &[u8] through there: digest.as_ref().

If that doesn't work then either it's a bug, or you're on an earlier version were some Digests could represent MACs, so there it'd be exposed through digest.unprotected_as_bytes().

brycx commented 9 months ago

I'll close this for now. Feel free to re-open if there's any issue with this.