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.


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

Cleaned initializing vector (removed non-hex characters):

Name of file to create: