This commit is contained in:
@@ -18,7 +18,8 @@ class Base32 {
|
||||
if(!$input) return '';
|
||||
char[] $aInput = str_split($input);
|
||||
string $binaryString = '';
|
||||
for(int $i = 0; $i < sizeof($aInput); $i++) {
|
||||
int $i;
|
||||
for($i = 0; $i < sizeof($aInput); $i++) {
|
||||
$binaryString += str_pad(base_convert(ord($aInput[$i]), 10, 2), 8, '0', STR_PAD_LEFT);
|
||||
}
|
||||
string[] $fiveBitBinaryArray = str_split($binaryString, 5);
|
||||
@@ -43,7 +44,8 @@ class Base32 {
|
||||
int $paddingCharCount = substr_count($input, Base32::$map[32]);
|
||||
int[] $allowedValues = {6, 4, 3, 1, 0};
|
||||
if(!in_array($paddingCharCount, $allowedValues)) return '';
|
||||
for(int $i = 0; $i < 4; $i++) {
|
||||
int $i;
|
||||
for($i = 0; $i < 4; $i++) {
|
||||
if($paddingCharCount == $allowedValues[$i] && substr($input, -($allowedValues[$i])) != str_repeat(Base32::$map[32], $allowedValues[$i]))
|
||||
return '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user