Implement guess key size.
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user