Anonymous user
Bitcoin/public point to address: Difference between revisions
→{{header|zkl}}: update
(Use the .polymod method) |
(→{{header|zkl}}: update) |
||
Line 586:
=={{header|zkl}}==
Uses shared library zklMsgHash.
<lang zkl>var [const] MsgHash=Import.lib("zklMsgHash"); // SHA-256, etc
const symbols = "123456789" // 58 characters: no cap i,o; ell, zero
Line 608:
fcn coinEncode(x,y){ // throws if x or y not hex or (x+y) not even length
bytes:=(x+y).pump(Data,Void.Read,fcn(a,b){ (a+b).toInt(16) }).insert(0,4);
.insert(0,COIN_VER); // we are using bytes for in and out
d,chkSum := Data(), MsgHash.SHA256(bytes,1,
base58Encode(bytes.append(chkSum.del(4,*))); // first 4 bytes of hashed hash
}</lang>
<lang zkl>e:=coinEncode(
|