Nullus157 / bs58-rs

Another Rust Base58 codec implementation
Apache License 2.0
76 stars 24 forks source link

Doesn't decode 32 bytes of 0x00 #25

Closed ilblackdragon closed 5 years ago

ilblackdragon commented 5 years ago

Due to line let mut output = vec![0; (self.input.as_ref().len() / 8 + 1) * 6]; in into_vec it only allocates 30 bytes (encoding is 11111111111111111111111111111111 which has length of 32).

Simple unit test:

let data = vec![0; 32];
let s = b58::encode(&data).to_string();
let result = b58::decode(&s).into_vec().unwrap(); // crash
assert_eq!(result, data);