update base58

This commit is contained in:
Zhi Guan
2017-05-20 09:04:31 +08:00
parent db15929896
commit cb44612ccd
7 changed files with 60 additions and 3 deletions

View File

@@ -58,7 +58,7 @@
#include <stdint.h>
#include <string.h>
#include <sys/types.h>
#include <openssl/err.h>
#include <openssl/base58.h>
static const int8_t b58digits_map[] = {
@@ -97,9 +97,11 @@ bool base58_decode(const char *b58, size_t b58sz, void *bin, size_t *binszp)
for ( ; i < b58sz; ++i)
{
if (b58u[i] & 0x80)
if (b58u[i] & 0x80) {
// High-bit set on invalid digit
BASE58err(BASE58_F_BASE58_DECODE, BASE58_R_HIGHBIT_SET_ON_INVALID_DIGIT);
return false;
}
if (b58digits_map[b58u[i]] == -1)
// Invalid base58 digit
return false;