diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2024-06-11 11:10:27 +0200 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2024-06-11 11:10:27 +0200 |
commit | 9e3f489356e93bf3551213585a9033ca36c61510 (patch) | |
tree | 0d9a3c164d9a9cba61c7205506a5cf88413db7d8 | |
parent | 17c110d190eca49cbbb12efd67aee39302456972 (diff) | |
download | kit-9e3f489356e93bf3551213585a9033ca36c61510.zip |
fix bigint base58
-rw-r--r-- | source/kit/bigint.h | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/source/kit/bigint.h b/source/kit/bigint.h index 41d19e6..0347108 100644 --- a/source/kit/bigint.h +++ b/source/kit/bigint.h @@ -513,7 +513,7 @@ static kit_bigint_t kit_bi_from_base32(kit_str_t base32) { return z; } -static u8 KIT_BASE58_DIGITS[] = { +static u8 KIT_BASE58_DIGITS[256] = { ['1'] = 0, ['2'] = 1, ['3'] = 2, ['4'] = 3, ['5'] = 4, ['6'] = 5, ['7'] = 6, ['8'] = 7, ['9'] = 8, ['A'] = 9, ['B'] = 10, ['C'] = 11, ['D'] = 12, ['E'] = 13, ['F'] = 14, @@ -529,12 +529,9 @@ static u8 KIT_BASE58_DIGITS[] = { }; static u8 kit_base58_digit(c8 c) { - assert(c >= '\0' && c < (c8) sizeof KIT_BASE58_DIGITS); assert(c == '1' || KIT_BASE58_DIGITS[(size_t) (u8) c] != 0); - return c >= '\0' && c < (c8) sizeof KIT_BASE58_DIGITS - ? KIT_BASE58_DIGITS[(size_t) (u8) c] - : 0; + return KIT_BASE58_DIGITS[(size_t) (u8) c]; } static kit_bigint_t kit_bi_from_base58(kit_str_t base58) { |