久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用 openssl_encrypt 替換 Mcrypt 進行 3DES-ECB 加密

Use openssl_encrypt to replace Mcrypt for 3DES-ECB encryption(使用 openssl_encrypt 替換 Mcrypt 進行 3DES-ECB 加密)
本文介紹了使用 openssl_encrypt 替換 Mcrypt 進行 3DES-ECB 加密的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有一個使用 mycrypt 的加密方法,密碼是 3des,模式 ecb:

mcrypt_module_open ( MCRYPT_3DES, '', 'ecb', '' )

現(xiàn)在想用openssl_encrypt加密,在openssl_get_cipher_methods()列表中沒有找到des3-ecb.

解決方案

現(xiàn)在我想用openssl_encrypt加密它,在openssl_get_cipher_methods()列表中沒有找到des3-ecb.

它是des-ede3.使用分組密碼的對稱加密需要某種操作模式.如果您查看列表,您會看到類似 des-ede3des-ede3-cbcdes-ede3-cfb 和 <代碼>des-ede3-ofb.CBC、CFB 和 OFB 都已命名,而未命名密碼必須是唯一的其他常見操作模式:ECB.

<小時>

切勿使用ECB模式.它是確定性的,因此在語義上不安全.你至少應(yīng)該使用像 CBC 或 點擊率.最好對您的密文進行身份驗證,這樣像填充預言機攻擊這樣的攻擊是不可能的.這可以通過 GCM 或 EAX 等身份驗證模式或 encrypt-then-MAC 方案來完成.>

現(xiàn)在不要使用三重 DES.即使您使用最大的 192 位密鑰,它也最多只能提供 112 位的安全性.如果使用較短的密鑰大小,則它僅提供 56 或 57 位的安全性.AES 會更快(處理器有一個特殊的 AES-NI 指令集),并且使用 128 位的最低密鑰大小甚至更安全.3DES 的最大密文大小也有實際限制.請參閱3DES 和 AES 的安全性比較.

I have an encryption method with mycrypt and the cipher is 3des, mode ecb:

mcrypt_module_open ( MCRYPT_3DES, '', 'ecb', '' )

Now I want to encrypt it using openssl_encrypt, and I did not find des3-ecb in openssl_get_cipher_methods() list.

解決方案

now I want to encrypt it use openssl_encrypt, and I did not find des3-ecb in openssl_get_cipher_methods() list.

It's des-ede3. Symmetric encryption with a block cipher needs some kind of mode of operation. If you look through the list, you will see something like des-ede3, des-ede3-cbc, des-ede3-cfb and des-ede3-ofb. CBC, CFB and OFB are all named and the unnamed cipher must be the only other common mode of operation: ECB.


Never use ECB mode. It's deterministic and therefore not semantically secure. You should at the very least use a randomized mode like CBC or CTR. It is better to authenticate your ciphertexts so that attacks like a padding oracle attack are not possible. This can be done with authenticated modes like GCM or EAX, or with an encrypt-then-MAC scheme.

Don't use Triple DES nowadays. It only provides at best 112 bit of security even if you use the largest key size of 192 bit. If a shorter key size is used, then it only provides 56 or 57 bits of security. AES would be faster (processors have a special AES-NI instruction set) and even more secure with the lowest key size of 128 bit. There is also a practical limit on the maximum ciphertext size with 3DES. See Security comparison of 3DES and AES.

這篇關(guān)于使用 openssl_encrypt 替換 Mcrypt 進行 3DES-ECB 加密的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 個表)
How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 設(shè)置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數(shù)組自動填充選擇框)
PHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 從 MSSQL-SELECT 產(chǎn)生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 丝袜毛片| 国产女人与拘做受视频 | 亚洲乱码国产乱码精品精98午夜 | a久久久久久 | av天天干| 日本二区| 欧美区日韩区 | 日日操操操 | 日韩一区二区三区在线观看 | 日韩在线xx | 久久精品一区二区三区四区 | 亚洲国产精品久久久久 | 久久精品中文 | 九九久久精品视频 | 成人影院网站ww555久久精品 | 久久午夜剧场 | 色爽女| 日韩av一区二区在线观看 | 久久久精品一区二区 | 国产高清在线精品 | 天天搞天天操 | www.jizzjizz | 精品亚洲一区二区三区 | 黄网站涩免费蜜桃网站 | 午夜欧美 | jizz中国日本 | 日韩中文字幕一区 | 亚洲一区二区三区四区五区中文 | 精品亚洲一区二区三区 | www日本在线观看 | 西西裸体做爰视频 | 欧美精品第三页 | 天天干狠狠操 | 日韩一区二区在线播放 | 九九热免费在线观看 | 色吊丝2 | 午夜影院在线播放 | 欧美一区久久 | 中文av电影| 色噜噜亚洲男人的天堂 | 国产精品有限公司 |