Solved

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

Posted on 2002-04-23
11
329 Views
Last Modified: 2010-04-16
Hello,
 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
0
Comment
Question by:garzajd
[X]
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
11 Comments
 
LVL 48

Expert Comment

by:schwertner
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

http://www.simtel.net/pub/msdos/binaryed/
0
 
LVL 2

Expert Comment

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

0
 
LVL 22

Expert Comment

by:CJ_S
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....

CJ
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 48

Expert Comment

by:schwertner
ID: 6968806
I think 500 points is a typo. Please decrease the points.
0
 
LVL 6

Expert Comment

by:Triskelion
ID: 6969870
What language?
0
 
LVL 1

Author Comment

by:garzajd
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
0
 
LVL 4

Expert Comment

by:newmang
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 */
     i=strlen(sz_ascii);
     /* 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 */
     memset(ptr,(i*2)+1,0x00);
     /* For each input character place the hex */
     /* version in the output string */
     for(j=0;j<i;j++)
         sprintf(ptr+(j*2),"%02X",sz_ascii[j]);
     /* Print the input and out strings to show it worked */
     printf("%s - %s\n",sz_ascii,ptr);
     /* Free up the allocated memory */
     free(ptr);
     return 0;
}

Cheers - Gavin
0
 

Expert Comment

by:quirkyquirky
ID: 7299409
0
 

Expert Comment

by:ComTech
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:

quirkyquirky
EliteKiller
liloXwin
 
Thank you,
ComTech
CS Admin @ EE
0
 
LVL 54

Expert Comment

by:nico5038
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.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

Nic;o)
0
 

Accepted Solution

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

JGould-EE Moderator
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.

738 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