加密算法blowfish 多语言
2016-02-14 20:39
375 查看
php加密算法blowfish
key256: 636c6f7365776271
key128: 636c6f7365776271
clearText: blowfish
256-bit blowfish encrypted:
6a3cbb16daef0ae0
128-bit blowfish encrypted:
6a3cbb16daef0ae0
base64结果:
NmEzY2JiMTZkYWVmMGFlMA==
LockBox 3
Wvg8gWlkvHbb8WloO0jmUQ==
这是以16进制输出的字符,不是base64输出的结果。
https://www.tools4noobs.com/online_tools/decrypt/
iv是忽略不用的。
https://webnet77.net/cgi-bin/helpers/blowfish.pl
算法:blowfish-compat
PlainText:
blowfish
ascii:(98, 108, 111, 119, 102, 105, 115, 104)
Hex Byte:(54, 50, 54, 67, 54, 70, 55, 55, 54, 54, 54, 57, 55, 51, 54, 56)
Hex Str:626C6F7766697368
base64:Ymxvd2Zpc2g=
key:
closewbq
ascii:(99, 108, 111, 115, 101, 119, 98, 113)
hex byte:(54, 51, 54, 67, 54, 70, 55, 51, 54, 53, 55, 55, 54, 50, 55, 49)
hex str:636C6F7365776271
baes64:Y2xvc2V3YnE=
cipherText:
6a3cbb16daef0ae0
6A3CBB16DAEF0AE0
ECB模式下IV向量忽略不用,用PHP加密结果也是
128/256都是 6a3cbb16daef0ae0
加密后是8个字符, (106, 60, 187, 22, 218, 239, 10, 224)=8个,ascii是j<;'#$16'Zo'#$A'`,base64是ajy7FtrvCuA=
转换成16进制成了16个字符,(54, 65, 51, 67, 66, 66, 49, 54, 68, 65, 69, 70, 48, 65, 69, 48)=16个,
ascii是6a3cbb16daef0ae0,base64:NmEzY2JiMTZkYWVmMGFlMA==
6A3CBB16DAEF0AE0 ,b64: NkEzQ0JCMTZEQUVGMEFFMA==
codecMainDemo.Password := 'closewbq';
(90, 248, 60, 129, 105, 100, 188, 118, 219, 241, 105, 104, 59, 72, 230, 81) ,base64 后的字符串就是Wvg8gWlkvHbb8WloO0jmUQ==
codecMainDemo.UTF8Password
j<;Zo`
(106, 60, 187, 22, 218, 239, 10, 224, 128, 177, 62, 128, 70, 13, 232, 4)=16个
hex
6A3CBB16DAEF0AE080B13E80460DE804,也就是 (54, 65, 51, 67, 66, 66, 49, 54, 68, 65, 69, 70, 48, 65, 69, 48, 56, 48, 66, 49, 51, 69, 56, 48, 52, 54, 48, 68, 69, 56, 48, 52)
bae64:ajy7FtrvCuCAsT6ARg3oBA==
这是用字节base64的结果,推荐
base64:NkEzQ0JCMTZEQUVGMEFFMDgwQjEzRTgwNDYwREU4MDQ=
这是用16进制字符串加密的结果,不推荐。
j<?陲鄾o?烇w?
106,60,187,22,218,239,10,224,155,111,188,21,158,239,119,220=16个
6A3CBB16DAEF0AE09B6FBC159EEF77DC=32个
base64:ajy7FtrvCuCbb7wVnu933A==
ECB填充方式是PKCS5Padding的结果
<?php /** * Created by PhpStorm. * User: Administrator * Date: 2016-02-14 * Time: 20:03 */ function newline() { printf("<br>"); } $cipher = mcrypt_module_open(MCRYPT_BLOWFISH, '', MCRYPT_MODE_ECB, ''); // The block-size of the Blowfish algorithm is 64-bits, therefore our IV // is always 8 bytes: $iv = '12345678'; $key256 = '1234567890123456ABCDEFGHIJKLMNOP'; $key256 = 'closewbq'; $key128 = 'closewbq'; printf("iv: %s\n", bin2hex($iv)); newline(); printf("key256: %s\n", bin2hex($key256)); newline(); printf("key128: %s\n", bin2hex($key128)); newline(); $cleartext = 'The quick brown fox jumped over the lazy dog'; $cleartext='blowfish'; printf("clearText: %s", $cleartext); newline(); // Do 256-bit blowfish encryption: // The strengh of the encryption is determined by the length of the key // passed to mcrypt_generic_init if (mcrypt_generic_init($cipher, $key256, $iv) != -1) { // PHP pads with NULL bytes if $cleartext is not a multiple of the block size.. $cipherText = mcrypt_generic($cipher, $cleartext); mcrypt_generic_deinit($cipher); // Display the result in hex. printf("256-bit blowfish encrypted:\n%s\n\n", bin2hex($cipherText)); newline(); } // 128-bit blowfish encryption: if (mcrypt_generic_init($cipher, $key128, $iv) != -1) { // PHP pads with NULL bytes if $cleartext is not a multiple of the block size.. $cipherText = mcrypt_generic($cipher, $cleartext); mcrypt_generic_deinit($cipher); // Display the result in hex. printf("128-bit blowfish encrypted:\n%s\n\n", bin2hex($cipherText)); } mcrypt_module_close($cipher) // ------- // Results // ------- // You may use these as test vectors for testing your Blowfish implementations... // // iv: 3132333435363738 // key256: 313233343536373839303132333435364142434445464748494a4b4c4d4e4f50 // key128: 31323334353637383930313233343536 // clearText: The quick brown fox jumped over the lazy dog // // 256-bit blowfish encrypted: // 276855ca6c0d60f7d9708210440c1072e05d078e733b34b4198d609dc2fcc2f0c30926cdef3b6d52baf6e345aa03f83e // // 128-bit blowfish encrypted: // d2b5abb73208aea3790621d028afcc74d8dd65fb9ea8e666444a72523f5ecca60df79a424e2c714fa6efbafcc40bdca0 ?>
php
iv: 3132333435363738key256: 636c6f7365776271
key128: 636c6f7365776271
clearText: blowfish
256-bit blowfish encrypted:
6a3cbb16daef0ae0
128-bit blowfish encrypted:
6a3cbb16daef0ae0
base64结果:
NmEzY2JiMTZkYWVmMGFlMA==
LockBox 3
Wvg8gWlkvHbb8WloO0jmUQ==
这是以16进制输出的字符,不是base64输出的结果。
https://www.tools4noobs.com/online_tools/decrypt/
iv是忽略不用的。
https://webnet77.net/cgi-bin/helpers/blowfish.pl
算法:blowfish-compat
PlainText:
blowfish
ascii:(98, 108, 111, 119, 102, 105, 115, 104)
Hex Byte:(54, 50, 54, 67, 54, 70, 55, 55, 54, 54, 54, 57, 55, 51, 54, 56)
Hex Str:626C6F7766697368
base64:Ymxvd2Zpc2g=
key:
closewbq
ascii:(99, 108, 111, 115, 101, 119, 98, 113)
hex byte:(54, 51, 54, 67, 54, 70, 55, 51, 54, 53, 55, 55, 54, 50, 55, 49)
hex str:636C6F7365776271
baes64:Y2xvc2V3YnE=
cipherText:
6a3cbb16daef0ae0
6A3CBB16DAEF0AE0
ECB模式下IV向量忽略不用,用PHP加密结果也是
128/256都是 6a3cbb16daef0ae0
加密后是8个字符, (106, 60, 187, 22, 218, 239, 10, 224)=8个,ascii是j<;'#$16'Zo'#$A'`,base64是ajy7FtrvCuA=
转换成16进制成了16个字符,(54, 65, 51, 67, 66, 66, 49, 54, 68, 65, 69, 70, 48, 65, 69, 48)=16个,
ascii是6a3cbb16daef0ae0,base64:NmEzY2JiMTZkYWVmMGFlMA==
6A3CBB16DAEF0AE0 ,b64: NkEzQ0JCMTZEQUVGMEFFMA==
delphi box3
加密直接是16个字符codecMainDemo.Password := 'closewbq';
(90, 248, 60, 129, 105, 100, 188, 118, 219, 241, 105, 104, 59, 72, 230, 81) ,base64 后的字符串就是Wvg8gWlkvHbb8WloO0jmUQ==
codecMainDemo.UTF8Password
j<;Zo`
(106, 60, 187, 22, 218, 239, 10, 224, 128, 177, 62, 128, 70, 13, 232, 4)=16个
hex
6A3CBB16DAEF0AE080B13E80460DE804,也就是 (54, 65, 51, 67, 66, 66, 49, 54, 68, 65, 69, 70, 48, 65, 69, 48, 56, 48, 66, 49, 51, 69, 56, 48, 52, 54, 48, 68, 69, 56, 48, 52)
bae64:ajy7FtrvCuCAsT6ARg3oBA==
这是用字节base64的结果,推荐
base64:NkEzQ0JCMTZEQUVGMEFFMDgwQjEzRTgwNDYwREU4MDQ=
这是用16进制字符串加密的结果,不推荐。
JAVA
javax.crypto.Cipherj<?陲鄾o?烇w?
106,60,187,22,218,239,10,224,155,111,188,21,158,239,119,220=16个
6A3CBB16DAEF0AE09B6FBC159EEF77DC=32个
base64:ajy7FtrvCuCbb7wVnu933A==
ECB填充方式是PKCS5Padding的结果
相关文章推荐
- .h文件和.cpp文件
- 腰间盘突出的自我治疗和锻炼方法
- App上架可能会遇到的事情以及解决方案
- C++ new/delete操作符重载
- bestcoder #72 DIV2 Clarke and MST 最大按位与的生成树
- SpringMvc中Interceptor拦截器用法
- poj 1988 Cube Stacking
- 利用Excel进行简单的数据可视化
- 【C#】基础实例演练
- iOS内存管理
- oracle SQL_EXEC_ID分析
- spring表达式语言spel
- 框架编写之聊天框架认识(五)
- T - 阿牛的EOF牛肉串(第二季水)
- 显示缩略图的javascript代码
- CClientDC,CPaintDC,CWindowDC,CDC
- C++字符串的输入函数之get()和getline()
- uva1450 - Airport
- Win7远程连接Ubuntu 15.10问题
- 堆栈解决括号问题