Base58Check encoding: Difference between revisions

Added Seed7 example
(Added Seed7 example)
Line 1,084:
EJDM8drfXA6uyA
Rt5zm
</pre>
 
=={{header|Seed7}}==
The Seed7 library [http://seed7.sourceforge.net/libraries/encoding.htm encoding.s7i] defines
the function [http://seed7.sourceforge.net/libraries/encoding.htm#toBase(in_bigInteger,in_string) toBase],
which encodes a number with a positional numeric system. No external library is needed.
 
<lang seed7>$ include "seed7_05.s7i";
include "encoding.s7i";
 
const proc: main is func
local
const bigInteger: s is 25420294593250030202636073700053352635053786165627414518_;
const array bigInteger: hash_arr is [] (16#61_, 16#626262_, 16#636363_, 16#73696d706c792061206c6f6e6720737472696e67_,
16#516b6fcd0f_, 16#bf4f89001e670274dd_, 16#572e4794_, 16#ecac89cad93923c02321_, 16#10c8511e_);
var string: b is "";
var bigInteger: num is 0_;
begin
b := toBase(s, defaultBase58Digits);
writeln(s rpad 56 <& " -> " <& b);
for num range hash_arr do
b := toBase(num, defaultBase58Digits);
writeln("16#" <& num radix 16 rpad 53 <& " -> " <& b);
end for;
end func;</lang>
 
{{out}}
<pre>
25420294593250030202636073700053352635053786165627414518 -> 6UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM
16#61 -> 2g
16#626262 -> a3gV
16#636363 -> aPEr
16#73696d706c792061206c6f6e6720737472696e67 -> 2cFupjhnEsSn59qHXstmK2ffpLv2
16#516b6fcd0f -> ABnLTmg
16#bf4f89001e670274dd -> 3SEo3LWLoPntC
16#572e4794 -> 3EFU7m
16#ecac89cad93923c02321 -> EJDM8drfXA6uyA
16#10c8511e -> Rt5zm
</pre>