本文整理汇总了PHP中Crypt_Rijndael::disablePadding方法的典型用法代码示例。如果您正苦于以下问题:PHP Crypt_Rijndael::disablePadding方法的具体用法?PHP Crypt_Rijndael::disablePadding怎么用?PHP Crypt_Rijndael::disablePadding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Crypt_Rijndael
的用法示例。
在下文中一共展示了Crypt_Rijndael::disablePadding方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testKeyPaddingRijndael
/**
* @group github451
*/
public function testKeyPaddingRijndael()
{
// this test case is from the following URL:
// https://web.archive.org/web/20070209120224/http://fp.gladman.plus.com/cryptography_technology/rijndael/aesdvec.zip
$aes = new Crypt_Rijndael();
$aes->disablePadding();
$aes->setKey(pack('H*', '2b7e151628aed2a6abf7158809cf4f3c762e7160'));
// 160-bit key. Valid in Rijndael.
$ciphertext = $aes->encrypt(pack('H*', '3243f6a8885a308d313198a2e0370734'));
$this->assertEquals($ciphertext, pack('H*', '231d844639b31b412211cfe93712b880'));
}
示例2: hash
function osc_decrypt_alert($string) {
$key = hash("sha256", osc_get_alert_private_key(), true);
if(function_exists('mcrypt_module_open')) {
$cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, '');
$cipherText = '';
if (mcrypt_generic_init($cipher, $key, $key) != -1) {
$cipherText = mdecrypt_generic($cipher, $string);
mcrypt_generic_deinit($cipher);
}
return trim(substr($cipherText, 32));
};
require_once LIB_PATH . 'phpseclib/Crypt/Rijndael.php';
$cipher = new Crypt_Rijndael(CRYPT_RIJNDAEL_MODE_CBC);
$cipher->disablePadding();
$cipher->setBlockLength(256);
$cipher->setKey($key);
$cipher->setIV($key);
return trim(substr($cipher->decrypt($string), 32));
}