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.
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