Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
*** URGENT *** Bitwise XOR of character string
Message
From
29/03/1997 17:16:43
 
 
To
29/03/1997 16:21:59
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00026103
Message ID:
00026169
Views:
38
>OK..here's what I need to do; > >Given a string, say "Bullwinkle The Moose", I need to do an XOR of the >first two characters, then take that result and do an XOR with it on the >next character, and so on until the last character....I've been told by my >client that the result will be ONE byte long???? HELP!!
procedure XORStr
LPARAMETER tcString
local i,lnLength,lcRetVal,lnTemp
lnLength=LEN(tcSting)
*-*  bitxor works with numbers so we will use the ASCII value oc each char
lnTemp=ASC(LEFT(tcString,1))
FOR i=2 to lnLength
    lnTemp=BitXOR(lnTemp,ASC(substr(tcString,i,1)))
ENDFOR
lcRetVal=chr(lnTemp)
RETURN lcRetVal
Arnon
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform