什么是我可以用于BlowFish / DH的最好的库?

时间:2011-06-26 16:08:44

标签: c# cryptography blowfish diffie-hellman

我可以用于BlowFish / DH的最好的库是什么,因为我使用的是BouncyCastle,但看起来它没有做我想要的,所以我想知道是否有另一个我可以使用的库让它让我工作与CFB / DH?感谢

这是我的BouncyCastle课程:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Modes;
using Org.BouncyCastle.Crypto.Engines;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.Math;


namespace Common.Encryption
{
    public class BlowfishCryptographer
    {
        private bool forEncryption;
        private IBufferedCipher cipher;

        public BlowfishCryptographer(bool forEncryption)
        {
            this.forEncryption = forEncryption;
            cipher = new BufferedBlockCipher(new CfbBlockCipher(new BlowfishEngine(), 64));
            cipher.Init(forEncryption, new ParametersWithIV(new KeyParameter(Encoding.ASCII.GetBytes("DR654dt34trg4UI6")), new byte[8]));
        }
        public void ReInit(byte[] IV,BigInteger pubkey)
        {
            cipher.Init(forEncryption, new ParametersWithIV(new KeyParameter(pubkey.ToByteArrayUnsigned()),IV));
        }
        public byte[] DoFinal()
        {
            return cipher.DoFinal();
        }
        public byte[] DoFinal(byte[] buffer)
        {
           return cipher.DoFinal(buffer);
        }
        public byte[] DoFinal(byte[] buffer, int startIndex, int len)
        {
            return cipher.DoFinal(buffer, startIndex, len);
        }
        public byte[] ProcessBytes(byte[] buffer)
        {
            return cipher.ProcessBytes(buffer);
        }
        public byte[] ProcessBytes(byte[] buffer, int startIndex, int len)
        {
            return cipher.ProcessBytes(buffer, startIndex, len);
        }
        public void   Reset()
        {
            cipher.Reset();
        }
    }
}

1 个答案:

答案 0 :(得分:0)

实施的源代码很容易在互联网上绊倒。

这就是你想要的吗?

http://www.schneier.com/code/blowfish.cs