導航:首頁 > 文檔加密 > vb給加密

vb給加密

發布時間:2022-01-29 23:33:39

① vb源代碼如何加密

簡單點:
保存後將文件的後綴名改為如jpg,BMP之類的,別人不知道以為是圖片,打開打不開。

復雜點:
壓縮或加密軟體,如WINRAR,加密碼壓縮,壓縮後刪除源文件;
如XX加密器,通過加密器加密文件,加密後文件不用原來的密碼根本打不開。

② 怎樣給VB程序加密

讀別人的源代碼本來就不太容易。你既然要開源給對方,又不想讓讓人家更不容易讀懂,建議這樣做:
用批量替換的方法,把變數、常量、自定義函數、子程序、數組、控制項的名稱全部改成無意義的
比如,你可能會用
pananniannin
來表示判斷年齡子程序,用
age來表示年齡變數,現在統一把
pananninanin來替換成
fmcc,把age
替換成
xyz.
自己則記下這個工程各名稱的含義,我想,讓他一方面要主動性懂程序,一方面還要推測你某個具體變更的含義,進而進一步了解程序的含義,就夠讓對方抓狂一陣子了

③ 如何對自己的VB程序加密

這樣的話你就放心吧,別人不會得到你的源代碼的。得到的是匯編語言。這樣哪怕你再會加密也不可能連匯編碼都不生成。所以說不用加密的。
而你如果真的用vb來編寫賣錢的軟體么,可以用注冊碼加密的方法。這樣的話就看你的加密演算法怎麼樣了。一般用md5就可以了

④ vb中的加密問題

實際很簡單,你只須把每個字母對應的ASCII碼拿出來做運算,就可以得到密文,解密的原理也是一樣,如A的ASCII為65 那就把65拿 加上5,然後再還原成ASCII中對應的碼,顯示出來就是「F」。解密時,只須把「F」轉換成ASCII為70,-5就等於65。顯示出來就是「A」了。這是比較基本的方式,加密還有很多很多方法

⑤ vb 數字加密代碼

Dima(4)
b=Val(text1)
Fori=1To4
a(i)=(Int(b/10^(4-i))+7)mod10
Next
text2=a(4)*1000+a(3)*100+a(2)*10+a(1)

⑥ 怎樣用VB給文件夾進行密碼加密

文件或文件夾的加密、解密

'此方法對 WinXP 系統有效,Win98 沒試驗過。小心:不能用於系統文件或文件夾,否則會使系統癱瘓。
'加密:利用 API 函數在文件或文件夾名稱末尾添上字元「..\」。比如,將文件夾「MyPath」更名為「MyPath..\」,在我的電腦中顯示的名稱就是「MyPath.」。系統會無法識別,此文件或文件夾就無法打開和修改,也無法刪除。著名的病毒 Autorun 就是玩的這個小把戲。
'解密:去掉文件或文件夾名稱末尾的字元「..\」

'將以下代碼復制到 VB 的窗體代碼窗口即可
'例子需控制項:Command1、Command2、Text1,均採用默認屬性設置
Private Const MAX_PATH = 260
Private Type FileTime ' 8 Bytes
LTime As Long
HTime As Long
End Type
Private Type Win32_Find_Data
dwFileAttributes As Long
ftCreationTime As FileTime
ftLastAccessTime As FileTime
ftLastWriteTime As FileTime
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cNameFile As String * MAX_PATH
cAlternate As String * 14
End Type
Private Declare Function MoveFileEx Lib "kernel32" Alias "MoveFileExA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal dwFlags As Long) As Long
Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
Private Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpNameFile As String, lpFindFileData As Win32_Find_Data) As Long
Private Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (ByVal hFindFile As Long, lpFindFileData As Win32_Find_Data) As Long
Private Declare Function FindClose Lib "kernel32" (ByVal hFindFile As Long) As Long
Private Sub Form_Load()
Text1.Text = "C:\MyPath"
Command1.Caption = "解密": Command2.Caption = "加密"
Me.Caption = "目錄或文件的加解密"
End Sub
Private Sub Command1_Click()
Call SetPathName(False) '解密
End Sub
Private Sub Command2_Click()
Call SetPathName(True) '加密
End Sub
Private Sub SetPathName(SetMi As Boolean)
Dim nName As String, NewName As String, nSort As String, nCap As String, dl As Long
nName = Trim(Text1.Text)
If Right(nName, 3) = "..\" Then nName = Left(nName, Len(nName) - 3)
If Right(nName, 1) = "\" Then nName = Left(nName, Len(nName) - 1)
If SetMi Then
NewName = nName & "..\"
Else
NewName = nName
nName = nName & "..\"
End If
If SetMi Then nCap = "加密" Else nCap = "解密"
nSort = GetShortName(nName) '轉變其中的 ..\
If nSort = "" Then
MsgBox "文件沒有找到:" & vbCrLf & nName, vbCritical, nCap
Exit Sub
End If
If MoveFileEx(nSort, NewName, 0) = 0 Then Exit Sub '文件更名:非零表示成功,支持只讀文件
MsgBox nCap & "成功:" & vbCrLf & nName, vbInformation, nCap
End Sub
Public Function GetShortName(F As String, Optional ShortAll As Boolean) As String
'轉變為短文件名,如果目錄或文件不存在就返回空。可用於判斷某目錄或文件是否存在
'不能直接用 API 函數 GetShortPathName, 因它不支持 ..\
'ShortAll=T 表示全部轉變為短名稱,否則只轉變其中的點點杠「..\」
Dim FondID As Long, ID1 As Long, S As Long, nPath As String
Dim nF As String, InfoF As Win32_Find_Data, qF As String, hF As String
Dim nName As String, nName1 As String

nF = F
Do
S = InStr(nF, "..\")
If S = 0 Then Exit Do
qF = Left(nF, S + 2): hF = Mid(nF, S + 3) '分為前後兩部分
CutPathName qF, nPath, nName
nName = LCase(nName)
qF = nPath & "\" & "*."
FondID = FindFirstFile(qF, InfoF) '-1表示失敗。查找所有文件(夾)
ID1 = FondID
Do
If FondID = Find_Err Or ID1 = 0 Then GoTo Exit1 '沒有找到符合條件的條目

nName1 = LCase(CutChr0(InfoF.cNameFile)) '文件(夾)名稱
If nName1 & ".\" = nName Then
nName1 = CutChr0(InfoF.cAlternate) '用短文件名代替
If hF = "" Then nF = nPath & "\" & nName1 Else nF = nPath & "\" & nName1 & "\" & hF
Exit Do
End If
ID1 = FindNextFile(FondID, InfoF) '查找下一個,0表示失敗
Loop
FindClose FondID
Loop

Exit1:
FindClose FondID

S = MAX_PATH: nName = String(S, vbNullChar)
ID1 = GetShortPathName(nF, nName, S) '返回實際位元組數,0表示失敗
If ID1 = 0 Then Exit Function

If ShortAll Then
If ID1 > S Then
S = ID1: nName = String(S, vbNullChar)
ID1 = GetShortPathName(nF, nName, S) '返回實際位元組數
End If
GetShortName = CutChr0(nName)
Else
GetShortName = nF
End If
End Function
Public Sub CutPathName(ByVal F As String, nPath As String, nName As String)
Dim I As Long, LenS As Long

LenS = Len(F)
For I = LenS - 1 To 2 Step -1
If Mid(F, I, 1) = "\" Then
nPath = Left(F, I - 1): nName = Mid(F, I + 1)
GoTo Exit1
End If
Next
nPath = F: nName = ""

Exit1:

If Right(nPath, 2) = ".." Then
nPath = nPath & "\"
Else
If Right(nPath, 1) = "\" Then nPath = Left(nPath, Len(nPath) - 1)
End If

If Right(nName, 1) = "\" And Right(nName, 3) <> "..\" Then nName = Left(nName, Len(nName) - 1)
End Sub
Private Function CutChr0(xx As String) As String
Dim S As Long
S = InStr(xx, vbNullChar)
If S > 0 Then CutChr0 = Left(xx, S - 1) Else CutChr0 = xx
End Function
'參考資料見下

⑦ vb 加密字元串的方法

PrivateSubCommand1_Click()'加密
Dimb()AsByte,iAsLong
Open"d:1.txt"ForBinaryAs#1
b=InputB(LOF(1),#1)
Close#1
Randomize
Fori=0ToUBound(b)-1
b(i)=b(i)Xorb(i+1)
Next
b(i)=b(i)Xor93
Open"d:2.txt"ForBinaryAs#1
Put#1,,b
Close#1
MsgBox"1.txt已加密為2.txt"
EndSub

PrivateSubCommand2_Click()'解密
Dimb()AsByte,iAsLong
Open"d:2.txt"ForBinaryAs#1
b=InputB(LOF(1),#1)
Close#1
Randomize
b(UBound(b))=b(UBound(b))Xor93
Fori=UBound(b)-1To0Step-1
b(i)=b(i)Xorb(i+1)
Next
Open"d:3.txt"ForBinaryAs#1
Put#1,,b
Close#1
MsgBox"2.txt已解密為3.txt"
EndSub

1.txt加密後存為2.txt

2.txt解密後存為3.txt

請注意,這個程序是可以加密解密任何文件的(包括exe可執行文件),不單單是文本文件。

⑧ 怎樣用vb程序給程序加密!!!

dim a as string
sub form_load
a=""'在""中輸入正確密碼
if not(inputbox("請輸入密碼")=a) then end
'……
'我也無法理解此代碼,抄書的。
end sub

⑨ VB如何給源代碼加密

把函數封裝到DLL里 直接加密不了 用記事本都能看VB源代碼

⑩ 使用VB做出加密,密鑰和解密

下面代碼稍加修改就成。
Private Sub Command1_Click()
Dim a As String
Dim b As String
a = Text3
For i = 1 To Len(a)
b = b & JiaMi(Mid(a, i, 1))
Next i
Text2 = b
a = Text2
b = ""
For i = 1 To Len(a)
b = b & JiaMi(Mid(a, i, 1))
Next i
Text1 = b
End Sub
Private Function JiaMi(a As String) As String
Dim IntAsc As Integer
IntAsc = Asc(a)
If IntAsc Mod 2 Then
IntAsc = IntAsc + 47
If IntAsc > 126 Then IntAsc = IntAsc - 47
Else
IntAsc = IntAsc - 47
If IntAsc < 33 Then IntAsc = IntAsc + 47
End If
JiaMi = Chr(IntAsc)
End Function

閱讀全文

與vb給加密相關的資料

熱點內容
半夜解壓有什麼壞處 瀏覽:424
linux代理命令 瀏覽:637
調用tasking的編譯器編譯 瀏覽:292
青檸app是什麼 瀏覽:866
linuxapachephp56 瀏覽:395
安卓手機如何打開eng文件 瀏覽:22
看拉丁電視都用什麼app好 瀏覽:778
什麼是哲學pdf 瀏覽:508
hdfs的三個下載命令 瀏覽:523
java常用的排序演算法 瀏覽:357
51單片機連接adc 瀏覽:859
python命名變數報錯 瀏覽:120
安卓手機如何換windows系統 瀏覽:612
python中的類是什麼 瀏覽:631
我的英雄學院用哪個app可以看 瀏覽:36
excel插入選項卡對象命令 瀏覽:693
python字元全排列 瀏覽:505
824頁大瓜文件pdf 瀏覽:222
朔州ios源碼 瀏覽:251
演算法邏輯電路 瀏覽:943