Thread overview
AES in dlang?
Feb 15
IchorDev
5 days ago
Dejan Lekic
5 days ago
Andy Valencia
February 12

I was wondering about an @safe dlang version of AES, and just couldn't find one. (Well, there was one, but without any of the nonce/IV stuff.) I know many will be perfectly happy with calls into C libraries, but for those who want to lean into D's many safety features, I've ported a "Tiny AES" and begun wiring up testing for it:

https://sources.vsta.org:7100/dlang/file?name=tiny/aes.d&ci=tip

February 15

On Wednesday, 12 February 2025 at 00:20:02 UTC, Andy Valencia wrote:

>

I was wondering about an @safe dlang version of AES, and just couldn't find one. (Well, there was one, but without any of the nonce/IV stuff.) I know many will be perfectly happy with calls into C libraries, but for those who want to lean into D's many safety features, I've ported a "Tiny AES" and begun wiring up testing for it:

https://sources.vsta.org:7100/dlang/file?name=tiny/aes.d&ci=tip

I made this tiny-AES port a while ago: https://code.dlang.org/packages/encrypt

It's fully @safe; it uses structs rather than classes, so no allocations are required; and there are already various unittests.

5 days ago

On Wednesday, 12 February 2025 at 00:20:02 UTC, Andy Valencia wrote:

>

I was wondering about an @safe dlang version of AES, and just couldn't find one. (Well, there was one, but without any of

I am guessing you probably saw the "crypto" package and it does not work the way you want it, right? Link: https://github.com/shove70/crypto

5 days ago

On Tuesday, 18 February 2025 at 10:20:44 UTC, Dejan Lekic wrote:

>

On Wednesday, 12 February 2025 at 00:20:02 UTC, Andy Valencia wrote:

>

I was wondering about an @safe dlang version of AES, and just couldn't find one. (Well, there was one, but without any of

I am guessing you probably saw the "crypto" package and it does not work the way you want it, right? Link: https://github.com/shove70/crypto

I explicitly wanted @safe, and thus @system and pointer mechanics must be avoided. But it's a very tidy implementation, and I've added it to my collection. Thank you!

Andy