原型:
int WINAPI icePub_desEncryptionHex(char strInputHexstring, char strOutputHexstring, char strKeyHexstring)
输入:strInputHexstring 待加密16进制数据串,16字节长度
strKeyHexstring 单des密钥16进制串,16字节长度
输出:strOutputHexstring 加密后16进制数据串,16字节长度
原型:
int WINAPI icePub_desDecryptionHex(char strInputHexstring, char strOutputHexstring, char strKeyHexstring)
输入:strInputHexstring 待解密16进制数据串,16字节长度
strKeyHexstring 单des密钥16进制串,16字节长度
输出:strOutputHexstring 解密后16进制数据串,16字节长度
vbnet code注意随机密码按钮在没用,调试时你自己输入密码,一定为8位,我是将文件存在D盘,你自己在修改一下,那个就很简单
Imports SystemIO
Imports SystemSecurityCryptography
Imports SystemText
Public Class Form1
Private Sub Button1_Click(ByVal sender As SystemObject, ByVal e As SystemEventArgs) Handles Button1Click
Dim sSecretKey As String = MeTextBox2Text
EncryptFile(MeTextBox1Text, "D:\JMtesttxt", sSecretKey)
End Sub
Private Sub Button2_Click(ByVal sender As SystemObject, ByVal e As SystemEventArgs) Handles Button2Click
Dim sSecretKey As String = MeTextBox2Text
DecryptFile("D:\JMtesttxt", "D:\Decryptedtxt", sSecretKey)
End Sub
Sub EncryptFile(ByVal sInputFilename As String, ByVal sOutputFilename As String, ByVal sKey As String)
Dim fsInput As New FileStream(sInputFilename, FileModeOpen, FileAccessRead)
Dim fsEncrypted As New FileStream(sOutputFilename, FileModeCreate, FileAccessWrite)
Dim DES As New DESCryptoServiceProvider
DESKey = ASCIIEncodingASCIIGetBytes(sKey)
DESIV = ASCIIEncodingASCIIGetBytes(sKey)
Dim desencrypt As ICryptoTransform = DESCreateEncryptor()
Dim cryptostream As New CryptoStream(fsEncrypted, desencrypt, CryptoStreamModeWrite)
Dim byteArrayInput(fsInputLength - 1) As Byte
fsInputRead(byteArrayInput, 0, byteArrayInputLength)
cryptostreamWrite(byteArrayInput, 0, byteArrayInputLength)
cryptostreamClose()
End Sub
Sub DecryptFile(ByVal sInputFilename As String, ByVal sOutputFilename As String, ByVal sKey As String)
Dim DES As New DESCryptoServiceProvider
DESKey() = ASCIIEncodingASCIIGetBytes(sKey)
DESIV = ASCIIEncodingASCIIGetBytes(sKey)
Dim fsread As New FileStream(sInputFilename, FileModeOpen, FileAccessRead)
Dim desdecrypt As ICryptoTransform = DESCreateDecryptor
Dim cryptostreamDecr As New CryptoStream(fsread, desdecrypt, CryptoStreamModeRead)
Dim fsDecrypted As New StreamWriter(sOutputFilename)
fsDecryptedWrite(New StreamReader(cryptostreamDecr, SystemTextASCIIEncodingDefault)ReadToEnd)
fsDecryptedFlush()
fsDecryptedClose()
End Sub
Private Sub BtnChoose_Click(ByVal sender As SystemObject, ByVal e As SystemEventArgs) Handles BtnChooseClick
OpenFileDialog1FileName = ""
OpenFileDialog1Filter = "txt files (txt)|txt"
OpenFileDialog1ShowDialog()
If OpenFileDialog1FileName <> "" Then
MeTextBox1Text = OpenFileDialog1FileName
End If
End Sub
End Class
无法打开包括没有这样的文件或目录
意味着,这个计划包括错误
预编译头文件,你可以直接复制和粘贴,然后运行呢?
删除,文件可能会少点了一下头,你可以先尝试简单的程序的标准输入输出头文件中定义。
C,然后包括中
C + +,然后包括
也可能小于其他的头文件。这取决于程序还包含什么样的文件
以上就是关于DES加密算法CBC模式怎么解密最好有程序 谢谢~(*^__^*)全部的内容,包括:DES加密算法CBC模式怎么解密最好有程序 谢谢~(*^__^*)、我想做一个加密解密文件的VB程序!用des加密解密方法!!! 希望高手解答!、用VC++6.0 运行des加密程序时出错,'stdafx.h': No such file or directory求解决方法等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)