Skip to content

Commit c6a8be4

Browse files
committed
chore: update polkicon hashes
1 parent e91b767 commit c6a8be4

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

library/react-polkicon/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@w3ux/react-polkicon-source",
33
"description": "A light-weight and customisable Polkadot Icon",
4-
"version": "3.2.7",
4+
"version": "3.2.11",
55
"license": "GPL-3.0-only",
66
"type": "module",
77
"keywords": [

library/react-polkicon/src/utils.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
SPDX-License-Identifier: GPL-3.0-only */
33

44
import { blake2AsU8a } from '@w3ux/crypto'
5-
import { encodeAddress } from 'dedot/utils'
5+
import { decodeAddress } from 'dedot/utils'
66
import { PolkiconCenter, SCHEMA } from './consts'
77
import type { Coordinate, Scheme } from './types'
88

@@ -146,11 +146,11 @@ const findScheme = (d: number): Scheme => {
146146
* consistent `Uint8Array` ID derived from the address.
147147
*/
148148
const addressToId = (address: string): Uint8Array => {
149-
// Generate a zero hash from a 32-byte zeroed array.
150-
const zeroHash = blake2AsU8a(new Uint8Array(32))
149+
// Generate a zero hash from a 32-byte zeroed array using 512-bit blake2 hash.
150+
const zeroHash = blake2AsU8a(new Uint8Array(32), 512)
151151

152-
// Get the encoded and decoded representation of the address, then hash it.
153-
const pubKeyHash = blake2AsU8a(encodeAddress(address))
152+
// Get the decoded representation of the address, then hash it with 512-bit blake2.
153+
const pubKeyHash = blake2AsU8a(decodeAddress(address), 512)
154154

155155
// Adjust each byte in the hash relative to zeroHash and return as a Uint8Array.
156156
return pubKeyHash.map((x, i) => (x + 256 - zeroHash[i]) % 256)

0 commit comments

Comments
 (0)