From 9e3f489356e93bf3551213585a9033ca36c61510 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Tue, 11 Jun 2024 11:10:27 +0200 Subject: fix bigint base58 --- source/kit/bigint.h | 7 ++----- 1 file 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) { -- cgit v1.2.3