What are some good and fast encyprtion/decription modules?

Hi,

Any advice on rust encryption/decryption modules for symmetric and asymmetric encryption
? Also for all cryptographers out there. I have a dubious question. Let say I want to assert nobody has tempered with my file and at the same time not allow anyone to see what is in it. Furthermore I would like to allow anyone to see the content of the file if and only if it has not been tempered with.

So file can only bee seen if it has not been tempered with!!

One naive solution would be to use a hash function on an encrypted file to produce a key that would be used for its own decryption. However, how would one ever create one such a key prior to encrypting a file :slight_smile: see what i mean ?? so my question is, has anyone ever came up with a solution to this problem? I would appreciate if anyone could provide more materials for me to read upon the problem further..

thnx

m

I think the two concepts you're looking for are signing and encryption. I know of no way to deny access to contents which have been modified, but it's very possible to know whether something has been changed/tampered with (and if it has been, you could just not read the file). See Digital signature - Wikipedia for general info on this.

There are a number of rust crates providing cryptographic functionality- among others, https://github.com/sodiumoxide/sodiumoxide is fairly solid.

1 Like

Generate random key and nonce, encrypt your message using this key, calculate hash over the encrypted message (preferably using authenticated encryption or even MRAE), calculate key ^ hash and append or prepend result to your message. Now if message is tempered you will not be able to restore the correct key.

1 Like