UNPKG
parsec-node
Version:
latest (2.2.2)
2.2.2
2.2.1
2.2.0
2.1.3
2.1.2
2.1.1
2.1.0
2.0.3
2.0.2
2.0.1
2.0.0
1.6.10
1.6.9
1.6.8
1.6.7
1.6.6
1.6.5
1.6.4
1.6.3
1.6.2
1.6.1
1.6.0
1.5.2
1.5.1
1.5.0
1.4.0
1.3.2
1.3.1
1.3.0
1.2.0
1.2.0-0
1.1.7
1.1.6
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.1
1.0.0
https://parseclabs.readthedocs.io/en/latest/
parsec-node
/
src
/
utils
/
getAddress.js
10 lines
(8 loc)
•
304 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
const
utils
=
require
(
'ethereumjs-util'
); module.exports =
function
getAddress
(
pubkey
)
{
const
bytes
= pubkey.
startsWith
(
'0x'
) ? Buffer.
from
(pubkey.
replace
(
'0x'
,
''
),
'hex'
) : Buffer.
from
(pubkey,
'base64'
);
const
hash
= utils.
sha256
(bytes).
slice
(
0
,
20
);
return
hash.
toString
(
'base64'
); };