ferrilab / bitvec

A crate for managing memory bit by bit
https://myrrlyn.net/crates/bitvec
MIT License
1.19k stars 112 forks source link

Feature request: Add Zeroize trait implementation for bit structs #172

Open rillian opened 2 years ago

rillian commented 2 years ago

BitVec is very convenient for protocol data and processing bit-oriented encodings. For cryptographic applications it would be nice if it implemented the Zeroize trait for clearing key material from memory after use. As far as I can tell, this is something that can only be effectively implemented by this crate directly, since it needs to understand the memory layout and allocation pattern.

Similar to #168.

AustinHellerRepo commented 1 year ago

The ability to reset the existing BitVec with true or false values would be convenient. For now I'm just looping over every index myself, setting the value accordingly during my reset step. It would be best of that could be accomplished by the crate for optimal performance.