I am looking for a python library for encrypting a string with a single key. I do not want the key to derivable by knowing the input and the output. I have came to cryptography.fernet
so far, but I am not sure if this will fulfill my needs. Can the encryption key be derived by knowing the algorithm (assuming the fernet algorithm in this case) and knowing the input and the output?
For example when I encrypt message A
with key K
and it outputs B
, can somehow A
and B
be put together, so it will output K
?
EDIT
The actual use of this is the following. I need to store a password in a place that others can see (a discord config channel, but that is secondary) in a way so they cannot see the actual password. I thought that the user would encrypt the password one-time with a key only visible to the bot (a discord bot) (with a command). The encrypted password would then be sent back to the user and stored in the channel for the bot to decrypt it and use it later. The problem is: if the user knows the input and the output, if he would be able to guess the key, he would then be able to decrypt all other passwords stored this way. And absolutely noone wants this to happen!