How can I convert a string to the hexadecimal equivelant?
and then be able to convert it back?
Using the C++ style of strings
How can I convert a string to the hexadecimal equivelant?
and then be able to convert it back?
Using the C++ style of strings
Last edited by bikr692002; 03-06-2006 at 01:57 PM.
what equivalent? Is the string a number or?
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
its like alpha characters (I'm trying to write my own excryption method)
I think it goes like
Of course its not finished yet, have alot of other things to do in the functionCode:Encrypt(string) { string Encrypt(string); int Length; int Length2; Length=(string-length(Encrypt); Length2=Length*2; inline bool atlHexEncode( const BYTE *Encrypt, int Length, LPSTR HexEquiv, int * Length2 ) throw();
Last edited by bikr692002; 03-06-2006 at 02:32 PM.
I want it to go kindof like
Input
|
Convert to Hex
|
Reverse String example: ag to ga
|
Convert to my own Table (Need to learn how to make one)
|
Multiply by random number 2 digits long
|
Store that random number as the 3rd and 4th characters in the string (but dont delete the other part of string)
|
Divide By random Number 3 digits long
|
Store that random number after the 5th character in the string (but dont delete the other part of string)
|
Divide new string by 5
|
output.
You have so many errors in the code you posted, it's not worth going over. I suggest you get a beginning C++ book.Of course its not finished yet, have alot of other things to do in the function
Data is stored on a computer in only one way: binary. There is no converting anything to anything else.How can I convert a string to the hexadecimal equivelant?
I know I already corected themthat I could see(prob more), guesss you started the post before I did
I guess I didnt follow http://msdn.microsoft.com/library/de...lhexdecode.asp right?
I ment converting AB to (A equivilant)(B equivilant)
Last edited by bikr692002; 03-06-2006 at 02:36 PM.
You want each character to be converted to its character code and that code converted to hex? So "Go" would convert to 47 6F?
If that is the case, each character in the string is still a character with the character code as its value. You can use a loop that treats each character as an integral value and then convert that to a string in hex format. You can do this with a stringstream, sprintf or other ways.