Encryption

Adam D. Ruppe destructionator at gmail.com
Mon May 17 17:54:52 UTC 2021


On Monday, 17 May 2021 at 16:54:18 UTC, noid wrote:
> Hi! I am pretty new on Dlang and I wanted to make a small 
> password manager that used some sort of encryption on a file 
> (for example AES256) and save a password to decrypt it later, 
> so you can copy the password.

I haven't done this specifically myself, but if I did, I'd 
probably use bindings to the C libsodium and let it do most the 
encryption work.

this looks reasonable but again I haven't used myself.

https://code.dlang.org/packages/libsodiumd


Since it is a simple binding to the C library, you'd use it the 
same way you would from C itself and can look up tutorials for 
that and easily translate to D.

> I also don't know how I could store the password (for example 
> in a SHA256 hash) for decrypting the files.

Now this I have done myself, and again, I delegated the real work 
to a C library called argon2.

My library is 
https://code.dlang.org/packages/arsd-official%3Aargon2

And my docs:
http://arsd-official.dpldocs.info/arsd.argon2.html


If you get the C argon2 library installed, then you can use that 
D module easily with the `encode` and `verify` functions.


More information about the Digitalmars-d-learn mailing list