标题:简单文件加解密_异惑法
只看楼主
zrf1298
Rank: 1
等 级:新手上路
威 望:1
帖 子:9
专家分:0
注 册:2013-4-4
 问题点数:0 回复次数:3 
简单文件加解密_异惑法
加解密.vbp

Type=Exe
Form=Form1.frm
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\system32\stdole2.tlb#OLE Automation
Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCTL.OCX
Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; COMDLG32.OCX
Startup="Form1"
Command32=""
Name="工程1"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName="微软中国"
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1

[MS Transaction Server]
AutoRefresh=1
---------------------------------
Form1.frm

VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1
   Caption         =   "文件加解密"
   ClientHeight    =   2025
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   7125
   LinkTopic       =   "Form1"
   ScaleHeight     =   2025
   ScaleWidth      =   7125
   StartUpPosition =   3  '窗口缺省
   Begin CommonD1
      Left            =   5640
      Top             =   1200
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin Command3
      Caption         =   "..."
      Height          =   375
      Left            =   6600
      TabIndex        =   9
      Top             =   600
      Width           =   495
   End
   Begin Command2
      Caption         =   "..."
      Height          =   375
      Left            =   6600
      TabIndex        =   8
      Top             =   120
      Width           =   495
   End
   Begin VB.TextBox PassW
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   960
      PasswordChar    =   "*"
      TabIndex        =   7
      Top             =   1080
      Width           =   2055
   End
   Begin VB.TextBox NewFile
      Height          =   375
      Left            =   960
      TabIndex        =   5
      Top             =   600
      Width           =   5535
   End
   Begin VB.TextBox OldFile
      Height          =   375
      Left            =   960
      TabIndex        =   3
      Top             =   120
      Width           =   5535
   End
   Begin MSComctlLib.ProgressBar ProgressBar1
      Height          =   255
      Left            =   0
      TabIndex        =   1
      Top             =   1680
      Width           =   7095
      _ExtentX        =   12515
      _ExtentY        =   450
      _Version        =   393216
      Appearance      =   1
   End
   Begin Command1
      Caption         =   "加/解密文件"
      Height          =   495
      Left            =   3240
      TabIndex        =   0
      Top             =   1080
      Width           =   1455
   End
   Begin VB.Label Label3
      Caption         =   "密码:"
      Height          =   255
      Left            =   360
      TabIndex        =   6
      Top             =   1200
      Width           =   495
   End
   Begin VB.Label Label2
      Caption         =   "新文件:"
      Height          =   375
      Left            =   240
      TabIndex        =   4
      Top             =   720
      Width           =   735
   End
   Begin VB.Label Label1
      Caption         =   "源文件:"
      Height          =   255
      Left            =   240
      TabIndex        =   2
      Top             =   240
      Width           =   855
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim B() As Byte
Dim PassWord As String
Dim B1() As Byte
Dim I As Long, l As Long, j As Long

Private Sub Command1_Click()
Open OldFile For Binary As #1
If LOF(1) > 0 Then
j = LOF(1)
ReDim B(LOF(1) - 1)
Get #1, , B
End If
Close #1

Dim P As Long
PassWord = PassW
l = Len(PassWord)

ReDim B1(l)
For I = 1 To l
B1(I) = Asc(Mid(PassWord, I, 1))
Next
'ProgressBar1.Max = UBound(B)
For I = 0 To UBound(B)
B(I) = B(I) Xor B1(P)
P = P + 1
'ProgressBar1.Value = I
If P > l Then P = 0
Next

Open NewFile For Binary As #1
Put #1, , B
Close #1

'ProgressBar1.Value = 0

End Sub


Private Sub Command2_Click()
CommonD1.FileName = ""
CommonD1.ShowOpen
If CommonD1.FileName = "" Then Exit Sub
OldFile = CommonD1.FileName
End Sub

Private Sub Command3_Click()
CommonD1.FileName = ""
CommonD1.ShowSave
If CommonD1.FileName = "" Then Exit Sub
NewFile = CommonD1.FileName
End Sub
搜索更多相关主题的帖子: 微软 中国 工程 
2015-09-22 20:13
xiangyue0510
Rank: 14Rank: 14Rank: 14Rank: 14
等 级:贵宾
威 望:86
帖 子:934
专家分:5244
注 册:2015-8-10
得分:0 
没明白这是分享还是要求助
不过话说,我自己电脑上一些隐秘的文件,我都是修改后缀的方式处理。简单实用
2015-09-23 13:24
zrf1298
Rank: 1
等 级:新手上路
威 望:1
帖 子:9
专家分:0
注 册:2013-4-4
得分:0 
头天来,搞错了。
这只是最简单的。你说的也对,但如果遇到有精验的不就露陷了吗?
2015-09-23 13:31
风吹过b
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:364
帖 子:4912
专家分:29900
注 册:2008-10-15
得分:0 
这是分享,里面带了二个文件 ,
一个是VBP,工程文件 。
一个是FRM,窗体文件 ,
用记事本保存对应的内容,然后按他上面的文件名和后缀保存,双击工程文件就可以看到了。
这样发分享,是不传附件情况下最完整的分享。

授人于鱼,不如授人于渔
早已停用QQ了
2015-09-24 11:34



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-457577-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017185 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved