hex_to_eip55
returns 0x...
if the paramhex
is 0x...
This commit is contained in:
parent
16e45503be
commit
8836721791
2
ticc.js
2
ticc.js
@ -1389,9 +1389,9 @@ class TicCrypto {
|
||||
*/
|
||||
static hex_to_eip55 (hex) {
|
||||
if (/^(0x)?[\da-fA-F]+$/.test(hex)) {
|
||||
let result = /^0x/.test(hex) ? '0x' : ''
|
||||
hex = hex.toLowerCase().replace('0x', '')
|
||||
let hash = keccak('keccak256').update(hex).digest('hex')
|
||||
let result = ''
|
||||
for (var i = 0; i < hex.length; i++) {
|
||||
if (parseInt(hash[i], 16) >= 8) {
|
||||
result += hex[i].toUpperCase()
|
||||
|
Loading…
Reference in New Issue
Block a user