--- In [email protected], appu kandan <[EMAIL PROTECTED]> wrote: > > Hi , > ÃÂ > i needÃÂ delphi7 code to below VB code.importent i highlight some codeing i need .ÃÂ > ÃÂ > Public Function LongPassword(sLUserName As String) As String > ÃÂ Const KEY_TEXT As String = "PasswordGeneratorForIntreBOS" > ÃÂ ÃÂ ÃÂ Const KEY_OFFSET As Long = 1 > ÃÂ ÃÂ ÃÂ > ÃÂ ÃÂ ÃÂ Dim bytKey() As Byte > ÃÂ ÃÂ ÃÂ Dim bytData() As Byte > ÃÂ ÃÂ ÃÂ Dim lNum As Long > ÃÂ ÃÂ ÃÂ Dim sKey As String > ÃÂ ÃÂ ÃÂ Dim lCharCode As Long > ÃÂ ÃÂ ÃÂ > ÃÂ ÃÂ ÃÂ Dim sTemp As String > ÃÂ ÃÂ ÃÂ For lNum = 1 To ((Len(sLUserName) \ Len(KEY_TEXT)) + 1) > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ sKey = sKey & KEY_TEXT > ÃÂ ÃÂ ÃÂ Next lNum > ÃÂ ÃÂ ÃÂ bytKey = Left(sKey, Len(sLUserName))
The above creates a string as long as slusername containing replications of key_text ... then shortens by removing characters from the right it so that it is the same length > ÃÂ ÃÂ ÃÂ bytData = sLUserName > ÃÂ ÃÂ ÃÂ For lNum = LBound(bytData) To UBound(bytData) > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ If lNum Mod 2 Then For each character in the input string Xor it with the corresponding key character and add or subtract 1 as approproate (alternate addition and subtraction as you go down the string ... not sure if the first is addition or subtraction) > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ bytData(lNum) = bytData(lNum) > Xor bytKey (lNum) + KEY_OFFSET > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ Else > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ bytData(lNum) = bytData(lNum) > Xor bytKey (lNum) - KEY_OFFSET > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ End If > ÃÂ ÃÂ ÃÂ Next lNum > ÃÂ ÃÂ ÃÂ LongPassword = bytData > ÃÂ ÃÂ ÃÂ > ÃÂ ÃÂ ÃÂ For lNum = 1 To Len(LongPassword) For each char in the string less than '0' convert to '0', greater than '9' and less than 'A' convert to '9', greater than 'Z' and less than 'a' convert to 'Z', greater than 'z' convert to 'z' ... otherwise leave unchanged. > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ lCharCode = Asc(Mid(LongPassword, lNum, 1)) > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ If lCharCode < 48 Then > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ lCharCode = 48 > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ElseIf lCharCode > 57 And lCharCode < 65 Then > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ lCharCode = 57 > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ElseIf lCharCode > 90 And lCharCode < 97 Then > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ lCharCode = 97 > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ElseIf lCharCode > 122 Then > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ lCharCode = 122 > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ End If > ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ sTemp = sTemp & Chr(lCharCode) > ÃÂ ÃÂ ÃÂ Next lNum > ÃÂ ÃÂ ÃÂ '-- Vinay > ÃÂ ÃÂ ÃÂ '-- 07/29/02 > ÃÂ ÃÂ ÃÂ '-- Fix 5213, added 1 to the generated password > ÃÂ ÃÂ ÃÂ LongPassword = sTemp & Chr(49)End Function I hope that sufficently explains what is done ... A

