VERSION 5.00
Begin VB.Form MainFrm
BorderStyle =
1 'Fixed Single
Caption = "ScreenCatpure3.0序號產生器"
ClientHeight = 1830
ClientLeft
= 45
ClientTop = 330
ClientWidth = 4845
Icon
= "MainFrm.frx":0000
LinkTopic
= "Form1"
LockControls = -1
'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight
= 1830
ScaleWidth = 4845
StartUpPosition = 2 '螢幕中心
Begin VB.CommandButton
Exit
Caption = "退出"
Height = 375
Left =
2565
TabIndex = 5
Top = 1260
Width = 1635
End
Begin VB.CommandButton Go
Caption = "我的註冊碼"
Height
= 375
Left
= 405
TabIndex
= 4
Top
= 1260
Width
= 1590
End
Begin VB.TextBox
OutNum
Height =
375
Left =
1530
Locked =
-1 'True
TabIndex =
3
Top =
630
Width =
2985
End
Begin VB.TextBox UserNum
Height = 375
Left = 1530
MaxLength = 19
TabIndex
= 1
Top
= 90
Width
= 2985
End
Begin VB.Label Label2
Caption = "你的註冊碼是:"
Height = 285
Left = 180
TabIndex = 2
Top = 720
Width = 1320
End
Begin VB.Label Label1
Caption
= "請輸入使用者號:"
Height
= 285
Left
= 180
TabIndex
= 0
Top
= 180
Width
= 1320
End
End
Attribute VB_Name
= "MainFrm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable
= False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Ebp1(1 To 16) As Long '密碼錶1
Dim Ebp2(1
To 16) As Long '密碼錶2
Private Sub Exit_Click()
End
End Sub
Private Sub Go_Click()
Dim n, al As
Integer
Dim ebx As Long
Dim Sn(1 To 16)
As Long '生成的註冊碼
Dim StrSn As String '用於把註冊碼變成字串
StrSn = ""
ebx = 0
If Mid(UserNum.Text, 5, 1) <> "-" Or Mid(UserNum.Text,
10, 1) <> "-" Or Mid(UserNum.Text, 15, 1) <> "-" Then
MsgBox "你的使用者號不正確,請重新輸入!!", vbCritical
UserNum.Text = ""
Exit Sub
End If
If Len(UserNum.Text)
= &H13 Then
CreatEbp1 UserNum.Text
'根據使用者號生成表1
'表1的後8位依次加0至7,然後再分別平方,累加後存在ebx中
For n = 1 To
8
ebx = ebx + (Ebp1(n) + Ebp1(n
+ 8) + n - 1) * (Ebp1(n) + Ebp1(n + 8) + n - 1)
Next n
CreatEbp2
'生成表2
'利用表1和表2,根據下列算式得出註冊碼
For n = 1
To 16
al = (((n * n + Ebp1(n))
* ebx) And &HFF) + Ebp2(n)
al = al Mod &H1A
Sn(n) = al
+ &H41
StrSn = StrSn + Chr(Sn(n))
Next n
End If
'用“-”把註冊碼四位一組分開,顯示出來
OutNum.Text
= Mid(StrSn, 1, 4) + "-" + Mid(StrSn, 5, 4) + "-" + Mid(StrSn, 9, 4) + "-" + Mid(StrSn,
13, 4)
End Sub
Private Sub UserNum_Change()
UserNum.Text = UCase(UserNum.Text)
End Sub
'根據使用者號生成一個16個元素的序列表1
Private Sub CreatEbp1(strUserNum As String)
Dim esi, ebp
As Long
Dim i, j As Integer
Dim intEdi(0
To 3), intTemp(1 To 16) As Long
'一個程式中用到的金鑰:SC30
intEdi(0) = Asc("S")
intEdi(1) = Asc("C")
intEdi(2) = Asc("3")
intEdi(3) = Asc("0")
j = 0
'去掉使用者號中的"-"號,形成一個16個元素的字串
For i = 1 To &H13
If Mid(strUserNum, i, 1) <> "-" Then
j = j + 1
intTemp(j) = Asc(Mid(strUserNum, i, 1)) '程式中是用的字元的ASCII碼來做運算的
End If
'這裡就直接把使用者號轉成ASCII
Next i
For i = 1 To 4 '使用者號的前四位與“SC30”的ASCII分別相加
intTemp(i) = intTemp(i) + intEdi(i - 1)
Next i
j = 0
For i = 1 To 16 Step 2 '把此時的使用者號的奇數位存在表1的前8位中
j = j + 1
Ebp1(j) = intTemp(i)
Next i
j = 8
For
i = 2 To 16 Step 2 '把此時的使用者號的偶數位存在表1的後8位中
j = j + 1
Ebp1(j) = intTemp(i)
Next i
End Sub
'生成一個通用16個元素的序列表2,每個使用者的都一樣
Private Sub
CreatEbp2()
Dim eax, ecx, edi As Long
eax = &H2 '兩個固定的常量
ecx
= &HF24
again:
edi = eax + 2
edi
= edi * eax + ecx
Ebp2(eax - 1) = edi
ecx
= ecx + &HE4
eax = eax + 1
edi = eax
- 2
If edi < &H10 Then GoTo again
End Sub