Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Registration KEY
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00766017
Message ID:
00766022
Vues:
34
This message has been marked as a message which has helped to the initial question of the thread.
XOR operation is an interesting operation for creating encryption routines. The cool idea in XOR is that the same key can be used to encrypt and descrypt the value. For example:

XorIt( "mypassword", "akeytoencrypt" ) -> "someencryptedvalue"

then

XorIt( "someencryptedvalue", "akeytoencrypt" ) -> "mypassword

This is useful if for some reason you store the password in a text file or other easy to read type of file. In that case, you can store "someencryptedvalue" and then use that value to obtain the actual password value.
* description: Encrypts cString with value passed in cMask
* using Bit XOR operation.
*
* Bit XOR operation works like this:
* XorIt( A, B ) -> C
* XorIt( C, B ) -> A
*
* author: May/2002 - Hector Correa
* updated:
Function XorIt( cString, cMask )

	if empty( cString )
		return ""
	endif

	if empty( cMask )
		return ""
	endif

	cRetVal = ""
	nLenght = LEN( cString )
	cMask = padr( cMask, nLenght, "#" )

	FOR i=1 TO nLenght
		nChar = ASC( SUBSTR( cString, i, 1 ) )
		nKeyChar = ASC( SUBSTR( cMask, i, 1 ) )
		nNewChar = BITXOR( nChar, nKeyChar )
		cRetVal = cRetVal + CHR( nNewChar )
	NEXT

RETURN cRetVal
>I've created a registration KEY to protect my software
>
> As below for every name it will be key to allow
> the software to work
>
> Name: JOHN MEDEIROS
> Key: TFGC 1234ER96
>
> I am using STRAN funcition to create this
> However I think it's very obvious as every
> letter corresponds to another letter
>
> Anybody has a better suggestions to create a more
> complex hey ?
>
> Moisse
>
>
>
>
>
>
>
Hector Correa
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform