in reply to Re: Binary string to base64
in thread Binary string to base64
Working within Math::BigInt, it is easy to make the integer by prepending the string with '0b'. Then, between Math::Base85 and Math::BigInt, it is easy to go back and forth, though one needs to prepend '0's after the decoding to get back to the original length.
This does exactly what I want now. And I get slightly more efficiency than with base64.use Math::Base85 qw(from_base85 to_base85); $str = '0b000000010010001101000101011001111000100110101011110011011110 +1111'; $bint = Math::BigInt->new($str); $b85str = to_base85($bint); $bint2 = from_base85($b85str); print $bint2->as_bin();
-albert
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Binary string to base64
by zentara (Cardinal) on Jun 16, 2006 at 21:21 UTC |