Improve company productivity with a Business Account.Sign Up


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
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....

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for 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

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
AngularJS web development a very simple procedure. So, to put it, in short, AngularJS’ stand out features are – Two-way data binding, MVC structure, directives, templates, dependency injections and testing.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Six Sigma Control Plans

608 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