G
Guest
Hi
Having a bit of an ish with unicode.
Basically, I've discovered an encryption library on planetsourcecode that
does exactly what I want - it encrypts a string using a fairly (more than
just XOR) sophisticated method, using the functions in advapi32.lib, and can
decrypt it to get the same string back. It's not some unix hybrid that only
works with files or anything, so it seems good. And I tested it, and it does
seem to get the right string back.
However, I'm having a bit of an ish using printf on the returned value (the
encrypted data).
Does the console have an ish with printing garbage characters on the screen?
The code was something like this:
_TCHAR* origdata = "the data";
_TCHAR encrypted[255];
_TCHAR returndata[255];
printf(_T("The original data is \"%s\"\n"), origdata);
DoTheEncryption(origdata, encrypted, ...);
printf(_T("The encrypted data is \"%s\"\n"), encrypted);
DoTheDecryption(encrypted, returndata, ...);
printf(_T("The decrypted data is \"%s\"\n"), decyrpted);
And the output is something like
The original data is "the data"
The encrypted data is "Öûê┼!]The decyrpted data is "the data"
What's baffling is no matter what it thinks of my encrypted string - it
doesn't even respect my linefeed.
Any ideas?
I looked in the memory editor and the unicode string just looks like one
byte random, one byte zero, one byte random, one byte zero, etc...
Having a bit of an ish with unicode.
Basically, I've discovered an encryption library on planetsourcecode that
does exactly what I want - it encrypts a string using a fairly (more than
just XOR) sophisticated method, using the functions in advapi32.lib, and can
decrypt it to get the same string back. It's not some unix hybrid that only
works with files or anything, so it seems good. And I tested it, and it does
seem to get the right string back.
However, I'm having a bit of an ish using printf on the returned value (the
encrypted data).
Does the console have an ish with printing garbage characters on the screen?
The code was something like this:
_TCHAR* origdata = "the data";
_TCHAR encrypted[255];
_TCHAR returndata[255];
printf(_T("The original data is \"%s\"\n"), origdata);
DoTheEncryption(origdata, encrypted, ...);
printf(_T("The encrypted data is \"%s\"\n"), encrypted);
DoTheDecryption(encrypted, returndata, ...);
printf(_T("The decrypted data is \"%s\"\n"), decyrpted);
And the output is something like
The original data is "the data"
The encrypted data is "Öûê┼!]The decyrpted data is "the data"
What's baffling is no matter what it thinks of my encrypted string - it
doesn't even respect my linefeed.
Any ideas?
I looked in the memory editor and the unicode string just looks like one
byte random, one byte zero, one byte random, one byte zero, etc...