Got a small issue. I want to convert a base64 string to Base10. However the "baseconvert()" does not cover b64 to b10 or vice versa(In the dictionary). Is there a solution other then writing a function to do it?
I have done a quick web search and found some php versions. If there is not solution maybe someone could help convert them to livecode for all to use?
Thanks all
Code: Select all
$rep = array('0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','-','_');
$new = "";
while ($num>0) {
$r = $num % 64;
$new .= $rep[$r];
$num = floor($num/64);
}
function lengthen($id) {
$alphabet='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-';
$number=0;
foreach(str_split($id) as $letter) {
$number=($number*64) + strpos($alphabet,$letter);
}
return $number;
}