I have been hunting for a crate that presents these two functions, and astonishing ly none of them do.
I found this but not one single repository linked from there has an examples folder.
Can somebody point me in the correct direction please?
I am not protecting crown jewels, and I do not want to spend months backfilling my cryptography knowledge (I am a competent mathematician, competent enough to know my limits).
I appreciate cryptographers concern for correctness, robustness etcetera, I am grateful for it. But my needs are very simple.
Public libraries are written to be flexible, which is why they have some degree of complexity.
I may be new to Rust, but I have a lot of experience programming. The general rule is - if you're looking for a simple interface that fits your exact needs, then you're probably best rolling it yourself.
One needs a key, obviously, to encrypt anything. One needs a nonce so as to ensure the same text is never encrypted to the same thing twice. which is protection against replay attacks. Cyber Security Resource Center for Threats & Tips | Kaspersky is standard procedure in the encryption world.
Give the above the ´chacha´ interface presented by DanielKeep above seems to be only as hard as it needs to be and as only hard as many others I have seen in all kind of languages.
It would only take a few minutes to wrap that in the interface you want. Be sure to cater for replay attacks mind.
One needs a key, obviously, to encrypt anything. One needs a nonce so as to ensure the same text is never encrypted to the same thing twice
I do not care if "the same text is ...[ever] encrypted to the same thing twice"
Public libraries are written to be flexible, which is why they have some degree of complexity.
Horses for courses. Not everything has to be flexible. Sometimes simplicity is better.
I am definitely not saying that industrial grade cryptography should not be available, it should. But if it is not needed then it should not be mandatory. It is not mandatory, as it turns out. Yay!
I don't really understand your problem. These libraries are all made by people and they are generous enough to just give them away for free.
Why don't you just wrap one of them with the simple interface you need? And if you feel like giving back, publish your simple interface so that the next person needing a simple interface does not have the same struggle as you.
You do, because not doing that opens up attacks that make it possible to break the encryption. You might as well just not care about encrypting at all.
(1) I have no use for a nonce. What do I do then? I cannot answer that without more work than this is worth.
(2) Why would I redo the work of simple-crypt. Amusingly I found simple-crypt because I could hear myself whining, and I thought: "Just do it, implement it". So I went on crates.io, having decided I would call my package "simple-crypt". And there it was! Happy day!!