by Ricardo Fernández Serrata
Encryption/Decryption using Rivest Cipher v4 algorithm. SHA-256 is used as Key Derivation Function here.
Some pros about RC4 are that output has exactly the same size as input, and you can encrypt or decrypt without having to specify which you want to do (XOR cipher also has these pros). Cons are, this is highly insecure, even with the KDF.
For higher security, use the output of /dev/random as an OTP and avoid using the KDF so that the key can be indefinitely large (increasing entropy)
I was planning to make the keystream salted, but that would have these cons:
- Slightly bigger output, because the salt must be included.
- Increased memory allocation, because input and output must be separated.
- 2 functions/algorithms, 1 for encryption and the other for decryption. Instead of just 1.
- Unnecessary code complexity.
Original (used as base/template): llamalab.com/automate/community/flows/25728
Reviews and ratings can be submitted in the app.