public void TransformFinalBlock_InputCount_Overflow() { byte[] input = new byte [1]; ARC4Managed rc4 = new ARC4Managed(); rc4.TransformFinalBlock(input, 1, Int32.MaxValue); }
public void TransformFinalBlock_InputCount_Negative() { byte[] input = new byte [1]; ARC4Managed rc4 = new ARC4Managed(); rc4.TransformFinalBlock(input, 0, -1); }
public ARC4Crypt(HashAlgorithm hash, bool isServer) { Contract.Requires(hash != null); var encKey = isServer ? _serverEncClientDec : _serverDecClientEnc; var decKey = isServer ? _serverDecClientEnc : _serverEncClientDec; _encrypt = new ARC4Managed(); _decrypt = new ARC4Managed(); _encrypt.Key = hash.ComputeHash(encKey); _decrypt.Key = hash.ComputeHash(decKey); var buffer = new byte[DropN]; var length = buffer.Length; // Drop the first N bytes in the stream, to prevent the FMS attack. _encrypt.TransformFinalBlock(buffer, 0, length); _decrypt.TransformFinalBlock(buffer, 0, length); }
public void TransformFinalBlock_InputBuffer_Null() { ARC4Managed rc4 = new ARC4Managed(); rc4.TransformFinalBlock(null, 0, 1); }