Slide 31
Slide 31 text
1)1ΧϯϑΝϨϯεԬ ϦδΣΫτίϯ
mcrypt対応
●Blowfish(CBCモード)
○暗号化
↓
$resource = mcrypt_module_open(MCRYPT_BLOWFISH, '', MCRYPT_MODE_CBC, '');
mcrypt_generic_init($resource, $key, $iv);
$encrypted = mcrypt_generic($resource, $content);
mcrypt_generic_deinit($resource);
mcrypt_module_close($resource);
$l = strlen($key);
if ($l < 16) {
$key = str_repeat($key, ceil(16 / $l));
}
if ($m = strlen($content) % 8) {
$content .= str_repeat("¥x00", 8 - $m);
}
$encrypted = openssl_encrypt($content, 'bf-cbc', $key, OPENSSL_RAW_DATA | OPENSSL_NO_PADDING, $iv);
$encrypted = base64_encode($encrypted);
⼿動で0x00パディング
OPENSSL_ZERO_PADDING
ではダメ