I'm more a JScript person myself, but a few general concepts:

XOR'ing ASCII string characters will not give you anything useful.  To make it 
more difficult, the numbers and letters of a HEX string, in their ASCII values, 
do not form a consecutive sequence.  Nor are the A-F characters even in the 
right part of the ASCII sequence (being 1-6 rather than an 0-5 which might at 
least have been a bit useful).  And, also, you've got upper/lower case A-F a-f 
to contend with.

You've got to transform them before you can use them, then put them back so you 
can display them.  An easy way to do this is to have two functions: one takes a 
single character as a parameter and returns an integer 0-15, the other does the 
reverse.

You'll then need to loop through both strings and convert each character 
(nibble).  You can store the resultant integer values of the nibbles in many 
different ways, although I suspect that an array of integers might be best, 
with each nibble occupying its own spot in the array.

Once you've converted the two strings, you can buzz through the integer arrays 
with a FOR loop and XOR each of the nibbles, either creating a third array or 
going directly back to ASCII characters from the resultant nibble.

How you do the conversion from ASCII to/from integer depends on what you know 
so far.  A "select case" statement is a good candidate for converting from 
ASCII, however, as it allows you to handle the whole thing (upper/lower case, 
illegal characters) in one go.  A "select case" could also be used to convert 
back to ASCII, although an indexed lookup from an array or string of HEX 
characters will also work fine.

Dave S

  ----- Original Message ----- 
  From: Venkatesh Thathathripuram 
  To: [EMAIL PROTECTED] 
  Sent: Sunday, November 07, 2004 10:02 AM
  Subject: [ASP] URGENT VB QUESTION


  hey,


      I need help in XOR'ing two HEX values.

  I have two textboxes to take HEX strings , like
  AAAA5555AAAA5555 and 5555AAAA5555AAAA, I need to get
  the XOR value of the two which would be FFFFFFFFFFFFF

  I am a newbie and have problems handling strings in
  VB. Plz help. The output would be bytes like in a
  scientific calculatore in Accessories.

  Any help would be greatly appreciated,thanks.


  ---
  Outgoing mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.788 / Virus Database: 533 - Release Date: 1/11/04

[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/17folB/TM
--------------------------------------------------------------------~-> 

---------------------------------------------------------------------    
 Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
 Post       : [EMAIL PROTECTED]
 Subscribe  : [EMAIL PROTECTED]
 Unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/active-server-pages/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to