www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - AES in dlang?

reply Andy Valencia <dont spam.me> writes:
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
Feb 11
next sibling parent IchorDev <zxinsworld gmail.com> writes:
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.
Feb 15
prev sibling parent reply Dejan Lekic <dejan.lekic gmail.com> writes:
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
Feb 18
parent Andy Valencia <dont spam.me> writes:
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
Feb 18