I’m looking for a library for encrypting and decrypting a string which provides the following properties:
- Using an encryption mode block or stream, besides that I’m indifferent towards the algorithm.
- Should support a key with small length, small enough to enable known text cipher attack.
- Preferably should be able to take care of low level cryptography issues such as padding decisions.
For example:
string Encrypt(int key, string messageToBeEncrypted) // returns cipher
string Decrypt(int key, string messageToBeDecrypted) // returns message
I hope there are no libraries out there which use intentionally weak ciphers (and all ciphers with short key sizes are weak by design).
But you can use any normal cryptography library and use a wrapper around this, which converts an
intvalue to a key of the right size, by simply zero-padding it (or alternatively, by invoking a hash function with right output size).I hope you’ll inform your customers that you are not using an industry-standard strong cipher, but a weak one.