小编Dav*_*all的帖子

将C#decryption转换为Python PyDes

我在将代码从C#转换为Python时遇到了麻烦.在Martijn的C#博客是一个优秀的加密/解密程序[封闭在下面]但我不能让它直接转换为python版pyDes [示例下面]

    public static string DecryptString(string Message, string Passphrase)
    {
        byte[] Results;
        System.Text.UTF8Encoding UTF8 = new System.Text.UTF8Encoding();

        // Step 1. We hash the passphrase using MD5
        // We use the MD5 hash generator as the result is a 128 bit byte array
        // which is a valid length for the TripleDES encoder we use below

        MD5CryptoServiceProvider HashProvider = new MD5CryptoServiceProvider();
        byte[] TDESKey = HashProvider.ComputeHash(UTF8.GetBytes(Passphrase));

        // Step 2. Create a new TripleDESCryptoServiceProvider object
        TripleDESCryptoServiceProvider TDESAlgorithm = new TripleDESCryptoServiceProvider(); …
Run Code Online (Sandbox Code Playgroud)

c# python encryption tripledes

3
推荐指数
1
解决办法
1737
查看次数

标签 统计

c# ×1

encryption ×1

python ×1

tripledes ×1