Fix a logic problem in base58 (isn't a real bug)

This commit is contained in:
Elichai Turkel 2020-01-21 13:36:53 +02:00
parent 1d01262d5c
commit abc70781e7
No known key found for this signature in database
GPG Key ID: 9383CDE9E8E66A7F
1 changed files with 1 additions and 1 deletions

View File

@ -131,7 +131,7 @@ pub fn from(data: &str) -> Result<Vec<u8>, Error> {
// Build in base 256 // Build in base 256
for d58 in data.bytes() { for d58 in data.bytes() {
// Compute "X = X * 58 + next_digit" in base 256 // Compute "X = X * 58 + next_digit" in base 256
if d58 as usize > BASE58_DIGITS.len() { if d58 as usize >= BASE58_DIGITS.len() {
return Err(Error::BadByte(d58)); return Err(Error::BadByte(d58));
} }
let mut carry = match BASE58_DIGITS[d58 as usize] { let mut carry = match BASE58_DIGITS[d58 as usize] {