首页
社区
课程
招聘
未解决 [求助]DES加密算法求解
发表于: 2019-10-23 16:31 2397

未解决 [求助]DES加密算法求解

2019-10-23 16:31
2397
        public static string Encrypt(string a_strString, string a_strKey)
        {
            DESCryptoServiceProvider des = new DESCryptoServiceProvider();
            byte[] inputByteArray = Encoding.Default.GetBytes(a_strString);
            des.Key = Encoding.ASCII.GetBytes(FormsAuthentication.HashPasswordForStoringInConfigFile(a_strKey, "md5").Substring(0, 8));
            des.IV = Encoding.ASCII.GetBytes(FormsAuthentication.HashPasswordForStoringInConfigFile(a_strKey, "md5").Substring(0, 8));
            MemoryStream ms = new MemoryStream();
            CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(), CryptoStreamMode.Write);
            cs.Write(inputByteArray, 0, inputByteArray.Length);
            cs.FlushFinalBlock();
            StringBuilder ret = new StringBuilder();
            foreach (byte b in ms.ToArray())
            {
                ret.AppendFormat("{0:X2}", b);
            }
            return ret.ToString();

请问上面代码中Key和IV值都是md5加密取前8位对吗?可是我加密后的密文和代码加密后的不一样,求解?


[培训]科锐逆向工程师培训第53期2025年7月8日开班!

收藏
免费 0
支持
分享
最新回复 (1)
雪    币: 54
活跃值: (3049)
能力值: ( LV6,RANK:90 )
在线值:
发帖
回帖
粉丝
2
011K9s2c8@1M7s2y4Q4x3@1q4Q4x3V1k6Q4x3V1k6%4N6%4N6Q4x3X3g2U0L8X3u0D9L8$3N6K6i4K6u0W2j5$3!0E0i4K6u0r3e0q4W2K6K9s2g2I4K9h3q4F1i4K6u0r3j5i4u0U0K9r3W2$3k6g2)9J5c8U0t1H3x3e0y4Q4x3V1j5H3x3W2)9J5c8U0t1H3i4K6u0r3x3U0V1I4z5e0p5#2x3W2)9J5k6h3S2@1L8h3H3`.
2019-10-23 17:34
0
游客
登录 | 注册 方可回帖
返回