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

Reply via email to