プログラミングのお題スレ Part18
(ID:Vl5MoMXT0のみ表示中)
戻る
383デフォルトの名無しさん [sage]

AAS

NG

>>358 js

const input = "programmingodaisure"

let tmp_str = input;
let tmp_hex = new Uint8Array();

do {
tmp_str += "X";
tmp_hex = [0x00, ...Base58.decode(tmp_str)];
} while (tmp_hex.length < 25)

const prefix_and_data = tmp_hex.slice(0, -4);

const doubleSha256 = sha256.digest(sha256.digest(prefix_and_data))
const checkSum = doubleSha256.slice(0, 4);

const result_hex = new Uint8Array([...prefix_and_data, ...checkSum]);
const result_str = Base58.encode(result_hex);

console.log(result_str);

→ "1programmingodaisureXXXXXXXZHx9sj"

https://chainflyer.bitflyer.jp/Address/1programmingodaisureXXXXXXXZHx9sj

BASE58とSHA256のライブラリ
https://cdn.jsdelivr.net/npm/base-58@0.0.1/Base58.min.js
https://cdn.jsdelivr.net/npm/js-sha256@0.9.0/src/sha256.min.js

2020/08/18(火)01:35:33.42(Vl5MoMXT0.net)


戻る
ver.151005sp