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

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

vb點(diǎn)虐 rsa算法 vbnet randomize

怎么用vb實(shí)現(xiàn)rsa算法?謝謝了,大神幫忙啊

Private Sub Command3_Click() Dim ni%, m1%, m%, n%, r% n1 = Text1.Text m1 = Text2.Text If m1 n1 Then ' mn m = m1: n = n1 Else m = n1: n = m1 End If Do r = m Mod n If r = 0 Then Exit Do m = n n = r Loop Text3.Text = n Text4.Text = m1 * n1 / n End Sub

目前累計(jì)服務(wù)客戶上千多家,積累了豐富的產(chǎn)品開發(fā)及服務(wù)經(jīng)驗(yàn)。以網(wǎng)站設(shè)計(jì)水平和技術(shù)實(shí)力,樹立企業(yè)形象,為客戶提供成都網(wǎng)站制作、成都網(wǎng)站設(shè)計(jì)、外貿(mào)營銷網(wǎng)站建設(shè)、網(wǎng)站策劃、網(wǎng)頁設(shè)計(jì)、網(wǎng)絡(luò)營銷、VI設(shè)計(jì)、網(wǎng)站改版、漏洞修補(bǔ)等服務(wù)。創(chuàng)新互聯(lián)公司始終以務(wù)實(shí)、誠信為根本,不斷創(chuàng)新和提高建站品質(zhì),通過對(duì)領(lǐng)先技術(shù)的掌握、對(duì)創(chuàng)意設(shè)計(jì)的研究、對(duì)客戶形象的視覺傳遞、對(duì)應(yīng)用系統(tǒng)的結(jié)合,為客戶提供更好的一站式互聯(lián)網(wǎng)解決方案,攜手廣大客戶,共同發(fā)展進(jìn)步。

vb點(diǎn)虐 中實(shí)現(xiàn)rsa加密解密 急!急!

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

在點(diǎn)虐 的有一個(gè)System.Security.Cryptography的命名空間,里面有一RSACryptoServiceProvider的類用來對(duì)byte進(jìn)行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);

}

關(guān)于vb做的rsa加解密程序

:將方程x^4-px^3+q=0移項(xiàng),得

x^4+q=px^3

可見,x^4≥0,則x^4+q0,所以px^30,即x0,本題也就是要求出使方程x^4-px^3+q=0有正整數(shù)解的素?cái)?shù)p、q;

且素?cái)?shù)p必定是奇素?cái)?shù),否則是偶素?cái)?shù)的話,那么p=2,則方程成為:x^4+q=2x^3,即q=2x^3-x^4=x^3×(2-x)0,得出2-x0,即x2,則只能是x=1,代入方程:1^4+q=2×1^3,即1+q=2,解得q=1,不是素?cái)?shù),故p必定是奇素?cái)?shù)。

分兩種情形討論:

情形一:當(dāng)x為偶數(shù)時(shí),設(shè)為x=2n,則有

(2n)^4+q=p×(2n)^3

16n^4+q=p×8n^3

上式右端是偶數(shù),則左端的q必須為偶數(shù),否則:左端奇偶相加得奇,不符。

而q作為素?cái)?shù),唯一的偶素?cái)?shù)就是2,即q=2,則上式成為

16n^4+2=p×8n^3

兩邊同時(shí)除以2,得:8n^4+1=p×4n^3,顯然,左端奇偶相加得奇,但右端為偶,矛盾。所以方程無偶整數(shù)解;

情形二:當(dāng)x為奇數(shù)時(shí),設(shè)為x=2n-1,則有

(2n-1)^4+q=p×(2n-1)^3

觀察上式,右端為奇,則左端也必須為奇,而(2n-1)^4是奇,所以得出q必須為偶,故素?cái)?shù)q=2,上式成為:

(2n-1)^4+2=p×(2n-1)^3,整理成:

p(2n-1)^3-(2n-1)^4=(2n-1)^3×[p-(2n-1)]=1×2

由于(2n-1)^3為奇,所以必有:(2n-1)^3=1,解得:n=1;

則:[p-(2n-1)]=2,解得:p=3;

綜上,對(duì)于素?cái)?shù)p、q,方程x^4-px^3+q=0有整數(shù)解,則p、q分別為3和2。

暈,再補(bǔ)一個(gè)!

1:編程實(shí)現(xiàn) 自動(dòng)生成兩個(gè)素?cái)?shù)p,q

2:編程實(shí)現(xiàn) 計(jì)算n=p*q

f(n)=(p-1)(q-1)

3: 隨機(jī)數(shù)e滿足:0ef(n) and f(n)與e互為素?cái)?shù)

4: 編程實(shí)現(xiàn) 計(jì)算d:d=e mod f(n)=1

如要加密m

5:編程實(shí)現(xiàn)計(jì)算c:

加密公式:c=m^e mod n

6:編程實(shí)現(xiàn)解密m:

解密公式:m=c^d mod n

Private Sub Command10_Click()

End

End Sub

Private Sub Command9_Click()

Text1.Text = ""

Text2.Text = ""

Text3.Text = ""

Text4.Text = ""

Text5.Text = ""

Text6.Text = ""

Text7.Text = ""

Text8.Text = ""

Text9.Text = ""

End Sub

Private Sub Command2_Click()

p = Val(Text1.Text)

q = Val(Text2.Text)

Text3.Text = Str$(p * q)

End Sub

Private Sub Command3_Click()

p = Val(Text1.Text)

q = Val(Text2.Text)

Text4.Text = Str$(p - 1) * (q - 1)

End Sub


分享名稱:vb點(diǎn)虐 rsa算法 vbnet randomize
當(dāng)前URL:http://weahome.cn/article/ddgehsi.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部