AES encryption with openssl bindings

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 25 13:30:42 PDT 2014


Justin Whear:

> brad clawsie:
>>      b = cast(ubyte[]) s;

Better to use std.string.representation.


> It doesn't look like you're allocating space for `e` or `d`, 
> e.g. `auto e
> = new ubyte[](256);`, so those arrays have a length of 0, in 
> which case
> the encrypt/decrypt functions are just trashing their way 
> through memory.

Thankfully we have slices in D. So better to write little wrapper 
functions, make them the only public functions in a module and 
use them only.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list