RNCryptor/JNCryptor — pull request #18 by yincrash (2014-07-07 18:48:30+00:00)
Title: add streaming support for encryption / decryption + tests

implementation of issue #3

I've only briefly looked at the streaming branch already here, but I had to implement both decrypting and encrypting streams for an Android project that had to match iOS RNCryptor implementation, so I just started from scratch and came up with this implementation.

For decrypting, it uses a [PushbackInputStream](http://docs.oracle.com/javase/7/docs/api/java/io/PushbackInputStream.html) to probe for the end of the stream while simultaneously storing the HMAC provided by the stream, then doing a constant-time check of the provided HMAC with a computed HMAC.

For encrypting, it is fairly straightforward. It writes the header to the wrapped output stream and allows a finishing step if the client doesn't want to close the stream after writing the cipher text.