Advertisement
Guest User

Untitled

a guest
May 25th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.90 KB | None | 0 0
  1.     Private Sub ShowKey()
  2.  
  3.         Dim FirstPart, SecondPart, Valore, CL As Integer
  4.  
  5.  
  6.  
  7.         Static Already As Boolean, MyTable(&H26)
  8.  
  9.         If Already = False Then
  10.  
  11.             MyTable(0) = 11 : MyTable(1) = 6 : MyTable(2) = 17 : MyTable(3) = 12
  12.  
  13.             MyTable(4) = 12 : MyTable(5) = 14 : MyTable(6) = 5 : MyTable(7) = 12
  14.  
  15.             MyTable(8) = 16 : MyTable(9) = 10 : MyTable(10) = 11 : MyTable(11) = 6
  16.  
  17.             MyTable(12) = 14 : MyTable(13) = 14 : MyTable(14) = 4 : MyTable(15) = 11
  18.  
  19.             MyTable(16) = 6 : MyTable(17) = 14 : MyTable(18) = 14 : MyTable(19) = 4
  20.  
  21.             MyTable(20) = 11 : MyTable(21) = 9 : MyTable(22) = 12 : MyTable(23) = 11
  22.  
  23.             MyTable(24) = 10 : MyTable(25) = 8 : MyTable(26) = 10 : MyTable(27) = 10
  24.  
  25.             MyTable(28) = 16 : MyTable(29) = 8 : MyTable(30) = 4 : MyTable(31) = 6
  26.  
  27.             MyTable(32) = 10 : MyTable(33) = 12 : MyTable(34) = 16 : MyTable(35) = 8
  28.  
  29.             MyTable(36) = 10 : MyTable(37) = 4 : MyTable(38) = 16
  30.  
  31.         End If
  32.  
  33.         If Len(txtName.Text) < 4 Then txtSer.Text = "" : Exit Sub
  34.  
  35.         CL = 0
  36.  
  37.         For C = 4 To Len(txtName.Text)
  38.  
  39.             Valore = Asc(Mid$(txtName.Text, C, 1)) * MyTable(CL)
  40.  
  41.             FirstPart = FirstPart + Valore
  42.  
  43.             CL = CL + 1
  44.  
  45.             If CL > &H26 Then CL = 0
  46.  
  47.         Next
  48.  
  49.         CL = 0 : Valore = 0
  50.  
  51.         For C = 4 To Len(txtName.Text)
  52.  
  53.             Valore = Asc(Mid$(txtName.Text, C - 1, 1)) * Asc(Mid$(txtName.Text, C, 1))
  54.  
  55.             SecondPart = SecondPart + Valore * MyTable(CL)
  56.  
  57.             CL = CL + 1
  58.  
  59.             If CL > &H26 Then CL = 0
  60.  
  61.         Next
  62.  
  63.         txtSer.Text = LTrim$(Str$(FirstPart)) + "-" + LTrim$(Str$(SecondPart))
  64.  
  65.     End Sub
  66.  
  67.  
  68.  
  69.     '/ gen key
  70.  
  71.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGen.Click
  72.  
  73.         ShowKey()
  74.  
  75.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement