Posted on: 11/28/2014 3:14:52 PM | Views : 687

I have this below code in c# i need to convert it into nodejs i would really appriciate some help in this. This is encryption and decryption code in c#
Rfc2898DeriveBytes passwordDb2 = new Rfc2898DeriveBytes(passphrase, Encoding.ASCII.GetBytes(DeriveSalt(grains))); byte[] nonce = passwordDb2.GetBytes(NonceSize); AesManaged symmetricKey = new AesManaged { Mode = CipherMode.ECB, Padding = PaddingMode.None }; _encryptor = symmetricKey.CreateEncryptor(_nonces[0], null); public byte[] Encrypt(byte[] plainText, int blockIndex) { byte[] nonceEncrypted = new byte[NonceSize]; byte[] outputData = new byte[_chunkSize]; _encryptor.TransformBlock(_nonces[blockIndex], 0, NonceSize, nonceEncrypted, 0); for (int i = 0; i < _chunkSize; i++) { outputData[i] = (byte)(plainText[i] ^ nonceEncrypted[i % NonceSize]); } ...

Go to the complete details ...