1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 19:18:56 +00:00

cashaddr: fix whitespace

This commit is contained in:
Pavol Rusnak 2018-05-22 16:55:22 +02:00
parent 28d1225276
commit 1a7483d43d
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -62,13 +62,13 @@ int cash_encode(char *output, const char *hrp, const uint8_t *data, size_t data_
if (ch < 33 || ch > 126) {
return 0;
}
*(output++) = ch;
*(output++) = ch;
chk = cashaddr_polymod_step(chk) ^ (ch & 0x1f);
++i;
}
if (i + 1 + data_len + CHECKSUM_SIZE > MAX_CASHADDR_SIZE) {
return 0;
}
if (i + 1 + data_len + CHECKSUM_SIZE > MAX_CASHADDR_SIZE) {
return 0;
}
chk = cashaddr_polymod_step(chk);
*(output++) = ':';
for (i = 0; i < data_len; ++i) {
@ -102,10 +102,10 @@ int cash_decode(char* hrp, uint8_t *data, size_t *data_len, const char *input) {
}
hrp_len = input_len - (1 + *data_len);
if (hrp_len < 1 || hrp_len > MAX_HRP_SIZE ||
*data_len < CHECKSUM_SIZE || *data_len > CHECKSUM_SIZE + MAX_BASE32_SIZE) {
*data_len < CHECKSUM_SIZE || *data_len > CHECKSUM_SIZE + MAX_BASE32_SIZE) {
return 0;
}
// subtract checksum
// subtract checksum
*(data_len) -= CHECKSUM_SIZE;
for (i = 0; i < hrp_len; ++i) {
int ch = input[i];