MCPcopy Create free account
hub / github.com/bcndev/bytecoin / encode_block

Function encode_block

src/common/Base58.cpp:91–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89decoded_block_sizes decoded_block_sizes::instance;*/
90
91void encode_block(const uint8_t *block, size_t size, char *res) {
92 invariant(size >= 1 && size <= full_block_size, "");
93
94 auto num = uint_be_from_bytes<uint64_t>(block, size);
95 for (size_t i = encoded_block_sizes[size]; i-- > 0;) {
96 uint64_t remainder = num % alphabet_size;
97 num /= alphabet_size;
98 res[i] = alphabet[remainder];
99 }
100}
101
102bool decode_block_legacy(const char *block, size_t size, uint8_t *res) {
103 invariant(size <= full_encoded_block_size, "");

Callers 1

encodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected