Click to See Complete Forum and Search --> : Converting
plarivesr
10-12-2003, 07:20 PM
How do I convert
- a string where the ASCII represenative of each character is concatenated together.
- then change each bit to it's opposite (ie: 1 to 0, 0to 1)
- then convert this string of bits into hexidecimal
Then reverse the procedure to retreive the original string of characters ?:confused:
I'm hoping this isn't for any security reasons (ie, password protecting, encryption, etc) as it would be simple to reverse...
plarivesr
10-13-2003, 12:56 PM
No nothing like that.
I have a project I have due this week, my mentor isn't available, and the mannual I have is of no use.:confused:
Since this sounds like it's for a school project, the most I'll do is point you in the right direction/guide you.
1: You're going to want to split (http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/string.html#1194452) the string into an array loop through the array, and replace the binary characters with their ascii equivalents.
2: use replace (http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/string.html#1194258) to replace the characters with their opposites
3: use toString (http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/object.html#1193350) and pass a radix of 16 to the function...