W
W
WebDiez2016-06-03 11:55:56
Visual Basic
WebDiez, 2016-06-03 11:55:56

How to make a table based password generator in VBA?

There is such an article https://habrahabr.ru/post/92033/
there is a table so I need to take the login from cell A1 and the password from B1 and generate it in C1 according to this table.
Maybe someone has some work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Fedoryan, 2016-06-03
@webdiez

Name the second sheet tableand put the table there, starting from the cell(1, 1)

Public Function Encrypt(pass As String, login As String)
    Dim PassLength As Integer
    Dim r, c, z As Integer
    Dim encrypt_str As String
    Dim ps, ls As String
    
    PassLength = 16
    encrrypt_str = ""

    For i = 0 To PassLength - 1
        ps = Mid(pass, (i Mod Len(pass)) + 1, 1)
        ls = Mid(login, (i Mod Len(login)) + 1, 1)
        
        For j = 1 To 39
            For k = 1 To 3
                If (Worksheets("table").Cells(j, k) = ps) Then
                    r = j
                    c = k
                    Exit For
                End If
            Next k
        Next j
            
        For l = 4 To 39
            If (Worksheets("table").Cells(r, l) = ls) Then
                z = l
                Exit For
            End If
        Next l
        encrrypt_str = encrrypt_str & Worksheets("table").Cells(c, z)
    Next i

    Encrypt = encrrypt_str
End Function

177cfda04e674b8895e0bf3f5468a8d6.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question