string encryption

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 1 16:55:08 PDT 2016


On Friday, 1 July 2016 at 23:23:19 UTC, Hiemlick Hiemlicker wrote:
> ok. For some reason I thought CTFE's applied to normal 
> functions but I realize that doesn't make a lot of sense.

It is applied to normal functions, just when they are used in the 
right context.

int a = factorial(3); // normal runtime

static a = factorial(3); // CTFE


Same function, but different contexts. In a static or enum 
variable, it is CTFE'd. In a normal runtime variable, it is 
runtime interpreted.

> Yes, of course. Do D names change depending on -debug vs 
> -release?

No, he meant -g, not -debug. That puts the function names in the 
executable, whereas they might not be there without it (though 
they might be too... I don't think this makes much of a 
difference)

See my post here:
http://stackoverflow.com/a/38149801/1457000

tbh, I don't think encrypting strings is really worth it either, 
they aren't hard to extract anyway.


> I'm not too concerned about the attacker seeing them because 
> they will have to watch every decryption to get the string(or 
> possibly write a utility to automate the decryption).

And that's not really hard.... where's the string going anyway? 
You might want it in a separate file that you can optionally 
encrypt or ask for it from the user.


More information about the Digitalmars-d mailing list