zhzhwcn.com
域名年龄: 13年4个月20天HTTP/1.1 200 OK 访问时间:2015年09月09日 17:36:58 服务器:Apache/2.4.7 (Ubuntu) 语言环境:PHP/5.5.9-1ubuntu4.5 动作:Cookie,Accept-Encoding X-Pingback: http://www.zhzhwcn.com/xmlrpc.php Content-Encoding: gzip 文件大小:12410 Keep-Alive: timeout=5, max=100 连接:Keep-Alive 类型:text/html; charset=UTF-8 网站编码:UTF-8
宁静也不一定致远也有可能会打盹菜单跳至内容首页AboutPlayer彩云天气WP测试vpn用C#实现跟CI里面的加密解密发表回复可以用C#加密然后用CI解密,反过来也可以,只支持CI默认的加密方式(MCRYPT_RIJNDAEL_256 + MCRYPT_MODE_CBC + sha1 安装php_mcrypt扩展后)using System;using System.Text;using System.IO;using System.Security.Cryptography;namespace ERP_Checkin{class CI_Encrypt{private string key;private string hash_type = “sha1”;public CI_Encrypt(string key = “”){if(key.Length > 0){this.key = key;}}public string encode(string data){RijndaelManaged aes = new RijndaelManaged();aes.KeySize = 256;aes.BlockSize = 256;aes.Padding = PaddingMode.Zeros;aes.Mode = CipherMode.CBC;aes.Key = this.get_key(key);aes.GenerateIV();var _IV = aes.IV;byte[] buffer;ICryptoTransform AESEncrypt = aes.CreateEncryptor(aes.Key, aes.IV);using (MemoryStream msEncrypt = new MemoryStream()){using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, AESEncrypt, CryptoStreamMode.Write)){using (StreamWriter swEncrypt = new StreamWriter(csEncrypt)){//Write all data to the stream.swEncrypt.Write(data);}buffer = msEncrypt.ToArray();}}var enc = new byte [ _IV.Length + buffer.Length ];Array.Copy(_IV,enc ,_IV.Length);Array.Copy(buffer,0,enc,_IV.Length,buffer.Length);return this.add_cipher_noise(enc);}public string decode(string data){string plainText;byte[] _enc_data = this.remove_cipher_noise(Convert.FromBase64String(data));using (RijndaelManaged aes = new RijndaelManaged()){aes.KeySize = 256;aes.BlockSize = 256;aes.Padding = PaddingMode.Zeros;aes.Mode = CipherMode.CBC;aes.Key = this.get_key(key);var _IV = new byte[aes.IV.Length];Array.Copy(_enc_data, _IV, _IV.Length);aes.IV = _IV;var endata = new byte[_enc_data.Length – aes.IV.Length];Array.Copy(_enc_data, aes.IV.Length, endata, 0, endata.Length);// Create a decrytor to perform the stream transform.ICryptoTransform decryptor = aes.CreateDecryptor(aes.Key, aes.IV);// Create the streams used for decryption.using (MemoryStream msDecrypt = new MemoryStream(endata)){using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read)){using (StreamReader srDecrypt = new StreamReader(csDecrypt)){// Read the decrypted bytes from the decrypting stream// and place them in a string.plainText = srDecrypt.ReadToEnd();}}}}return plainText;}public string add_cipher_noise(byte[] data){string hashkey = this.hash(System.Text.Encoding.Default.GetString(this.get_key(this.key)));char[] keyChar = hashkey.ToCharArray();byte[] encrpytData = new byte[data.Length];for (int i = 0, j = 0; i = hashkey.Length){j = 0;}var temp = (((int)data[i] + (int)keyChar[j]) % 256);encrpytData[i] = (byte)temp;}return System.Convert.ToBase64String(encrpytData);}public byte[] remove_cipher_noise(byte[] data){string hashkey = this.hash(System.Text.Encoding.Default.GetString(this.get_key(this.key)));char[] keyChar = hashkey.ToCharArray();byte[] encrpytData = new byte[data.Length];int temp;for (int i = 0, j = 0; i = hashkey.Length){j = 0;}temp = (int)data[i] – (int)keyChar[j];if(temp本条目发布于2015 年 01 月 15 日。属于Coding
© 2010 - 2020 网站综合信息查询 同IP网站查询 相关类似网站查询 网站备案查询网站地图 最新查询 最近更新 优秀网站 热门网站 全部网站 同IP查询 备案查询
2024-07-30 09:58, Process in 0.0144 second.