Click here to Skip to main content
15,897,704 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: LNK2001 error Pin
shivapriyak16-Jan-07 0:58
shivapriyak16-Jan-07 0:58 
AnswerRe: LNK2001 error Pin
Hamid_RT16-Jan-07 1:16
Hamid_RT16-Jan-07 1:16 
AnswerRe: LNK2001 error Pin
KarstenK16-Jan-07 3:00
mveKarstenK16-Jan-07 3:00 
GeneralRe: LNK2001 error Pin
David Crow16-Jan-07 3:03
David Crow16-Jan-07 3:03 
QuestionConverting encrypted data into string/decimal and vice versa Pin
vgandhi16-Jan-07 0:17
vgandhi16-Jan-07 0:17 
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 
vgandhi wrote:
In this case I want to take the encrypted data pBufPtr and display it as a string to the user. So any suggestions on how I can convert the pBufPtr into a decimal number or string that can be displayed to the user for typing purposes.

Also the decimal or string value obtained by converting the pBufPtr needs to be converted back into the encrypted data for the response side of the application


   The simplest thing to do is to convert each byte of the encrypted data into two hexidecimal characters, so that a byte of the value of 'z' becomes the string of two characters: '7A', and you can extend this to each byte of encrypted data.  I.e 'ijk123' becomes '696A6B313233'.

   If the encrypted data is of fixed length, for example, it will always be 10 characters of encrypted data, you can render it to hexidecimal and back again using functions like sprintf(...) and sscanf(...).
::sprintf( "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
    btaEncData[ 0 ], btaEncData[ 1 ], btaEncData[ 2 ], btaEncData[ 3 ], 
    btaEncData[ 4 ], btaEncData[ 5 ], btaEncData[ 6 ], 
    btaEncData[ 7 ], btaEncData[ 8 ], btaEncData[ 9 ] );
 
// ....
 
::sscanf( cpHexData, "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
    &btaEncData[ 0 ], &btaEncData[ 1 ], &btaEncData[ 2 ], &btaEncData[ 3 ], 
    &btaEncData[ 4 ], &btaEncData[ 5 ], &btaEncData[ 6 ], 
    &btaEncData[ 7 ], &btaEncData[ 8 ], &btaEncData[ 9 ] );
   That is a simple example, and not the most optimal, but it should give you the general idea.

   You can reduce the amount of data the user has to type by converting the encrypted data buffer into blocks of 32-bit values (DWORDs) or 64-bit values (hypers), and using a function like ultoa(...) or _ui64toa(...) with a higher radix to reduce number of characters but use a wider range of them, and use the corresponding ato*(...) functions to convert them back.
ultoa( 0xFFFFFFFF, caBuffer, 10 ); // = "<code>4294967295</code>"
ultoa( 0xFFFFFFFF, caBuffer, 16 ); // = "<code>ffffffff</code>"
ultoa( 0xFFFFFFFF, caBuffer, 36 ); // = "<code>1z141z3</code>"
   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
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 
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 

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.