BASIC/Visual Basic >> Encryption....&HFF?
Posted by kpyro on 19:05:00 02-15-2002
Private Function DecryptText(strText As String, ByVal strPwd As String)
Dim i As Integer, c As Integer
Dim strBuff As String

#If Not CASE_SENSITIVE_PASSWORD Then
strPwd = UCase$(strPwd)
#End If

If Len(strPwd) Then
For i = 1 To Len(strText)
c = Asc(Mid$(strText, i, 1))
c = c - Asc(Mid$(strPwd, (i Mod Len(strPwd)) + 1, 1))
strBuff = strBuff & Chr$(c And &HFF)
Next i
Else
strBuff = strText
End If
DecryptText = strBuff
End Function


What does the &HFF part mean??
Posted by fsvara on 21:43:00 02-15-2002
i don't know any vb, but i guess &HFF is supposed to mean 255, or 11111111 in binary representation.
Posted by IbYdI on 11:29:00 02-16-2002
you would get an error if there was no &HFF since for some letters c becomes negative (but never smaller than -254) and chr$ accepts only positive values. so it keeps function errorfree. [addsig]