Skip to content

Commit 7446db6

Browse files
committed
chore: Remove aboslete code and use correct hasher
1 parent 8acbd5c commit 7446db6

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

apps/icp_app/icp_context.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
#define ICP_PUB_KEY_SIZE 33
2424
#define ICP_PREFIXED_ACCOUNT_ID_LENGTH 21
2525
#define ICP_ACCOUNT_ADDRESS_LENGTH 34
26-
#define ICP_BASE58_DIGITS_ORDERED \
27-
"rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"
2826

2927
/*****************************************************************************
3028
* TYPEDEFS

apps/icp_app/icp_pub_key.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -425,23 +425,19 @@ void icp_get_pub_keys(icp_query_t *query) {
425425
char address[ICP_ACCOUNT_ADDRESS_LENGTH] = "";
426426

427427
uint8_t public_key_digest[32];
428-
hasher_Raw(HASHER_SHA2_RIPEMD,
429-
pubkey_list[0],
430-
ICP_PUB_KEY_SIZE,
431-
public_key_digest);
428+
hasher_Raw(
429+
HASHER_SHA2, pubkey_list[0], ICP_PUB_KEY_SIZE, public_key_digest);
432430

433431
uint8_t prefixed_account_id[ICP_PREFIXED_ACCOUNT_ID_LENGTH];
434432
prefixed_account_id[0] = 0x00;
435433
memcpy(prefixed_account_id + 1, public_key_digest, 20);
436434

437435
// icp uses different base58 dictionary, that's why a custom function
438-
if (!base58_encode_check_with_custom_digits_order(
439-
prefixed_account_id,
440-
ICP_PREFIXED_ACCOUNT_ID_LENGTH,
441-
HASHER_SHA2D,
442-
address,
443-
ICP_ACCOUNT_ADDRESS_LENGTH + 1,
444-
ICP_BASE58_DIGITS_ORDERED)) {
436+
if (!base58_encode_check(prefixed_account_id,
437+
ICP_PREFIXED_ACCOUNT_ID_LENGTH,
438+
HASHER_SHA2D,
439+
address,
440+
ICP_ACCOUNT_ADDRESS_LENGTH + 1)) {
445441
icp_send_error(ERROR_COMMON_ERROR_UNKNOWN_ERROR_TAG, 2);
446442
return;
447443
}

0 commit comments

Comments
 (0)