Implement guess key size.

This commit is contained in:
2022-03-26 19:57:45 -04:00
parent 1e84f2cb58
commit f69fea769f
2 changed files with 30 additions and 4 deletions

View File

@@ -35,7 +35,7 @@ impl BytesBase64 {
pub fn to_bytes(&self) -> Bytes {
let BytesBase64(v) = self;
fn chunk_to_bytes(c: &[u8]) -> Vec<u8> {
fn to_bytes(c: &[u8]) -> Vec<u8> {
let mut v = c.to_vec();
// pad with bytes for conversion
while v.len() < 4 {
@@ -52,7 +52,7 @@ impl BytesBase64 {
}
result
}
Bytes(v.chunks(4).map(|c| chunk_to_bytes(c)).flatten().collect())
Bytes(v.chunks(4).map(|c| to_bytes(c)).flatten().collect())
}
pub fn from_base64(s: &str) -> BytesBase64 {