指点一下传输过程中的数据加密解密方法
因为某些数据需要通过客户外部网络传输,所以涉及到数据在传输过程中需要加密解密。传输过程包括一些图像数据(10-50K之间),回传数据很小,最多1-2K。
现在要求是这样:
1、数据在加密后不能过多增加数据量,比如数据加密前为10K,加密后的数据不能比10K大太多,最多增加30%以内。
2、加密解密过程不能有过多开销,比如执行加密解密函数,所需要花费的时间不能超过1秒。
有好的算法或现成的函数,SDK这些,可以高分相送! --------------------编程问答-------------------- 可以先加密,再压缩...50k内的数据来看,时间不会超过1s
对称加密算法,压缩算法网上google吧 --------------------编程问答--------------------
你这要求太低了,所有商用加密算法都满足...自己挑去吧...
System.Security.Cryptography 命名空间 --------------------编程问答-------------------- 加密算法
http://www.dotnetdev.cn/2011/03/%E4%B8%80%E7%A7%8D%E7%AE%80%E5%8D%95%E7%9A%84%E5%AF%B9%E7%A7%B0%E5%8A%A0%E5%AF%86%E7%AE%97%E6%B3%95/
压缩算法
http://www.dotnetdev.cn/2011/03/gzip%E5%92%8Cdeflate%E4%B8%A4%E7%A7%8D%E6%95%B0%E6%8D%AE%E5%8E%8B%E7%BC%A9%E7%AE%97%E6%B3%95/ --------------------编程问答--------------------
UP。这位大神,好清闲啊~~~ --------------------编程问答-------------------- 要求这么低,确实基本所有的加密都能用,给你推荐几个:
http://www.blogjava.net/heyang/archive/2010/12/26/341556.html
--------------------编程问答-------------------- DES加密:
private static void EncryptData(String inName, String outName, byte[] desKey, byte[] desIV)
{
//Create the file streams to handle the input and output files.
FileStream fin = new FileStream(inName, FileMode.Open, FileAccess.Read);
FileStream fout = new FileStream(outName, FileMode.OpenOrCreate, FileAccess.Write);
fout.SetLength(0);
//Create variables to help with read and write.
byte[] bin = new byte[100]; //This is intermediate storage for the encryption.
long rdlen = 0; //This is the total number of bytes written.
long totlen = fin.Length; //This is the total length of the input file.
int len; //This is the number of bytes to be written at a time.
DES des = new DESCryptoServiceProvider();
CryptoStream encStream = new CryptoStream(fout, des.CreateEncryptor(desKey, desIV), CryptoStreamMode.Write);
Console.WriteLine("Encrypting...");
//Read from the input file, then encrypt and write to the output file.
while(rdlen < totlen)
{
len = fin.Read(bin, 0, 100);
encStream.Write(bin, 0, len);
rdlen = rdlen + len;
Console.WriteLine("{0} bytes processed", rdlen);
}
encStream.Close();
fout.Close();
fin.Close();
}
摘自MSDN --------------------编程问答-------------------- RSA,DES都能做加密,而且效率也还可以 --------------------编程问答-------------------- RSA,DES都能做加密,而且效率也还可以
补充:.NET技术 , C#