/// <summary> /// 解密 /// </summary> public static byte[] Decrypt(byte[] bytes, int key) { if (bytes == null || bytes.Length == 0) { return(new byte[0]); } byte versionNO = bytes[0]; CodySecurityBase codySecurity = CodySecurityFactory.CreateCodySecurity(versionNO); return(codySecurity.Decrypt(bytes, 1, key)); }
internal const byte VersionNO1 = 1;//加密版本号 /// <summary> /// 加密(经测试10万次加密解密10K数据,2秒),目前使用加密版本1加密 /// </summary> public static byte[] Encrypt(byte[] bytes, int key) { List <byte> byteList = new List <byte>(); byteList.Add(CodySecurityHelper.VersionNO1); CodySecurityBase codySecurity = CodySecurityFactory.CreateCodySecurity(CodySecurityHelper.VersionNO1); codySecurity.Encrypt(byteList, bytes, key); return(byteList.ToArray()); }