I use the following function to encrypt data and save it to the registry
VB Code:
  1. Public Function EncryptPassword(strPass As String) As String
  2.   Dim XOR_String As String
  3.   Dim i As Integer
  4.  
  5.   For i = 1 To Len(strPass)
  6.     XOR_String = XOR_String & Chr(Asc(Mid(strPass, i, 1)) Xor ((i * 5) Mod 256))
  7.   Next i
  8.  
  9.   EncryptPassword = XOR_String
  10. End Function
I know it is not secure, but the point was not to secure the data, just to really not make it readable and deter a user from editing the values themselves...

anyway our product has a CD key that is validated in the app using a simple algorithm. A problem was realized when a customer was able to activate with the key but then the internal function that validates it failed. Long story short, i found out that the encryption function produces odd results when certain characters are in certain locations in the string

XXXX-XXXX-7XXX-XXXX
XXXX-XXXX-XXAX-XXXX
XXXX-XXXX-XXXF-XXXX
XXXX-XXXX-XXXX-PXXX
XXXX-XXXX-XXXX-XUXX
XXXX-XXXX-XXXX-XXZX

I found this out by writing a quick program that encrypted and then decrypted each possible value and compaired it to the original string. So when the above keys have the certain char in a certain position this error occurs. I think the conversion may make it a carrage return or some unreadable character which is causing the error....

any ideas?

To test this out... pass "XXXX-XXXX-XXXF-XXXX" to the function to encrypt it and then decrypt it and compare to the original string.. it is cut off at the bad character...