Click here to Skip to main content
16,005,389 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Converting encrypted data into string/decimal and vice versa Pin
Rage16-Jan-07 1:32
professionalRage16-Jan-07 1:32 
GeneralRe: Converting encrypted data into string/decimal and vice versa Pin
vgandhi16-Jan-07 8:40
vgandhi16-Jan-07 8:40 
AnswerRe: Converting encrypted data into string/decimal and vice versa Pin
James R. Twine16-Jan-07 3:52
James R. Twine16-Jan-07 3:52 
GeneralRe: Converting encrypted data into string/decimal and vice versa Pin
vgandhi16-Jan-07 9:15
vgandhi16-Jan-07 9:15 
GeneralRe: Converting encrypted data into string/decimal and vice versa Pin
James R. Twine16-Jan-07 11:34
James R. Twine16-Jan-07 11:34 
GeneralRe: Converting encrypted data into string/decimal and vice versa Pin
vgandhi17-Jan-07 20:38
vgandhi17-Jan-07 20:38 
GeneralRe: Converting encrypted data into string/decimal and vice versa Pin
vgandhi17-Jan-07 19:19
vgandhi17-Jan-07 19:19 
GeneralRe: Converting encrypted data into string/decimal and vice versa Pin
James R. Twine18-Jan-07 12:51
James R. Twine18-Jan-07 12:51 
   The way to do that is to pad the data buffer (if required) to a 4-byte boundary, and then take 4 byte "chunks" of them, cast the address of the chunk to an unsigned long* (or DWORD*), and then dereference the pointer to get a DWORD value to convert.

   But since you are already converting the binary data to a string (as shown in a later example you posted), you will gain little if nothing by using my suggestion - your converting the binary data to a Base64 encoded string actually expands it (each three binary bytes becomes 4 ASCII characters using Base64 encoding).

   You may reduce the raw binary data a bit, but the worst case you can get using my idea is 7 alphanumeric digits per 4 binary bytes, as opposed to hexidecimal's which is 8 alphanumeric per 4 bytes of raw data.

   You can see an example of this here:
TCHAR   caBuffer[ 32 + 1 ];
BYTE    btaBinary[] = { 0x00, 0x04, 0xE4, 0xF0 };
BYTE    btaBinary2[] = { 'A', 'b', '1', '2' };
BYTE    btaBinary3[] = { 0xFF, 0xFF, 0xFF, 0xFF };

::_ultot( *(DWORD*)btaBinary, caBuffer, 36 );
::_ultot( *(DWORD*)btaBinary2, caBuffer, 36 );
::_ultot( *(DWORD*)btaBinary3, caBuffer, 36 );
   - And by reading the contents of caBuffer after each call to ::_ultot(...)

   If you can somehow compress the data, or reduce the encryption such that the length of the cyphertext is closer to the length of the plaintext, that will also go a long way.

   Peace!

-=- James
Please rate this message - let me know if I helped or not!<HR>If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFiles

GeneralRe: Converting encrypted data into string/decimal and vice versa Pin
vgandhi22-Jan-07 18:56
vgandhi22-Jan-07 18:56 
GeneralRe: Converting encrypted data into string/decimal and vice versa Pin
James R. Twine23-Jan-07 14:45
James R. Twine23-Jan-07 14:45 
AnswerRe: Converting encrypted data into string/decimal and vice versa Pin
Michael Dunn16-Jan-07 8:35
sitebuilderMichael Dunn16-Jan-07 8:35 
GeneralRe: Converting encrypted data into string/decimal and vice versa Pin
vgandhi16-Jan-07 9:16
vgandhi16-Jan-07 9:16 
GeneralRe: Converting encrypted data into string/decimal and vice versa Pin
vgandhi17-Jan-07 19:22
vgandhi17-Jan-07 19:22 
QuestionHow to insert drawings.. [modified] Pin
Shah Satish16-Jan-07 0:06
Shah Satish16-Jan-07 0:06 
AnswerRe: How to insert drawings.. Pin
Hamid_RT16-Jan-07 1:20
Hamid_RT16-Jan-07 1:20 
GeneralRe: How to insert drawings.. [modified] Pin
toxcct16-Jan-07 0:12
toxcct16-Jan-07 0:12 
GeneralRe: How to insert drawings.. Pin
Hamid_RT16-Jan-07 1:13
Hamid_RT16-Jan-07 1:13 
GeneralRe: How to insert drawings.. Pin
toxcct16-Jan-07 1:31
toxcct16-Jan-07 1:31 
GeneralRe: How to insert drawings.. Pin
Hamid_RT16-Jan-07 1:40
Hamid_RT16-Jan-07 1:40 
AnswerRe: How to insert drawings.. Pin
Cedric Moonen16-Jan-07 1:20
Cedric Moonen16-Jan-07 1:20 
AnswerRe: How to insert drawings.. Pin
David Crow16-Jan-07 3:06
David Crow16-Jan-07 3:06 
GeneralRe: How to insert drawings.. Pin
Shah Satish16-Jan-07 3:25
Shah Satish16-Jan-07 3:25 
GeneralRe: How to insert drawings.. Pin
Shah Satish16-Jan-07 6:53
Shah Satish16-Jan-07 6:53 
GeneralRe: How to insert drawings.. Pin
Shah Satish17-Jan-07 0:18
Shah Satish17-Jan-07 0:18 
GeneralRe: How to insert drawings.. Pin
David Crow17-Jan-07 2:34
David Crow17-Jan-07 2:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.