Encryption / Hashing
Currently the project supports the following encryption algorithms
- (No Encryption)
- AES-256 in CBC Mode
- AES-256 in CTR Mode
and the following hashing algorithms:
- HMAC SHA-2 256
- HMAC SHA-3 256
- Blake3 256
- Blake2b 256
- Blake2bp 256
While it is generally a good idea to support many different options to make the project usable in many cases i do not think this is the case for encryption/hashing. In my opinion supporting multiple algorithms has the following disadvantages:
- More code responsible for this security relevant functions. This increases the chance of having a bug there and makes it harder to review.
- More dependencies. This also increases the chance of security risks while also increasing the build time and the number of crates needed to trust. This can be reduced by feature gating the different algorithms, but this can lead to versions of asuran that do not work together
- Confusion of the user. When there are multiple options there will always pop up the question which one is more secure and/or faster
- I'm not sure about this, but i do not know if all Hashing and Encryption Functions play well together or if there are some combinations that have lower security levels then expected.
There is obviously also an advantage to having multiple options, mainly that the user can choose what he thinks is the best.
IMO it would be best to only have one Encryption and one Hashing option for now, while making sure that latter changes to another algorithm (for whatever reason) are possible.