Converting string to long
-
Hey guys, I am using this code to convert the data into string CryptBinaryToString((BYTE *)pBufPtr,len,1,msg2,&lul_buflen); The msg2 looks like "KBeMW9yLvHwMow5dKCXO3ddKLzIGQTmbtNVmmFF2FmT9/f39q6urq6urq6vu/u7+" and I am using the following functions to convert the string to long so that I can reduce the size to be displayed on the string char *p; long l = strtol(msg2, &p, 10); long temp1 = atoi(msg2); But both of them return 0 as the value. Please help. vg
-
Hey guys, I am using this code to convert the data into string CryptBinaryToString((BYTE *)pBufPtr,len,1,msg2,&lul_buflen); The msg2 looks like "KBeMW9yLvHwMow5dKCXO3ddKLzIGQTmbtNVmmFF2FmT9/f39q6urq6urq6vu/u7+" and I am using the following functions to convert the string to long so that I can reduce the size to be displayed on the string char *p; long l = strtol(msg2, &p, 10); long temp1 = atoi(msg2); But both of them return 0 as the value. Please help. vg
:confused: Uuh ?? This doesn't represent a number ! There are letters in it, how could this be translated to a number ? The functions will stop as soon as a non numerical symbol will be detected, in this case this is the first one (K), so the functions return 0. Why do you want to reduce its size and why do you want to convert it into a number ??
Cédric Moonen Software developer
Charting control [v1.1] -
:confused: Uuh ?? This doesn't represent a number ! There are letters in it, how could this be translated to a number ? The functions will stop as soon as a non numerical symbol will be detected, in this case this is the first one (K), so the functions return 0. Why do you want to reduce its size and why do you want to convert it into a number ??
Cédric Moonen Software developer
Charting control [v1.1]Basically I the encrypted binary data I want to convert to a string and display it as a challenge to the user who can read it out to the admin user who can use that challenge to create the response. So I need to convert that string into a decent size number or maybe string itself is fine that can be displayed to the user. Thanks.
vg
-
Basically I the encrypted binary data I want to convert to a string and display it as a challenge to the user who can read it out to the admin user who can use that challenge to create the response. So I need to convert that string into a decent size number or maybe string itself is fine that can be displayed to the user. Thanks.
vg
Well, once you get the encrypted string, you cannot reduce it any further (and even not change it). So your problem is before, already at the encryption. And I don't know how you can change the size of the encrypted string.
Cédric Moonen Software developer
Charting control [v1.1] -
Basically I the encrypted binary data I want to convert to a string and display it as a challenge to the user who can read it out to the admin user who can use that challenge to create the response. So I need to convert that string into a decent size number or maybe string itself is fine that can be displayed to the user. Thanks.
vg
The string in your OP is a representation of the encrypted data, it's base-64 encoded. You'll need to be more precise about what you mean by "convert that string into a decent size"
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ"); Ford, what's this fish doing in my ear?
-
The string in your OP is a representation of the encrypted data, it's base-64 encoded. You'll need to be more precise about what you mean by "convert that string into a decent size"
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ"); Ford, what's this fish doing in my ear?
-
Basically I the encrypted binary data I want to convert to a string and display it as a challenge to the user who can read it out to the admin user who can use that challenge to create the response. So I need to convert that string into a decent size number or maybe string itself is fine that can be displayed to the user. Thanks.
vg
vgandhi wrote:
Basically I the encrypted binary data I want to convert to a string and display it...
So just display it in encrypted format (i.e., string).
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
vgandhi wrote:
Basically I the encrypted binary data I want to convert to a string and display it...
So just display it in encrypted format (i.e., string).
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
My friend how can I display it in encrypted format to the user. The user won't understand anything.
vg
vgandhi wrote:
My friend how can I display it in encrypted format to the user. The user won't understand anything.
This makes no sense. The whole purpose for encryption is so that "it" is not understandable.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
What I mean by that is say the entire string is of 25 size I need to conver that to 10 or maybe less so that when it is displayed on the screen to the user, the user can take that string and read it out to Admin. Hope this makes it clear. Thanks.
vg
If you want a shorter human-readable string, you'll need to have less encrypted data.
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ"); Ford, what's this fish doing in my ear?