hex2bin unknown method
Hi, I cannot run 'example_usage.php' Fatal error: Call to undefined method AESCryptFileLib::hex2bin() in .... /AESCryptFileLib.php on line 573
I'm running PHP v. 5.6.7
Use this changes: https://github.com/philios33/PHP-AES-File-Encryption/pull/2
Hi,
I modified the function as follows:
// hex2bin wasn't introduced until PHP 5.4.0. If not present, use an alternative
// written by chaos79: http://php.net/manual/fr/function.bin2hex.php#86123
public static function hex2bin($string) {
if (function_exists('hex2bin')) {
return hex2bin($string);
} else {
$sbin = "";
$len = strlen( $string );
for ( $i = 0; $i < $len; $i += 2 ) {
$sbin .= chr( hexdec( $string{$i}.$string{( $i+1 )} ) );
}
return $sbin;
}
}
Now it's work fine.