des加密

php aes加密解密类(兼容php5、php7)

匿名 (未验证) 提交于 2019-12-02 22:10:10
<?php /** * @desc:php aes加密解密类 * @author [Lee] <[<complet@163.com>]> */ class aes{ // 加密方式:1、mcrypt;2、openssl 默认1 private $type; // cast-128 gost rijndael-128 twofish cast-256 loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent xtea blowfish enigma rc2 tripledes arcfour // AES-128-CBC AES-128-CFB AES-128-CFB1 AES-128-CFB8 AES-128-CTR AES-128-ECB AES-128-OFB AES-128-XTS AES-192-CBC AES-192-CFB AES-192-CFB1 AES-192-CFB8 AES-192-CTR AES-192-ECB AES-192-OFB AES-256-CBC AES-256-CFB AES-256-CFB1 AES-256-CFB8 AES-256-CTR AES-256-ECB AES-256-OFB AES-256-XTS BF-CBC BF-CFB BF-ECB

Des 加密 界面

孤街浪徒 提交于 2019-11-28 02:21:57
public class DESHelper { //默认密钥向量 private static byte[] Keys = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF }; /// <summary> /// DES加密字符串 /// </summary> /// <param name="encryptString">待加密的字符串</param> /// <param name="encryptKey">加密密钥,要求为8位</param> /// <returns>加密成功返回加密后的字符串,失败返回源串</returns> public static string EncryptDES(string encryptString, string encryptKey) { try { byte[] rgbKey = Encoding.UTF8.GetBytes(encryptKey.Substring(0, 8)); byte[] rgbIV = Keys; byte[] inputByteArray = Encoding.UTF8.GetBytes(encryptString); DESCryptoServiceProvider dCSP = new DESCryptoServiceProvider();

实现本地des和aes 解密的工具

折月煮酒 提交于 2019-11-26 17:15:25
<?php $raw = file_get_contents('php://input'); if(!empty($raw)) { parse_str($raw);//解析到当前作用域 if (!empty($method) && !empty($password) && !empty($encodetext)) { $method = trim($method); $password = trim($password); $encodetext = trim($encodetext); $allowdmethod = ['aes', 'des']; if (!in_array($method, $allowdmethod)) { die(); } if ($method == 'aes') { $method = 'aes-128-cbc'; $iv = '1234567890123456'; } if ($method == 'des') { $method = 'des-cbc'; $iv = '12345678'; } $decodtext = openssl_decrypt($encodetext, $method, $password, false, $iv); die($decodtext); } } ?> <html> <head> <title>des和aes解密