- var_dump: documentation ( source)
- bin2hex: documentation ( source)
- pack: documentation ( source)
- ord: documentation ( source)
- md5: documentation ( source)
<?php
function insecureMd5Kdf($message, $raw = false)
{
$bytes = md5($message, true);
$output = '';
for ($i = 0; $i < 16; ++$i) {
$int = ord($bytes[$i]) & 127;
$output .= pack('C', $int);
}
if (!$raw) {
return bin2hex($output);
}
return $output;
}
var_dump(insecureMd5Kdf('apple'));