Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
*** URGENT *** Bitwise XOR of character string
Message
De
29/03/1997 17:16:43
 
 
À
29/03/1997 16:21:59
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00026103
Message ID:
00026169
Vues:
35
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform