You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In BaseEncoderDecoder::createArbitraryInteger(), I state in the description:
Create an ArbitraryInteger from a number string in novel number bases and alphabets
It looks like I may have oversold this function a little. Sure, it can create from novel alphabets, but those alphabets have to be an alphabet of successive ASCII characters. A number in RFC3548_BASE64_FILE_SAFE format can be output using the functions, but not created because the alphabet is discontinuous in its ASCII mapping. We (I) need to add a function something like this:
publicfunctionArbitraryIntegerFromAlphabet(string$number, string$alphabet): ArbitraryInteger
{
// Check if $number contains any characters that are not in $alphabet// Check if $alphabet has any duplicated characters// Check that $alphabet is not greater than 256 characters (if so, the check above would be violated, maybe not if unicode?)// Check that $alphabet is ASCII, $number too?$flipped_alphabet = \array_filp($alphabet);
$chars = str_split($number);
$zero_offset = '';
foreach ($charsas$char) {
$zero_offset .= \chr($flipped_alphabet[$char]);
}
returnself::createArbitraryInteger($zero_offset, count($alphabet), \chr(0));
}
With this, a base two number where the characters are 't' and 'f' can be created as
All 'f' characters are converted to \chr(0) and all 't' characters to \chr(1). Then the createArbitrayInteger function can create the object. The integer representation of a Bitcoin address can be made using:
In BaseEncoderDecoder::createArbitraryInteger(), I state in the description:
It looks like I may have oversold this function a little. Sure, it can create from novel alphabets, but those alphabets have to be an alphabet of successive ASCII characters. A number in RFC3548_BASE64_FILE_SAFE format can be output using the functions, but not created because the alphabet is discontinuous in its ASCII mapping. We (I) need to add a function something like this:
With this, a base two number where the characters are 't' and 'f' can be created as
All 'f' characters are converted to
\chr(0)
and all 't' characters to\chr(1)
. Then the createArbitrayInteger function can create the object. The integer representation of a Bitcoin address can be made using:The text was updated successfully, but these errors were encountered: