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


Thanks..it helped...and it's working!! I haven't had to deal with this stuff for YEARS.

Craig
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform