RC4 file encryption/decryption
Client-side (javascript, no data is sent to server) RC4 encryption/decryption. Be careful with large files (possible high resource consumption leading to browser crash, offline tools might be better for large files).
RC4 is a symmetrical stream cipher and both encryption and decryption are using same operation - basically XORing input data with very long (256B of state variable) byte stream generated from password / initial vector. Because of XOR property (X ^ Y) ^ Y = X data is encrypted on first run (X ^ Y), decrypted on second run by XORing with identical byte stream as first time.
For security (*):
- never reuse initial vector
- use strong initial vector, e.g. hash of some text password and unique counter or some kind of salt; MD5 should be fine as purpose of it is avalanche effect, not collision resistance
- drop first bytes from key byte stream (aka RC-dropN) to minimize bias
(*) security not guaranteed, but if you lose initial vector or drop number for encrypted file you're gonna have a bad time
Offline tool
Simple win32 application with similar functionality. Password / initial vector can be entered as text
or in hexadecimal form. There is also option to skip (copy directly) initial bytes (e.g. header) from processed file.
Turbo C++: FileEncryptDecrypt.zip