真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

vb.net文本加密 vb 字符串加密

求VB.net使用密鑰的可逆文本加密算法代碼 編程新手,若有講解可加分

先實(shí)例化該類

創(chuàng)新互聯(lián)是一家專注于網(wǎng)站制作、網(wǎng)站建設(shè)與策劃設(shè)計(jì),鼓樓網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設(shè)十載,網(wǎng)設(shè)計(jì)領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:鼓樓等地區(qū)。鼓樓做網(wǎng)站價(jià)格咨詢:18982081108

Dim wrapper As New ClassLibrary1.Simple3Des("你的密鑰")

然后

Dim cipherText As String = wrapper.EncryptData("要加密的文本")

Dim cipherText As String = wrapper.DecryptData("要揭秘的文本")

簡(jiǎn)單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.net 2005 調(diào)試通過

用VB.net編寫一個(gè)加密解密軟件

"采用DES算法"這個(gè)說法不明確,首先是使用多少位的DES進(jìn)行加密,通常是128位或192位,其次是,要先把主密鑰轉(zhuǎn)化成散列,才能供DES進(jìn)行加密,轉(zhuǎn)化的方法是什么沒有明確,通常是md5,所以有的銀行卡說是128位md5 3DS就是指用md5轉(zhuǎn)換主密鑰散列,用DES進(jìn)行加密,但是DES本身是64位(包含校驗(yàn)碼),2DES是128位,3DES是192位,但是沒有2DES的叫法,所以128位、192位統(tǒng)稱3DES

要完整的md5+3DS實(shí)例,需要100分以上,要不到我的空間中查找相關(guān)的文章

求VB.NET生成TET文件的加密方法

使用加密方式存儲(chǔ)即可實(shí)現(xiàn)別人無(wú)法查看內(nèi)容,加密的方式有很多,適用你這里使用的是可逆的算法,推薦你使用DES加密

Imports?System ?

Imports?System.Collections.Generic ?

Imports?System.Text ?

Imports?System.IO ?

Imports?System.Security ?

Imports?System.Security.Cryptography ?

Namespace?ZU14 ?

NotInheritable?Public?Class?DES ?

Private?iv?As?String?=?"1234的yzo"?

Private?key?As?String?=?"123在yzo"?

'/?summary?

'/?DES加密偏移量,必須是=8位長(zhǎng)的字符串 ?

'/?/summary?

Public?Property?IV()?As?String ?

Get ?

Return?iv ?

End?Get ?

Set ?

iv?=?value?

End?Set ?

End?Property ?

'/?summary?

'/?DES加密的私鑰,必須是8位長(zhǎng)的字符串 ?

'/?/summary?

Public?Property?Key()?As?String ?

Get ?

Return?key ?

End?Get ?

Set ?

key?=?value?

End?Set ?

End?Property ?

'/?summary?

'/?對(duì)字符串進(jìn)行DES加密 ?

'/?/summary?

'/?param?name="sourceString"待加密的字符串/param?

'/?returns加密后的BASE64編碼的字符串/returns?

Public?Function?Encrypt(sourceString?As?String)?As?String ?

Dim?btKey?As?Byte()?=?Encoding.Default.GetBytes(key) ?

Dim?btIV?As?Byte()?=?Encoding.Default.GetBytes(iv) ?

Dim?des?As?New?DESCryptoServiceProvider() ?

Dim?ms?As?New?MemoryStream() ?

Try ?

Dim?inData?As?Byte()?=?Encoding.Default.GetBytes(sourceString) ?

Try ?

Dim?cs?As?New?CryptoStream(ms,?des.CreateEncryptor(btKey,?btIV),?CryptoStreamMode.Write) ?

Try ?

cs.Write(inData,?0,?inData.Length) ?

cs.FlushFinalBlock() ?

Finally ?

cs.Dispose() ?

End?Try ?

Return?Convert.ToBase64String(ms.ToArray()) ?

Catch ?

End?Try ?

Finally ?

ms.Dispose() ?

End?Try ?

End?Function?'Encrypt ?

'/?summary?

'/?對(duì)DES加密后的字符串進(jìn)行解密 ?

'/?/summary?

'/?param?name="encryptedString"待解密的字符串/param?

'/?returns解密后的字符串/returns?

Public?Function?Decrypt(encryptedString?As?String)?As?String ?

Dim?btKey?As?Byte()?=?Encoding.Default.GetBytes(key) ?

Dim?btIV?As?Byte()?=?Encoding.Default.GetBytes(iv) ?

Dim?des?As?New?DESCryptoServiceProvider() ?

Dim?ms?As?New?MemoryStream() ?

Try ?

Dim?inData?As?Byte()?=?Convert.FromBase64String(encryptedString) ?

Try ?

Dim?cs?As?New?CryptoStream(ms,?des.CreateDecryptor(btKey,?btIV),?CryptoStreamMode.Write) ?

Try ?

cs.Write(inData,?0,?inData.Length) ?

cs.FlushFinalBlock() ?

Finally ?

cs.Dispose() ?

End?Try ?

Return?Encoding.Default.GetString(ms.ToArray()) ?

Catch ?

End?Try ?

Finally ?

ms.Dispose() ?

End?Try ?

End?Function?'Decrypt ?

'/?summary?

'/?對(duì)文件內(nèi)容進(jìn)行DES加密 ?

'/?/summary?

'/?param?name="sourceFile"待加密的文件絕對(duì)路徑/param?

'/?param?name="destFile"加密后的文件保存的絕對(duì)路徑/param?

Overloads?Public?Sub?EncryptFile(sourceFile?As?String,?destFile?As?String) ?

If?Not?File.Exists(sourceFile)?Then ?

Throw?New?FileNotFoundException("指定的文件路徑不存在!",?sourceFile) ?

End?If ?

Dim?btKey?As?Byte()?=?Encoding.Default.GetBytes(key) ?

Dim?btIV?As?Byte()?=?Encoding.Default.GetBytes(iv) ?

Dim?des?As?New?DESCryptoServiceProvider() ?

Dim?btFile?As?Byte()?=?File.ReadAllBytes(sourceFile) ?

Dim?fs?As?New?FileStream(destFile,?FileMode.Create,?FileAccess.Write) ?

Try ?

Try ?

Dim?cs?As?New?CryptoStream(fs,?des.CreateEncryptor(btKey,?btIV),?CryptoStreamMode.Write) ?

Try ?

cs.Write(btFile,?0,?btFile.Length) ?

cs.FlushFinalBlock() ?

Finally ?

cs.Dispose() ?

End?Try ?

Catch ?

Finally ?

fs.Close() ?

End?Try ?

Finally ?

fs.Dispose() ?

End?Try ?

End?Sub?'EncryptFile ?

'/?summary?

'/?對(duì)文件內(nèi)容進(jìn)行DES加密,加密后覆蓋掉原來(lái)的文件 ?

'/?/summary?

'/?param?name="sourceFile"待加密的文件的絕對(duì)路徑/param?

Overloads?Public?Sub?EncryptFile(sourceFile?As?String) ?

EncryptFile(sourceFile,?sourceFile) ?

End?Sub?'EncryptFile ?

'/?summary?

'/?對(duì)文件內(nèi)容進(jìn)行DES解密 ?

'/?/summary?

'/?param?name="sourceFile"待解密的文件絕對(duì)路徑/param?

'/?param?name="destFile"解密后的文件保存的絕對(duì)路徑/param?

Overloads?Public?Sub?DecryptFile(sourceFile?As?String,?destFile?As?String) ?

If?Not?File.Exists(sourceFile)?Then ?

Throw?New?FileNotFoundException("指定的文件路徑不存在!",?sourceFile) ?

End?If ?

Dim?btKey?As?Byte()?=?Encoding.Default.GetBytes(key) ?

Dim?btIV?As?Byte()?=?Encoding.Default.GetBytes(iv) ?

Dim?des?As?New?DESCryptoServiceProvider() ?

Dim?btFile?As?Byte()?=?File.ReadAllBytes(sourceFile) ?

Dim?fs?As?New?FileStream(destFile,?FileMode.Create,?FileAccess.Write) ?

Try ?

Try ?

Dim?cs?As?New?CryptoStream(fs,?des.CreateDecryptor(btKey,?btIV),?CryptoStreamMode.Write) ?

Try ?

cs.Write(btFile,?0,?btFile.Length) ?

cs.FlushFinalBlock() ?

Finally ?

cs.Dispose() ?

End?Try ?

Catch ?

Finally ?

fs.Close() ?

End?Try ?

Finally ?

fs.Dispose() ?

End?Try ?

End?Sub?'DecryptFile ?

'/?summary?

'/?對(duì)文件內(nèi)容進(jìn)行DES解密,加密后覆蓋掉原來(lái)的文件 ?

'/?/summary?

'/?param?name="sourceFile"待解密的文件的絕對(duì)路徑/param?

Overloads?Public?Sub?DecryptFile(sourceFile?As?String) ?

DecryptFile(sourceFile,?sourceFile) ?

End?Sub?'DecryptFile ?

End?Class?'DES ?

End?Namespace?'ZU14?

對(duì)文本文件加密

Dim?des?As?New?ZU14.DES() ?

des.IV?=?"abcd哈哈笑"?

des.Key?=?"必須八位"?

'加密

des.EncryptFile("d:\a.txt",?"d:\b.txt") ?

'解密

des.DecryptFile("d:\b.txt")


文章標(biāo)題:vb.net文本加密 vb 字符串加密
瀏覽路徑:http://weahome.cn/article/docdjjs.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部