Base58Check encoding: Difference between revisions

added haskell
(→‎{{header|Perl 6}}: Added Perl 6 solution)
(added haskell)
Line 8:
 
The ''reference algorithm'' is at [https://en.bitcoin.it/wiki/Base58Check_encoding#Base58_symbol_chart the Bitcoin's Base58Check page].
 
=={{header|Haskell}}==
<lang haskell>import Numeric (showIntAtBase)
 
chars = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
 
base58Encode :: Integer -> String
base58Encode n = showIntAtBase 58 (chars !!) n ""
 
main :: IO ()
main = mapM_ (putStrLn . base58Encode)
[25420294593250030202636073700053352635053786165627414518,
0x61,
0x626262,
0x636363,
0x73696d706c792061206c6f6e6720737472696e67,
0x516b6fcd0f,
0xbf4f89001e670274dd,
0x572e4794,
0xecac89cad93923c02321,
0x10c8511e]</lang>
{{out}}
<pre>
6UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM
2g
a3gV
aPEr
2cFupjhnEsSn59qHXstmK2ffpLv2
ABnLTmg
3SEo3LWLoPntC
3EFU7m
EJDM8drfXA6uyA
Rt5zm
</pre>
 
=={{header|Perl 6}}==
Anonymous user