📄 formfile1.frm
字号:
Dim y, x, n As Long
Dim store(9999), mtp, temp, flmt, disp(15), t, rvf(15), res, pcnt, suma(15) As Long
Dim pow(15), ch(14), a, c, il, cnt, j, jp, kt, lt, L, j1, ic, jc As Long
Dim op, t2 As String
Dim gt(15), rv(15), lent, chlen, dval As Integer
Dim gate, fin As Boolean
Dim Fname As Variant
Private Sub cmdGetYourKey_Click()
Load frmdecrypt
End Sub
Private Sub Command1_Click()
Dim FileName10 As String
Dim FName_Only As String
Dim delay As Long
Dim lengthoftext1, lengthoftext2 As String, i, j, ab, cd, q, g As Integer
lengthoftext1 = Len(Text1)
i = 20 - lengthoftext1
Text3 = Text1
For j = 1 To i
Text3 = Text3 + "_"
Next j
lengthoftext2 = Len(Text2)
ab = 20 - lengthoftext2
Text4 = Text2
For cd = 1 To ab
Text4 = Text4 + "_"
Next cd
txtFileName = Text3 + Text4 + getFinKey
If cont = False Then
While (chkA = False)
tstA = False
Randomize
GetRndA = Rnd() * 100
RndValA = Round(GetRndA, 1)
For indexA = 2 To RndValA - 1
primeA = RndValA Mod indexA
If (primeA = 0) Then
tstA = True
End If
Next indexA
If (tstA = False) Then
If RndValA <= 2 Then
Else
PRIME1 = Round(RndValA, 0)
chkA = True
End If
End If
Wend
While (chkB = False)
tstB = False
Randomize
GetRndB = Rnd() * 100
RndValB = Round(GetRndB, 1)
For indexB = 2 To RndValB - 1
primeB = RndValB Mod indexB
If (primeB = 0) Then
tstB = True
End If
Next indexB
If (tstB = False) Then
If RndValB <= 2 Then
Else
PRIME2 = Round(RndValB, 0)
chkB = True
End If
End If
Wend
If (PRIME1 = PRIME2) Then
ElseIf (PRIME1 <= 2) Then
ElseIf (PRIME2 <= 2) Then
Else
cont = True
End If
End If
PROD = PRIME1 * PRIME2
PHIE = (PRIME1 - 1) * (PRIME2 - 1)
cont = False
For i1 = 2 To (PHIE - 1)
If cont = False Then
a1 = PHIE Mod i1
If a1 = 0 Then
Else
PUBLICKEY = i1
cont = True
End If
End If
Next i1
cont = False
For q = 1 To 100000
If cont = False Then
If ((PUBLICKEY * q) Mod PHIE) = 1 Then
SECRETKEY = q
cont = True
End If
End If
Next q
lin = txtFileName.Text
dsize = Len(lin)
If dsize > 0 Then
ReDim pdata(1 To dsize)
Else
ReDim pdata(i)
End If
linefeed = ""
i = 1
Do Until i = dsize + 1
pdata(i) = Mid(lin, i, 1)
i = i + 1
Loop
For i = 1 To dsize
adata(i) = Asc(pdata(i))
Next i
Open App.Path & "\" & "1_enuserdata.txt" For Output As #1
For jval = 1 To dsize
x = adata(jval)
y = PUBLICKEY
n = PROD
Powers
CIPHER = res
Print #1, CIPHER
Next jval
Close #1
Open App.Path & "\" & "1_enuserdata.txt" For Append As #1
Print #1, "," + CStr(SECRETKEY) + "," + CStr(PROD) + "end" + filenumb
Close #1
FileName10 = App.Path & "\" & "1_enuserdata.txt"
For delay = 0 To 100000
Next delay
For delay = 0 To 100000
Next delay
For delay = 0 To 100000
Next delay
frmClient.txtFileName = FileName10
If frmClient.txtFileName = "" Then
MsgBox "No file selected to send...", vbCritical
Else
If frmWsk.tcpClient.State <> sckClosed Then
FName_Only$ = GetFileName(frmClient.txtFileName)
SendFile FName_Only$
End If
End If
End Sub
Private Sub Form_Load()
Labelfile11(1).Visible = False
Label5.Visible = False
Labelfile1.Visible = False
Labelfile2.Visible = False
Labelfile3.Visible = False
Labelfile4.Visible = False
Labelfile5.Visible = False
Labelfile6.Visible = False
Labelfile7.Visible = False
Labelfile8.Visible = False
Labelfile9.Visible = False
Labelfile10.Visible = False
Labelfile12.Visible = False
Labelfile13.Visible = False
Labelfile14.Visible = False
Labelfile15.Visible = False
Labelfile16.Visible = False
Labelfile17.Visible = False
Labelfile18.Visible = False
Labelfile19.Visible = False
cmdGetYourKey.Visible = False
txtdispKey.Visible = False
Command1.Visible = False
Load frmClient
End Sub
Private Sub Powers()
t2 = ""
a = y
Do While a >= 2
c = a Mod 2
a = Fix(a / 2)
t2 = t2 & c
Loop
t2 = t2 & a
op = StrReverse(t2)
a = 1
Do While (gate = False)
c = Mid$(op, a, 1)
gt(a) = c
If (c <> 1 And c <> 0) Then
gate = True
End If
cnt = a
a = a + 1
Loop
lent = cnt - 1
a = 1
For c = lent To 1 Step -1
rv(a) = gt(c)
a = a + 1
Next c
L = 2
j = 1
kt = 2
pow(1) = rv(1)
ch(1) = pow(1)
lt = 2
chlen = 1
Do While (lt <= lent)
pow(j + 1) = rv(kt) * 2 ^ j
ch(L) = pow(j + 1)
chlen = chlen + 1
j = j + 1
kt = kt + 1
L = L + 1
lt = lt + 1
Loop
store(1) = x Mod n
temp = store(1)
disp(1) = temp
mtp = 2
flmt = 1
t = 2
Do While ((flmt / 2) <= Val(y))
store(mtp) = (temp ^ 2) Mod n
temp = store(mtp)
disp(t) = (store(mtp))
mtp = mtp * 2
flmt = mtp * 2
t = t + 1
Loop
i1 = 1
j1 = 2
rvf(1) = pow(1)
Do While (i1 < 15)
If ch(i1) <> 0 Then
rvf(j1) = ch(i1)
j1 = j1 + 1
End If
i1 = i1 + 1
Loop
pcnt = 1
jc = 1
For ic = 1 To chlen
If ch(ic) <> 0 Then
suma(jc) = (disp(ic))
pcnt = pcnt + 1
jc = jc + 1
End If
Next ic
res = 1
Dim q1 As Integer
res = (suma(1) * suma(2)) Mod n
For q1 = 2 To (pcnt - 2)
res = (res * suma(q1 + 1)) Mod n
Next q1
End Sub
Private Sub getFinKey_Click()
MsgBox "Place your finger on scanner and click ok"
Mainform.FpLibXCapture2_Click (0)
MsgBox "Click ok after your finger is scanned"
End Sub
Private Sub Labelfile1_Click()
filenumb = "01"
txtfilenumber = filenumb
End Sub
Private Sub Labelfile10_Click()
filenumb = "10"
txtfilenumber = filenumb
End Sub
Private Sub Labelfile2_Click()
filenumb = "02"
txtfilenumber = filenumb
End Sub
Private Sub Labelfile3_Click()
filenumb = "03"
txtfilenumber = filenumb
End Sub
Private Sub Labelfile4_Click()
filenumb = "04"
txtfilenumber = filenumb
End Sub
Private Sub Labelfile5_Click()
filenumb = "05"
txtfilenumber = filenumb
End Sub
Private Sub Labelfile6_Click()
filenumb = "06"
txtfilenumber = filenumb
End Sub
Private Sub Labelfile7_Click()
filenumb = "07"
txtfilenumber = filenumb
End Sub
Private Sub Labelfile8_Click()
filenumb = "08"
txtfilenumber = filenumb
End Sub
Private Sub Labelfile9_Click()
filenumb = "09"
txtfilenumber = filenumb
End Sub
Private Sub Login_Click()
Dim t1, t2, f As String
t1 = Text1.Text
t2 = Text2.Text
f = getFinKey.Text
If t1 = "" And t2 = "" And f = "" Then
MsgBox "Please Enter The Details"
Else
Login.Visible = False
Labelfile11(1).Visible = True
Labelfile11(0).Visible = False
Label5 = Text1
Label5.Visible = True
Label1(4).Visible = False
Label2(0).Visible = False
Label4.Visible = False
Text1.Visible = False
Text2.Visible = False
getFinKey.Visible = False
lblWarning.Visible = False
Labelfile1.Visible = True
Labelfile2.Visible = True
Labelfile3.Visible = True
Labelfile4.Visible = True
Labelfile5.Visible = True
Labelfile6.Visible = True
Labelfile7.Visible = True
Labelfile8.Visible = True
Labelfile9.Visible = True
Labelfile10.Visible = True
Labelfile12.Visible = True
Labelfile13.Visible = True
Labelfile14.Visible = True
Labelfile15.Visible = True
Labelfile16.Visible = True
Labelfile17.Visible = True
Labelfile18.Visible = True
Labelfile19.Visible = True
cmdGetYourKey.Visible = True
txtdispKey.Visible = True
Command1.Visible = True
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -