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

Hey, Arnon! What are you doing? Are you just copying my code? :)))) Just kidding.

Vlad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform