Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Need to convert text to hex value... any ideals?

Posted on 2002-04-23
Medium Priority
Last Modified: 2010-04-16
 Heres my situation. In my company (like most) there are very few people who can use a computer much less configure one. So in order to make my life easier to setup user I have a program (mainly in C++) that prompts the user for there name and email address.. From there it takes those values and puts them into the registry in the apropriate place to configure Outlook Express. Everything works well. After they do that they open OE and everything is ready to go.. Except one thing it prompts them for there password -- normally this is no problem; however in my never ending quest to make it easy enough for a monkey I am trying to find someway to have my program also prompt for their password and then take that value and enter into the registry in the correct place. Sounds simple - but Outlook Express requires the registry value for the accounts password to be in Hex format. This is where I am stuck. I am looking for a solution or possiably other ideals to simplify this situation. I know simply sending a message telling them how to enter there password and have it save it seems simple enough, but that would create more headaches then needed.
Our client platform is Windows NT 4.0 email client is Outlook Express
Question by:garzajd
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 48

Expert Comment

ID: 6965137
1. Reading the entered ASCII string sequential you can read  every single entered character. Let us think that you
have read 'A'.
2. Now you have the select the first and the second Hex. number of the presentation of this letter.
In every programming language you can find a character function (POS or ORD or something else) with
a character parameter. It returns the number of the place  in the ASCII table on the given character.I think in C++ you can simple use the character as a digit or somehow to place it in a integer field. Let us suppose you have placed the character in in the field C.
3. To isolate the first hex. digit divide C by 16. So if C is 60 it will return 3
4. To isolate the second hex.digit use MOD function.
60 mod 16 is 12. Try to find MOD function in the library or simply emulate it by subtracting 16 from C.
5. Convert the first and the second number (from 2. and 3.) into hexadecimals. To do this use a table like
Character   Number
0           0
1           1
2           2
...        ...
9           9
a           10
b           11
c           12
d           13
e           14
f           15
You can use 2 arrays (one character, second integer).


5. Try to figure out if your programming language supports function in the libraries for direct conversion of characters
into hex. digits. This will help you to avoid some of the above steps.

There are also some links to libraries with subroutines doing this like
Try this link


Expert Comment

ID: 6965474
c++ supports hex. look up "hex" in the ios reference,
its one of those manipulator things with funny syntax like setprecision etc...

LVL 22

Expert Comment

ID: 6965618
I think they have used some algorithm. I just cannot believe that converting the text string into a hexadecimal numeric string solves the whole....

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

LVL 48

Expert Comment

ID: 6968806
I think 500 points is a typo. Please decrease the points.

Expert Comment

ID: 6969870
What language?

Author Comment

ID: 6969918
Thanks all thus far. 500 points is not a typo I need a solution . My preffered language would be in C, C++
Obviously I'm not very good at the whole programming thing, but I know the basics.
I'll play with what I have so far and see what I can come up with.. thanks

Expert Comment

ID: 6970161
If I understand you correctly you want the Hex representation of a string of ASCII characters to write to the registry. If you don't want to get involved in C++ then the following snippet will illustrate a quick and dirty method of doing the job.

#include    <stdio.h>
#include    <stdlib.h>

int main(int argc, char * argv[])
char    sz_ascii[]="12345ABCDE";
char *  ptr;
int     i,j;

     /* Find the length of the input string */
     /* Allocate memory for the output string */
     /* This will be twice the length of the output */
     /* plus 1 character for the trailing null */
     ptr=(char *)malloc((i*2)+1);
     /* Set the entire output string to nulls */
     /* For each input character place the hex */
     /* version in the output string */
     /* Print the input and out strings to show it worked */
     printf("%s - %s\n",sz_ascii,ptr);
     /* Free up the allocated memory */
     return 0;

Cheers - Gavin

Expert Comment

ID: 7299409

Expert Comment

ID: 7300663
This person has been suspended for multiple violations of the Member Agreement, and will reject the proposed answer, and return your question to the Active Questions List.  The Moderator Group is deleting all 388 locked questions.

These were posted by three persons:

Thank you,
CS Admin @ EE
LVL 54

Expert Comment

ID: 7515048

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
 - PAQ'd and pts removed
Please leave any comments here within the
next seven days.



Accepted Solution

Jgould earned 0 total points
ID: 7548117
Question has been closed as per recommendation

JGould-EE Moderator

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question