1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { base16, base58 } from "npm:@scure/base";
const input = bytes(`
06 9b 88 57 fe ab 81 84 fb 68 7f 63 46 18 c0 35
da c4 39 dc 1a eb 3b 55 98 a0 f0 00 00 00 00 01
`);
function publicKey(data: Uint8Array) {
return base58.encode(data);
}
console.log(publicKey(input));
function bytes(str: string): Uint8Array {
return base16.decode(str.replaceAll(/\s/g, "").toUpperCase());
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
July 1, 2024