Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub ShowKey()
- Dim FirstPart, SecondPart, Valore, CL As Integer
- Static Already As Boolean, MyTable(&H26)
- If Already = False Then
- MyTable(0) = 11 : MyTable(1) = 6 : MyTable(2) = 17 : MyTable(3) = 12
- MyTable(4) = 12 : MyTable(5) = 14 : MyTable(6) = 5 : MyTable(7) = 12
- MyTable(8) = 16 : MyTable(9) = 10 : MyTable(10) = 11 : MyTable(11) = 6
- MyTable(12) = 14 : MyTable(13) = 14 : MyTable(14) = 4 : MyTable(15) = 11
- MyTable(16) = 6 : MyTable(17) = 14 : MyTable(18) = 14 : MyTable(19) = 4
- MyTable(20) = 11 : MyTable(21) = 9 : MyTable(22) = 12 : MyTable(23) = 11
- MyTable(24) = 10 : MyTable(25) = 8 : MyTable(26) = 10 : MyTable(27) = 10
- MyTable(28) = 16 : MyTable(29) = 8 : MyTable(30) = 4 : MyTable(31) = 6
- MyTable(32) = 10 : MyTable(33) = 12 : MyTable(34) = 16 : MyTable(35) = 8
- MyTable(36) = 10 : MyTable(37) = 4 : MyTable(38) = 16
- End If
- If Len(txtName.Text) < 4 Then txtSer.Text = "" : Exit Sub
- CL = 0
- For C = 4 To Len(txtName.Text)
- Valore = Asc(Mid$(txtName.Text, C, 1)) * MyTable(CL)
- FirstPart = FirstPart + Valore
- CL = CL + 1
- If CL > &H26 Then CL = 0
- Next
- CL = 0 : Valore = 0
- For C = 4 To Len(txtName.Text)
- Valore = Asc(Mid$(txtName.Text, C - 1, 1)) * Asc(Mid$(txtName.Text, C, 1))
- SecondPart = SecondPart + Valore * MyTable(CL)
- CL = CL + 1
- If CL > &H26 Then CL = 0
- Next
- txtSer.Text = LTrim$(Str$(FirstPart)) + "-" + LTrim$(Str$(SecondPart))
- End Sub
- '/ gen key
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGen.Click
- ShowKey()
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement