【问题标题】:DES Encryption and Decryption in PHPPHP中的DES加密和解密
【发布时间】:2015-06-11 19:30:54
【问题描述】:

请帮忙。如何在加密和解密中制作数组?

<?php
    class DES{

        function encrypt($plainText, $cipherKey){
            //plainText
            $result = $this->toBiner($plainText);
            $result = $this->InitialPermutation($result);
            //key
            $key = $this->toBiner($cipherKey);
            $key = $this->kompresBit($key);
            $arrLeftShift = $this->LeftShift($key);
            //final
            $result = $this->keyExpansion($result, $arrLeftShift);
            return $result;
        }

        function decrypt($encryptedText, $cipherKey){
            $key = $this->toBiner($cipherKey);
            $key = $this->kompresBit($key);
            $arrLeftShift = $this->LeftShift($key);

            $result = $this->reverseKeyExpansion($encryptedText, $arrLeftShift);
            $result = $this->revInitialPermutation($result);

【问题讨论】:

  • 你的代码有什么问题?这行得通吗?它不工作吗?你看到任何错误吗?您需要什么帮助?

标签: php arrays des


【解决方案1】:

我对加密了解不多,但据我了解,DES 不是推荐的加密标准:http://en.wikipedia.org/wiki/Data_Encryption_Standard

如果您想要更安全的东西,请查看问题here,其中包含有效的加密/解密功能

【讨论】:

    猜你喜欢
    • 2014-02-26
    • 1970-01-01
    • 1970-01-01
    • 2011-05-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多