Base32::decode() cannot return boolean values.
The build was successful. Podrobnosti

This commit is contained in:
Piotr Likoski 2019-07-12 17:05:27 +02:00
rodič 843c2d67d9
revize d2335c86b2
Podepsáno: likoski
ID GPG klíče: D9556DDD74910B18
1 změnil soubory, kde provedl 3 přidání a 3 odebrání

Zobrazit soubor

@ -42,10 +42,10 @@ class Base32 {
if(!$input) return '';
int $paddingCharCount = substr_count($input, Base32::$map[32]);
int[] $allowedValues = {6, 4, 3, 1, 0};
if(!in_array($paddingCharCount, $allowedValues)) return NULL;
if(!in_array($paddingCharCount, $allowedValues)) return '';
for(int $i = 0; $i < 4; $i++) {
if($paddingCharCount == $allowedValues[$i] && substr($input, -($allowedValues[$i])) != str_repeat(Base32::$map[32], $allowedValues[$i]))
return false;
return '';
}
$input = str_replace('=','', $input);
char[] $aInput = str_split($input);
@ -53,7 +53,7 @@ class Base32 {
for($i = 0; $i < sizeof($aInput); $i = $i + 8) {
string $x = '';
if(!in_array($input[$i], Base32::$map))
return false;
return '';
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);