public ElGamalCipher(ElGamalKeyStruct elg_current_key) { // set the key details current_key = elg_current_key; // calculate the blocksizes plaintext_blocksize = (elg_current_key.P.bitCount() - 1) / 8; ciphertext_blocksize = ((elg_current_key.P.bitCount() + 7) / 8) * 2; //ciphertext is twice as plaintext // set the default block for plaintext block_size = plaintext_blocksize; }
public ImplementationClass() { current_key = new ElGamalKeyStruct(); current_key.P = new BigInteger(0); current_key.G = new BigInteger(0); current_key.Y = new BigInteger(0); current_key.X = new BigInteger(0); // default key size KeySizeValue = 384; //range of keys LegalKeySizesValue = new[] { new KeySizes(384, 1088, 8) }; }
public ElGamalDecrypt(ElGamalKeyStruct p_struct) : base(p_struct) { // set the default block size to be ciphertext block_size = ciphertext_blocksize; }
public ElGamalEncrypt(ElGamalKeyStruct p_struct) : base(p_struct) { random_number = new Random(); }