mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-07-24 04:15:42 +00:00
Fix Polkadot identicon blake2 (#103)
* Fix Polkadot identicon blake2 * CHANGELOG
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
# 0.34.1
|
||||||
|
|
||||||
|
- Fix for blake2 in Polkadot identicon generation
|
||||||
|
|
||||||
# 0.33.1
|
# 0.33.1
|
||||||
|
|
||||||
- Rename createUri and createExternal to addExternal and addUri
|
- Rename createUri and createExternal to addExternal and addUri
|
||||||
|
|||||||
@@ -24,8 +24,8 @@
|
|||||||
"react": "*"
|
"react": "*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/keyring": "^0.40.1",
|
"@polkadot/keyring": "^0.42.0-beta.1",
|
||||||
"@polkadot/util-crypto": "^0.40.1",
|
"@polkadot/util-crypto": "^0.42.0-beta.1",
|
||||||
"xmlserializer": "^0.6.1"
|
"xmlserializer": "^0.6.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,11 +31,14 @@ type Scheme = {
|
|||||||
colors: Array<number>
|
colors: Array<number>
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const blake2 = (value: Uint8Array) =>
|
||||||
|
blake2AsU8a(value, 512);
|
||||||
|
|
||||||
const s = 64;
|
const s = 64;
|
||||||
const c = s / 2;
|
const c = s / 2;
|
||||||
const z = s / 64 * 5;
|
const z = s / 64 * 5;
|
||||||
|
|
||||||
const zero = blake2AsU8a(new Uint8Array(32));
|
const zero = blake2(new Uint8Array(32));
|
||||||
const schema: { [index: string]: Scheme } = {
|
const schema: { [index: string]: Scheme } = {
|
||||||
target: { freq: 1, colors: [0, 28, 0, 0, 28, 0, 0, 28, 0, 0, 28, 0, 0, 28, 0, 0, 28, 0, 1] },
|
target: { freq: 1, colors: [0, 28, 0, 0, 28, 0, 0, 28, 0, 0, 28, 0, 0, 28, 0, 0, 28, 0, 1] },
|
||||||
cube: { freq: 20, colors: [0, 1, 3, 2, 4, 3, 0, 1, 3, 2, 4, 3, 0, 1, 3, 2, 4, 3, 5] },
|
cube: { freq: 20, colors: [0, 1, 3, 2, 4, 3, 0, 1, 3, 2, 4, 3, 0, 1, 3, 2, 4, 3, 5] },
|
||||||
@@ -130,7 +133,7 @@ export default class Identicon extends React.PureComponent<Props> {
|
|||||||
private getColors () {
|
private getColors () {
|
||||||
const { value } = this.props;
|
const { value } = this.props;
|
||||||
const total = Object.keys(schema).map(k => schema[k].freq).reduce((a, b) => a + b);
|
const total = Object.keys(schema).map(k => schema[k].freq).reduce((a, b) => a + b);
|
||||||
const id = Array.from(blake2AsU8a(decodeAddress(value))).map((x, i) => (x + 256 - zero[i]) % 256);
|
const id = Array.from(blake2(decodeAddress(value))).map((x, i) => (x + 256 - zero[i]) % 256);
|
||||||
const d = Math.floor((id[30] + id[31] * 256) % total);
|
const d = Math.floor((id[30] + id[31] * 256) % total);
|
||||||
const rot = (id[28] % 6) * 3;
|
const rot = (id[28] % 6) * 3;
|
||||||
const sat = (Math.floor(id[29] * 70 / 256 + 26) % 80) + 30;
|
const sat = (Math.floor(id[29] * 70 / 256 + 26) % 80) + 30;
|
||||||
|
|||||||
@@ -17,9 +17,9 @@
|
|||||||
"styled-components": "^4.1.3"
|
"styled-components": "^4.1.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/keyring": "^0.40.1",
|
"@polkadot/keyring": "^0.42.0-beta.1",
|
||||||
"@polkadot/types": "^0.50.1",
|
"@polkadot/types": "^0.52.0-beta.1",
|
||||||
"@polkadot/util": "^0.40.1"
|
"@polkadot/util": "^0.42.0-beta.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@polkadot/keyring": "*",
|
"@polkadot/keyring": "*",
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.3.4",
|
"@babel/runtime": "^7.3.4",
|
||||||
"@polkadot/util": "^0.40.1",
|
"@polkadot/util": "^0.42.0-beta.1",
|
||||||
"@types/store": "^2.0.1",
|
"@types/store": "^2.0.1",
|
||||||
"store": "^2.0.12"
|
"store": "^2.0.12"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
"@babel/runtime": "^7.3.4"
|
"@babel/runtime": "^7.3.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/types": "^0.50.1"
|
"@polkadot/types": "^0.52.0-beta.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@polkadot/types": "*"
|
"@polkadot/types": "*"
|
||||||
|
|||||||
@@ -1683,14 +1683,14 @@
|
|||||||
typescript "^3.3.4000"
|
typescript "^3.3.4000"
|
||||||
vuepress "^1.0.0-alpha.44"
|
vuepress "^1.0.0-alpha.44"
|
||||||
|
|
||||||
"@polkadot/keyring@^0.40.1":
|
"@polkadot/keyring@^0.42.0-beta.1":
|
||||||
version "0.40.1"
|
version "0.42.0-beta.1"
|
||||||
resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.40.1.tgz#6dd0f1577920b1e4c88a8c7d201cd1b186fc0167"
|
resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.42.0-beta.1.tgz#3620097d48dd53527164d00d7e2374447b094fa5"
|
||||||
integrity sha512-Kz6BQU9RC04XCw5aulQQtpRk3kF0EGT89ANKx5oUAIqyKeg8xGty0odwEP8w2ecrR+23JLNGuxe/1d9tjfNZjA==
|
integrity sha512-tfGCbF3Ey9zcRjnmwfToAmai67F3wsuXsZoCSeHUodhBbbJTUrYKz278F11+W4nslCJ7ZWzpfY1FchfWo74Vkw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.4.0"
|
"@babel/runtime" "^7.4.0"
|
||||||
"@polkadot/util" "^0.40.1"
|
"@polkadot/util" "^0.42.0-beta.1"
|
||||||
"@polkadot/util-crypto" "^0.40.1"
|
"@polkadot/util-crypto" "^0.42.0-beta.1"
|
||||||
"@types/bs58" "^4.0.0"
|
"@types/bs58" "^4.0.0"
|
||||||
bs58 "^4.0.1"
|
bs58 "^4.0.1"
|
||||||
|
|
||||||
@@ -1699,25 +1699,25 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@polkadot/ts/-/ts-0.1.56.tgz#ffd6e9c95704a7fb90b918193b9dc5c440114b27"
|
resolved "https://registry.yarnpkg.com/@polkadot/ts/-/ts-0.1.56.tgz#ffd6e9c95704a7fb90b918193b9dc5c440114b27"
|
||||||
integrity sha512-wnt4zXxZXyz6WaubTO/I+nUElwV2DogFzdl6CrKfVn2PTWp8uHN06W9s40FH57ORtmQfDr9rLRP8Nq+oIyElbg==
|
integrity sha512-wnt4zXxZXyz6WaubTO/I+nUElwV2DogFzdl6CrKfVn2PTWp8uHN06W9s40FH57ORtmQfDr9rLRP8Nq+oIyElbg==
|
||||||
|
|
||||||
"@polkadot/types@^0.50.1":
|
"@polkadot/types@^0.52.0-beta.1":
|
||||||
version "0.50.1"
|
version "0.52.0-beta.1"
|
||||||
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.50.1.tgz#26c3b8bf8c5a2ab3001ec7a25b63709e3e03ee1d"
|
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.52.0-beta.1.tgz#cfefaff3c0cf5da62b971f895e89bd6d2b2b03b4"
|
||||||
integrity sha512-mweg0TnGYA9MPVxyxtDPMkRplbz6KTWz/tye2MJGMSLQwgRXXf3W9PD73dOERD4E23C2bE8BFM2d5KKIQWMMbw==
|
integrity sha512-bXxe4ztsjfAAxC90pEIK0/Dh/qMgcq0P1af6P9vqeMBVfIVSn7X1KLr4JfjWP9L2DiknAGBZj+7TvXSF7khRKA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.4.0"
|
"@babel/runtime" "^7.4.0"
|
||||||
"@polkadot/keyring" "^0.40.1"
|
"@polkadot/keyring" "^0.42.0-beta.1"
|
||||||
"@polkadot/util" "^0.40.1"
|
"@polkadot/util" "^0.42.0-beta.1"
|
||||||
|
|
||||||
"@polkadot/util-crypto@^0.40.1":
|
"@polkadot/util-crypto@^0.42.0-beta.1":
|
||||||
version "0.40.1"
|
version "0.42.0-beta.1"
|
||||||
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.40.1.tgz#58d76bedb3e964c73805229de7b4a81b3c8e7853"
|
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.42.0-beta.1.tgz#10832842db802037592436eb50343e7345df9638"
|
||||||
integrity sha512-/rLBoeTp5ZnGXjyZw423EHyAjV5gw7tBm+3oWggkz2HnCRUqwggIFS/Rej2IaZWojL8tkz7X0i/wSQFyVL+M2g==
|
integrity sha512-uvP64cOaBKSmL/pnpYBfVRakQrwvypVtmj4fKVDgs3P7d38h9Kpg9cCcsYoT9jscx0a912QL1xmNJPKNakYWMQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.4.0"
|
"@babel/runtime" "^7.4.0"
|
||||||
"@polkadot/util" "^0.40.1"
|
"@polkadot/util" "^0.42.0-beta.1"
|
||||||
"@polkadot/wasm-crypto" "^0.3.1"
|
"@polkadot/wasm-crypto" "^0.5.1"
|
||||||
"@polkadot/wasm-dalek-ed25519" "^0.3.1"
|
"@polkadot/wasm-dalek-ed25519" "^0.5.1"
|
||||||
"@polkadot/wasm-schnorrkel" "^0.3.1"
|
"@polkadot/wasm-schnorrkel" "^0.5.1"
|
||||||
"@types/bip39" "^2.4.2"
|
"@types/bip39" "^2.4.2"
|
||||||
"@types/pbkdf2" "^3.0.0"
|
"@types/pbkdf2" "^3.0.0"
|
||||||
"@types/secp256k1" "^3.5.0"
|
"@types/secp256k1" "^3.5.0"
|
||||||
@@ -1730,10 +1730,10 @@
|
|||||||
tweetnacl "^1.0.1"
|
tweetnacl "^1.0.1"
|
||||||
xxhashjs "^0.2.2"
|
xxhashjs "^0.2.2"
|
||||||
|
|
||||||
"@polkadot/util@^0.40.1":
|
"@polkadot/util@^0.42.0-beta.1":
|
||||||
version "0.40.1"
|
version "0.42.0-beta.1"
|
||||||
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.40.1.tgz#4a990d134ea394425e9b1ceb8a7f1fc0868a5a66"
|
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.42.0-beta.1.tgz#93baa0fc129467237b7eb226e14fafffd160f4e9"
|
||||||
integrity sha512-S9owTDNIB7sNFzon4lK/c9A+6O73XcoCPAIYA3TtNg494qA1X8exesenVJgVFzqht/Z3B/RAXLsEa8DSk9BycQ==
|
integrity sha512-PZC/yArV5D4J//IkqYwPo1rmlLzwf1SDWE4COOSDZJfU1hGjrwucDre/jwtQFQjZAUv458BXiFUHxgEd5dHX2w==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.4.0"
|
"@babel/runtime" "^7.4.0"
|
||||||
"@types/bn.js" "^4.11.4"
|
"@types/bn.js" "^4.11.4"
|
||||||
@@ -1745,20 +1745,20 @@
|
|||||||
ip-regex "^4.0.0"
|
ip-regex "^4.0.0"
|
||||||
moment "^2.24.0"
|
moment "^2.24.0"
|
||||||
|
|
||||||
"@polkadot/wasm-crypto@^0.3.1":
|
"@polkadot/wasm-crypto@^0.5.1":
|
||||||
version "0.3.1"
|
version "0.5.1"
|
||||||
resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto/-/wasm-crypto-0.3.1.tgz#d605d18557076f01b00610844ba41bf12298e502"
|
resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto/-/wasm-crypto-0.5.1.tgz#3d5734d6dc2f5174a411689f78538287d21bd710"
|
||||||
integrity sha512-G1QEKC8o6SkKc65xjgMzujoA9rEQpMp/RZCVqrrmevgBhxTSohVsbXsBO3ooNtQLdq0DfFqUH13FatV0RxVdHQ==
|
integrity sha512-8h7uz85bvLVirtbxLkELr9H25oqAfgnQuDP6FP3QJeag7VfMtVvRF5U2JWGgsiUSiRg+UJnTuCleOSDnageRmg==
|
||||||
|
|
||||||
"@polkadot/wasm-dalek-ed25519@^0.3.1":
|
"@polkadot/wasm-dalek-ed25519@^0.5.1":
|
||||||
version "0.3.1"
|
version "0.5.1"
|
||||||
resolved "https://registry.yarnpkg.com/@polkadot/wasm-dalek-ed25519/-/wasm-dalek-ed25519-0.3.1.tgz#52b86a3fabbbdeb60273b51685d089d5be2bfe6a"
|
resolved "https://registry.yarnpkg.com/@polkadot/wasm-dalek-ed25519/-/wasm-dalek-ed25519-0.5.1.tgz#7b59f5381c8e16335d4de31e2e30ac7d7592762f"
|
||||||
integrity sha512-TvFMpE0y2RTCDRcVAer/94bCT4X8qHTU/K5GEhiqHtsLNZ9igJeSn27PRHUF3rzq1YgwCLvG6/wQ+4p+4DWTlQ==
|
integrity sha512-wBz1/tJJHylQ8cfB0J11h8T46m6trAq+tyNzGCaoDNFyb7XDg3wNxpyWNHg1PGrI59sjaDiTfvr3RUiodWgcng==
|
||||||
|
|
||||||
"@polkadot/wasm-schnorrkel@^0.3.1":
|
"@polkadot/wasm-schnorrkel@^0.5.1":
|
||||||
version "0.3.1"
|
version "0.5.1"
|
||||||
resolved "https://registry.yarnpkg.com/@polkadot/wasm-schnorrkel/-/wasm-schnorrkel-0.3.1.tgz#08287848f769dee4955517348905888bd289f277"
|
resolved "https://registry.yarnpkg.com/@polkadot/wasm-schnorrkel/-/wasm-schnorrkel-0.5.1.tgz#9db91db2e262668bdc1b037ef6d010ba2a29bf41"
|
||||||
integrity sha512-2J/lNZe7oDWvzUbsEfvKfiiAvBIBbIsppeBGahwSg2Y+cLweQgThXGizPpQoPo0tHxgMKdTi6jhPu7tLzCW/cA==
|
integrity sha512-uFlYRtMYeuVzW72+I01ToKqbPmn/3gFJzMc2MJcpOgOEPHNrQ1erXkqy0s1BxJYIDaO5SlvAQK/lRQbAWEYUDA==
|
||||||
|
|
||||||
"@types/accepts@*":
|
"@types/accepts@*":
|
||||||
version "1.3.5"
|
version "1.3.5"
|
||||||
|
|||||||
Reference in New Issue
Block a user