Properly implement tests.
All checks were successful
The build was successful.

This commit is contained in:
2019-07-01 20:07:06 +02:00
parent 376b9510a9
commit c94de60c29
4 changed files with 11 additions and 9 deletions

View File

@@ -54,14 +54,16 @@ class Base32 {
string $x = '';
if(!in_array($input[$i], Base32::$map))
return false;
for(int $j = 0; $j < 8; $j++) {
for(int $j = 0; $j < 8; $j++) {
if(array_key_exists($input[$i + $j], Base32::$flippedMap)) {
$x += str_pad(base_convert(Base32::$flippedMap[$input[$i + $j]], 10, 2), 5, '0', STR_PAD_LEFT);
}
string[] $eightBits = str_split($x, 8);
for(int $z = 0; $z < sizeof($eightBits); $z++) {
char $y;
$binaryString += (($y = chr(base_convert($eightBits[$z], 2, 10))) || ord($y) == 48) ? $y : '';
}
}
string[] $eightBits = str_split($x, 8);
for(int $z = 0; $z < sizeof($eightBits); $z++) {
char $y;
$binaryString += (($y = chr(base_convert($eightBits[$z], 2, 10))) || ord($y) == 48) ? $y : '';
}
}
return $binaryString;
}