des这个词是什么意思,能否详细解释一下?

2026-04-03 05:561阅读0评论SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计239个文字,预计阅读时间需要1分钟。

des这个词是什么意思,能否详细解释一下?

phpfunction desEncrypt($str, $key) { $aaa=mcrypt_cbc(MCRYPT_DES, $key, $str, MCRYPT_ENCRYPT, $key); $ret=base64_encode($aaa); return urlencode($ret);}

des这个词是什么意思,能否详细解释一下?

/** * 解密 * @param string $str 要处理的字符串 * @param string $key 解密Key * @return string */

Des.php

pkcs5Pad($str, $size); $aaa = mcrypt_cbc(MCRYPT_DES, $key, $str, MCRYPT_ENCRYPT, $key); $ret = base64_encode($aaa); return urlencode($ret); } /** * 解密 * @param string $str 要处理的字符串 * @param string $key 解密Key,为8个字节长度 * @return string */ public function decode($str, $key) { $strBin = base64_decode($str); $str = mcrypt_cbc(MCRYPT_DES, $key, $strBin, MCRYPT_DECRYPT, $key); $str = $this->pkcs5Unpad($str); return $str; } function hex2bin($hexData) { $binData = ""; for ($i = 0; $i < strlen($hexData); $i += 2) { $binData .= chr(hexdec(substr($hexData, $i, 2))); } return $binData; } function pkcs5Pad($text, $blocksize) { $pad = $blocksize - (strlen($text) % $blocksize); return $text . str_repeat(chr($pad), $pad); } function pkcs5Unpad($text) { $pad = ord($text {strlen($text) - 1}); if ($pad > strlen($text)) return false; if (strspn($text, chr($pad), strlen($text) - $pad) != $pad) return false; return substr($text, 0, - 1 * $pad); } } ?>

本文共计239个文字,预计阅读时间需要1分钟。

des这个词是什么意思,能否详细解释一下?

phpfunction desEncrypt($str, $key) { $aaa=mcrypt_cbc(MCRYPT_DES, $key, $str, MCRYPT_ENCRYPT, $key); $ret=base64_encode($aaa); return urlencode($ret);}

des这个词是什么意思,能否详细解释一下?

/** * 解密 * @param string $str 要处理的字符串 * @param string $key 解密Key * @return string */

Des.php

pkcs5Pad($str, $size); $aaa = mcrypt_cbc(MCRYPT_DES, $key, $str, MCRYPT_ENCRYPT, $key); $ret = base64_encode($aaa); return urlencode($ret); } /** * 解密 * @param string $str 要处理的字符串 * @param string $key 解密Key,为8个字节长度 * @return string */ public function decode($str, $key) { $strBin = base64_decode($str); $str = mcrypt_cbc(MCRYPT_DES, $key, $strBin, MCRYPT_DECRYPT, $key); $str = $this->pkcs5Unpad($str); return $str; } function hex2bin($hexData) { $binData = ""; for ($i = 0; $i < strlen($hexData); $i += 2) { $binData .= chr(hexdec(substr($hexData, $i, 2))); } return $binData; } function pkcs5Pad($text, $blocksize) { $pad = $blocksize - (strlen($text) % $blocksize); return $text . str_repeat(chr($pad), $pad); } function pkcs5Unpad($text) { $pad = ord($text {strlen($text) - 1}); if ($pad > strlen($text)) return false; if (strspn($text, chr($pad), strlen($text) - $pad) != $pad) return false; return substr($text, 0, - 1 * $pad); } } ?>