运行时:
var_dump(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, '12345', '1abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz', MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
var_dump(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, '12345', '2abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz', MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
var_dump(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, '12345', '3abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz', MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
var_dump(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, '12345', '4abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz', MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
var_dump(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, '12345', '5abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz', MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
其结果如下:
string 'X9VFmBzVWwUSoKPtE0VoEYxGkAPwVkUDQfQwF0wPDAVxedrGWE4oMCPBAF7FRBMoQsSUFwHhpknj/fHQqgQVPw==' (length=88)
string 'T/yn6lkyB73cEs57K2pUVNhFk2tDX02CbnBIU2c2I2VxedrGWE4oMCPBAF7FRBMoQsSUFwHhpknj/fHQqgQVPw==' (length=88)
string 'WysJWSV2k5gyYoQ4+hF0Uh2JqMJ6pTC8lcrgs1jmSklxedrGWE4oMCPBAF7FRBMoQsSUFwHhpknj/fHQqgQVPw==' (length=88)
string 'fMsJByfrZBYoQIgL/g+3i6jOPiaHh2Jf0vV59g1w1ZVxedrGWE4oMCPBAF7FRBMoQsSUFwHhpknj/fHQqgQVPw==' (length=88)
string 'Mw0AlrcC5v3v6swEg+wT+uTHf8MNrxdprD9GCpOe/45xedrGWE4oMCPBAF7FRBMoQsSUFwHhpknj/fHQqgQVPw==' (length=88)
注意字符串是如何以同一组字符结尾的?
这应该发生吗?
我原以为是因为数据不同而且我每次都会创建一个新的初始化向量,从而产生完全不同的输出。
是否存在另一个好的算法,如果数据发生微小变化,会产生完全不同的输出?