我们专注攀枝花网站设计 攀枝花网站制作 攀枝花网站建设
成都网站建设公司服务热线:400-028-6601

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

vb点虐 加密类 vbs加密仍可执行和解密

用VB点虐 编写一个加密解密软件

"采用DES算法"这个说法不明确,首先是使用多少位的DES进行加密,通常是128位或192位,其次是,要先把主密钥转化成散列,才能供DES进行加密,转化的方法是什么没有明确,通常是md5,所以有的银行卡说是128位md5 3DS就是指用md5转换主密钥散列,用DES进行加密,但是DES本身是64位(包含校验码),2DES是128位,3DES是192位,但是没有2DES的叫法,所以128位、192位统称3DES

公司主营业务:网站设计制作、网站建设、移动网站开发等业务。帮助企业客户真正实现互联网宣传,提高企业的竞争能力。创新互联是一支青春激扬、勤奋敬业、活力青春激扬、勤奋敬业、活力澎湃、和谐高效的团队。公司秉承以“开放、自由、严谨、自律”为核心的企业文化,感谢他们对我们的高要求,感谢他们从不同领域给我们带来的挑战,让我们激情的团队有机会用头脑与智慧不断的给客户带来惊喜。创新互联推出怀远免费做网站回馈大家。

要完整的md5+3DS实例,需要100分以上,要不到我的空间中查找相关的文章

vb点虐 中实现rsa加密解密 急!急!

我觉得你的并不是RSA加密解密算法。

在点虐 的有一个System.Security.Cryptography的命名空间,里面有一RSACryptoServiceProvider的类用来对byte进行RSA加密解密。

具体例子如下:

using System;

using System.Security.Cryptography;

using System.Text;

class RSACSPSample

{

static void Main()

{

try

{

//Create a UnicodeEncoder to convert between byte array and string.

UnicodeEncoding ByteConverter = new UnicodeEncoding();

//Create byte arrays to hold original, encrypted, and decrypted data.

byte[] dataToEncrypt = ByteConverter.GetBytes("Data to Encrypt");

byte[] encryptedData;

byte[] decryptedData;

//Create a new instance of RSACryptoServiceProvider to generate

//public and private key data.

RSACryptoServiceProvider RSA = new RSACryptoServiceProvider();

//Pass the data to ENCRYPT, the public key information

//(using RSACryptoServiceProvider.ExportParameters(false),

//and a boolean flag specifying no OAEP padding.

encryptedData = RSAEncrypt(dataToEncrypt,RSA.ExportParameters(false), false);

//Pass the data to DECRYPT, the private key information

//(using RSACryptoServiceProvider.ExportParameters(true),

//and a boolean flag specifying no OAEP padding.

decryptedData = RSADecrypt(encryptedData,RSA.ExportParameters(true), false);

//Display the decrypted plaintext to the console.

Console.WriteLine("Decrypted plaintext: {0}", ByteConverter.GetString(decryptedData));

}

catch(ArgumentNullException)

{

//Catch this exception in case the encryption did

//not succeed.

Console.WriteLine("Encryption failed.");

}

}

static public byte[] RSAEncrypt(byte[] DataToEncrypt, RSAParameters RSAKeyInfo, bool DoOAEPPadding)

{

try

{

//Create a new instance of RSACryptoServiceProvider.

RSACryptoServiceProvider RSA = new RSACryptoServiceProvider();

//Import the RSA Key information. This only needs

//toinclude the public key information.

RSA.ImportParameters(RSAKeyInfo);

//Encrypt the passed byte array and specify OAEP padding.

//OAEP padding is only available on Microsoft Windows XP or

//later.

return RSA.Encrypt(DataToEncrypt, DoOAEPPadding);

}

//Catch and display a CryptographicException

//to the console.

catch(CryptographicException e)

{

Console.WriteLine(e.Message);

return null;

}

}

static public byte[] RSADecrypt(byte[] DataToDecrypt, RSAParameters RSAKeyInfo,bool DoOAEPPadding)

{

try

{

//Create a new instance of RSACryptoServiceProvider.

RSACryptoServiceProvider RSA = new RSACryptoServiceProvider();

//Import the RSA Key information. This needs

//to include the private key information.

RSA.ImportParameters(RSAKeyInfo);

//Decrypt the passed byte array and specify OAEP padding.

//OAEP padding is only available on Microsoft Windows XP or

//later.

return RSA.Decrypt(DataToDecrypt, DoOAEPPadding);

}

//Catch and display a CryptographicException

//to the console.

catch(CryptographicException e)

{

Console.WriteLine(e.ToString());

return null;

}

}

}

[Visual Basic]

Try

'Create a new RSACryptoServiceProvider object.

Dim RSA As New RSACryptoServiceProvider()

'Export the key information to an RSAParameters object.

'Pass false to export the public key information or pass

'true to export public and private key information.

Dim RSAParams As RSAParameters = RSA.ExportParameters(False)

Catch e As CryptographicException

'Catch this exception in case the encryption did

'not succeed.

Console.WriteLine(e.Message)

End Try

[C#]

try

{

//Create a new RSACryptoServiceProvider object.

RSACryptoServiceProvider RSA = new RSACryptoServiceProvider();

//Export the key information to an RSAParameters object.

//Pass false to export the public key information or pass

//true to export public and private key information.

RSAParameters RSAParams = RSA.ExportParameters(false);

}

catch(CryptographicException e)

{

//Catch this exception in case the encryption did

//not succeed.

Console.WriteLine(e.Message);

}

简单VB.NET加密与解密

Private Function myEncrypt(ByVal Code As String) As String

Dim Result As String = ""

Dim CurrentChar As Char

For i As Integer = 0 To Code.Length - 1

CurrentChar = Code.Substring(i, 1)

Select Case Code.Substring(i, 1)

Case "Z"

Result = "a"

Case "z"

Result = "A"

Case Else

Result = Chr(Asc(CurrentChar) + 1)

End Select

Next

Return Result

End Function

'vb点虐 2005 调试通过

怎样用VB编写一个文件加密程序?

字节逐位倒排序加密法是以比特为单位的换位加密方法,用VB实现的具体算法是:

(1) 以二进制模式打开源文件;

(2) 从源文件第I位读取一个字节,假设为字母“A”,得到“A”的ASCII值为65;

(3) 将65转换成八位二进制串为“01000001”;

(4) 将“01000001”按字节逐位倒排序得另一个八位二进制串“10000010”;

(5) 将“10000010”转换成十进制再写回源文件第I位置,完成一个字节的加密;

(6) 重复(2)、(3)、(4)和(5),直到所有字节加密结束。

为了使程序模块化,我们用函数过程ByteToBin完成将字节型数据转换成二进制串(其实质就是将十进制数转换成八位二进制串);用函数过程BinToByte将二进制串转换成字节型数据(实质是将八位二进制串转换成十进制数):用函数过程Reverse将八位二进制串逐位倒排序。具体程序如下:

Function ByteToBin(m As Byte) As String ' 将字节型数据转换成八位二进制字符串

Dim c$

c$ = ""

Do While m 0

r = m Mod 2

m = m \ 2

c$ = r c$

Loop

c$ = Right("00000000" c$, 8)

ByteToBin = c$

End Function

Function Reverse(m As String) As String ' 将八位二进制字符串颠倒顺序

Dim i%, x$

x = ""

For i = 1 To 8

x = Mid(m, i, 1) x

Next i

Reverse = x

End Function

Function BinToByte(m As String) As Byte ' 将八位二进制串转换成十进制

Dim x As String * 1, y%, z%

z = 0

For i = 1 To 8

x = Mid(m, i, 1)

y = x * 2 ^ (8 - i)

z = z + y

Next i

BinToByte = z

End Function

Private Sub Command1_Click()

Dim x As Byte, i%, fname$

fname = InputBox("请输入要加密的文件名!注意加上路径名:")

If Dir(fname) = "" Then

MsgBox "文件不存在!"

Exit Sub

End If

Open fname For Binary As #1 ' 以二进制访问模式打开待加密文件

For i = 1 To LOF(1) ' LOF函数是求文件长度的内部函数

Get #1, i, x ' 取出第i个字节

x = BinToByte(Reverse(ByteToBin(x))) ' 这里调用了三个自定义函数

Put #1, i, x ' 将加密后的这个字节写回到文件原位置

Next i

Close

MsgBox "任务完成!"

End Sub

本例可以完成对任意文件的加密与解密,对同一文件作第一次处理为加密,第二次处理为解密。要调试本程序,可用记事本在C盘根目录下任意建立一个文本文件(假设为文件名为aaa.txt),其中的内容任意(可以包括字母、汉字、数字、回车符、换行符等)。运行本程序后,在输入文件名的对话框中输入文件名(如:“C:\aaa.txt”)后回车,即可完成对文件的加密。文件加密后,可以在记事本中打开该文件查看加密效果。如果想解密,可再次运行该程序并输入相同文件名。


当前名称:vb点虐 加密类 vbs加密仍可执行和解密
当前URL:http://mswzjz.cn/article/ddichij.html

其他资讯