mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 22:38:08 +00:00
cashaddr: fix whitespace
This commit is contained in:
parent
28d1225276
commit
1a7483d43d
12
cash_addr.c
12
cash_addr.c
@ -62,13 +62,13 @@ int cash_encode(char *output, const char *hrp, const uint8_t *data, size_t data_
|
|||||||
if (ch < 33 || ch > 126) {
|
if (ch < 33 || ch > 126) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*(output++) = ch;
|
*(output++) = ch;
|
||||||
chk = cashaddr_polymod_step(chk) ^ (ch & 0x1f);
|
chk = cashaddr_polymod_step(chk) ^ (ch & 0x1f);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
if (i + 1 + data_len + CHECKSUM_SIZE > MAX_CASHADDR_SIZE) {
|
if (i + 1 + data_len + CHECKSUM_SIZE > MAX_CASHADDR_SIZE) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
chk = cashaddr_polymod_step(chk);
|
chk = cashaddr_polymod_step(chk);
|
||||||
*(output++) = ':';
|
*(output++) = ':';
|
||||||
for (i = 0; i < data_len; ++i) {
|
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);
|
hrp_len = input_len - (1 + *data_len);
|
||||||
if (hrp_len < 1 || hrp_len > MAX_HRP_SIZE ||
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
// subtract checksum
|
// subtract checksum
|
||||||
*(data_len) -= CHECKSUM_SIZE;
|
*(data_len) -= CHECKSUM_SIZE;
|
||||||
for (i = 0; i < hrp_len; ++i) {
|
for (i = 0; i < hrp_len; ++i) {
|
||||||
int ch = input[i];
|
int ch = input[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user