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 (*):

(*) security not guaranteed, but if you lose initial vector or drop number for encrypted file you're gonna have a bad time

Source file:

Initializing vector (hex, arbitrary length up to 256 bytes):

Drop first bytes from key stream.

Options:

remove "0x" groups from initializing string in addition to non-hex characters

Cleaned initializing vector (removed non-hex characters):

Name of file to create:

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
RC4 file encrypt and decrypt


 "Cookie monsters": 7684406    Parse time: 0.001 s