diff options
author | Jack Lloyd <[email protected]> | 2019-02-28 19:25:31 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-02-28 19:25:31 -0500 |
commit | 731f26e10a71d9749c61c71a2d997698bb55ac37 (patch) | |
tree | c8ce8f21b0f1c23df73ada12125752a9c17461d4 /src/lib | |
parent | a9d2cceb52ea93291f37c2a8da4a91bb13a4fbf6 (diff) |
Split CLI utils.cpp into more parts
Add base58 encoding/decoding CLI
Use decrypt_or_random in pk_decrypt
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/codec/base58/base58.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/codec/base58/base58.cpp b/src/lib/codec/base58/base58.cpp index ba974f96a..5aa9441d3 100644 --- a/src/lib/codec/base58/base58.cpp +++ b/src/lib/codec/base58/base58.cpp @@ -27,9 +27,7 @@ uint32_t sha256_d_checksum(const uint8_t input[], size_t input_length) sha256->update(checksum); sha256->final(checksum); - checksum.resize(4); - uint32_t c = load_be<uint32_t>(checksum.data(), 0); - return c; + return load_be<uint32_t>(checksum.data(), 0); } class Character_Table @@ -140,7 +138,12 @@ std::vector<uint8_t> base58_decode(const char input[], size_t input_length) for(size_t i = leading_zeros; i != input_length; ++i) { - size_t idx = base58.code_for(input[i]); + const char c = input[i]; + + if(c == ' ' || c == '\n') + continue; + + const size_t idx = base58.code_for(c); if(idx == 0x80) throw Decoding_Error("Invalid base58"); |