『壹』 如何給.Net軟體加密
可以使用加密狗進行加密,把軟體的一部分信息寫入加密狗里進行綁定,使加密狗成為軟體的一部分,沒有加密狗無法運行。也可以使用外殼加密,不需要二次開發。可以試試ROCKEY系列的加密狗。
『貳』 .net軟體,用什麼軟體加密狗加密,能防止代碼反編譯
.Net軟體的特點,一些強大的編譯工具可以對.Net可執行文件進行反編譯操作,並得出相應的IL代碼甚至是源代碼。即使是採用混淆工具以及強命名工具也不能從根本上解決問題,代碼依然會很容易地被Reflectoer等工具反編譯源代碼。
軟體加密狗:威步(WIBU)的CodeMeter,AxProtector(for.net)兩款軟體加密狗性能非常不錯
反編譯的問題,與傳統的代碼混淆工具(Obfuscator)不同,AxProtector可以完全阻止對.NET
程序集(由
C#,
VB.NET,
Delphi.NET,
ASP.Net…
等語言編寫)的反編譯。通俗的講,AxProtector在破解者和您的
.NET
代碼之間構建了強大的防破解保護屏障,生成一個基於
Windows
的而不是基於
MSIL
的兼容格式文件。原始的
.NET
代碼完整的被加密後封裝在本地代碼內,無論何時都不會釋放到硬碟,對於破解者是不可見的。
與單純的.net加密軟體不同,AxProtector與CodeMeter硬體加密狗配套餐使用,採用了更為嚴密的密鑰管理,及最先進的AES、RSA、ECC等加密演算法存儲或傳輸密鑰,保證通訊安全。
.Net代碼編譯後生成的
.class
中包含有源代碼中的所有信息(不包括注釋),尤其是在其中保存有調試信息的時候。所以一個按照正常方式編譯的.class
文件可以非常輕易地被反編譯。一般軟體開發商會採用一種叫做混淆器的工具。混淆器的作用是對編譯好的代碼進行混淆,使得其無法被反編譯或者反編譯後的代碼混亂難懂。由於混淆器只是混淆了方法名稱或流程,而不能防止源代碼被反編譯,因此混淆器的作用只是增加了反編譯的難度,最終的結果也是治標不治本。對於一些掌握工具的人來說幾乎還是透明的。AxProtector是一款真正意義的加密源代碼、防止反編譯的.net軟體加密軟體。
AxProtector加密了.net原代碼,任何時候原代碼都不可能被還原到硬碟當中。採用AxProtector加密後的.net代碼只有在程序調用或執行某一段函數的時候,才能通過AxProtectorClass在內存中解密後返回到程序中執行,運行之後迅速立即加密。這種隨機加密、按需解密原代碼的功能,能很好的防止.Net程序的反編譯,同時能夠很好地防止API加密點被摘除。有效地保證了源代碼的執行效率和安全性。
『叄』 .NET如何實現數據加密
http://www.microsoft.com/china/technet/security/guidance/secmod39.mspx(最好的理論資料)
建立一個win form程序,然後把代碼拷到後台,即可實現C#非對稱加密程序 。 
using System; 
using System.Drawing; 
using System.Collections; 
using System.ComponentModel; 
using System.Windows.Forms; 
using System.Data; 
using System.IO; 
using System.Text; 
using System.Security.Cryptography; 
namespace 非對稱加密 
{ 
/// <summary> 
/// Form1 的摘要說明。 
/// </summary> 
public class Form1 : System.Windows.Forms.Form 
{ 
private System.Windows.Forms.TabControl tabControl1; 
private System.Windows.Forms.TabPage tabPage1; 
private System.Windows.Forms.TabPage tabPage2; 
private System.Windows.Forms.Button button1; 
private System.Windows.Forms.Button button2; 
private System.Windows.Forms.Button button3; 
private System.Windows.Forms.SaveFileDialog save; 
private System.Windows.Forms.Label label1; 
private System.Windows.Forms.TextBox textBox1; 
private System.Windows.Forms.Button button4; 
private System.Windows.Forms.Button button5; 
private System.Windows.Forms.Label label2; 
private System.Windows.Forms.RichTextBox richtext2; 
private System.Windows.Forms.OpenFileDialog open; 
private System.Windows.Forms.Label label3; 
private System.Windows.Forms.RichTextBox richtext3; 
private System.Windows.Forms.RichTextBox richtext; 
private System.Windows.Forms.Button button6; 
private System.Windows.Forms.Button button7; 
private System.Windows.Forms.Button button8; 
/// <summary> 
/// 必需的設計器變數。 
private static RSACryptoServiceProvider crypt; 
private static string privatekey; 
private static string publickey; 
private static byte [] bytes; 
private static string publicinfo; 
private static string privateinfo; 
private static string readpublickey; 
private static string readprivatekey; 
// ///private static byte [] onebytes ; 
/// </summary> 
private System.ComponentModel.Container components = null; 
public Form1() 
{ 
// 
// Windows 窗體設計器支持所必需的 
// 
InitializeComponent(); 
// 
// TODO: 在 InitializeComponent 調用後添加任何構造函數代碼 
// 
} 
/// <summary> 
/// 清理所有正在使用的資源。 
/// </summary> 
protected override void Dispose( bool disposing ) 
{ 
if( disposing ) 
{ 
if (components != null) 
{ 
components.Dispose(); 
} 
} 
base.Dispose( disposing ); 
} 
#region Windows 窗體設計器生成的代碼 
/// <summary> 
/// 設計器支持所需的方法 - 不要使用代碼編輯器修改 
/// 此方法的內容。 
/// </summary> 
private void InitializeComponent() 
{ 
this.tabControl1 = new System.Windows.Forms.TabControl(); 
this.tabPage1 = new System.Windows.Forms.TabPage(); 
this.button6 = new System.Windows.Forms.Button(); 
this.button3 = new System.Windows.Forms.Button(); 
this.button2 = new System.Windows.Forms.Button(); 
this.richtext = new System.Windows.Forms.RichTextBox(); 
this.button1 = new System.Windows.Forms.Button(); 
this.tabPage2 = new System.Windows.Forms.TabPage(); 
this.button8 = new System.Windows.Forms.Button(); 
this.button7 = new System.Windows.Forms.Button(); 
this.label3 = new System.Windows.Forms.Label(); 
this.richtext3 = new System.Windows.Forms.RichTextBox(); 
this.label2 = new System.Windows.Forms.Label(); 
this.richtext2 = new System.Windows.Forms.RichTextBox(); 
this.button5 = new System.Windows.Forms.Button(); 
this.button4 = new System.Windows.Forms.Button(); 
this.textBox1 = new System.Windows.Forms.TextBox(); 
this.label1 = new System.Windows.Forms.Label(); 
this.save = new System.Windows.Forms.SaveFileDialog(); 
this.open = new System.Windows.Forms.OpenFileDialog(); 
this.tabControl1.SuspendLayout(); 
this.tabPage1.SuspendLayout(); 
this.tabPage2.SuspendLayout(); 
this.SuspendLayout(); 
// 
// tabControl1 
// 
this.tabControl1.Controls.Add(this.tabPage1); 
this.tabControl1.Controls.Add(this.tabPage2); 
this.tabControl1.Location = new System.Drawing.Point(32, 64); 
this.tabControl1.Name = "tabControl1"; 
this.tabControl1.SelectedIndex = 0; 
this.tabControl1.Size = new System.Drawing.Size(416, 280); 
this.tabControl1.TabIndex = 0; 
// 
// tabPage1 
// 
this.tabPage1.Controls.Add(this.button6); 
this.tabPage1.Controls.Add(this.button3); 
this.tabPage1.Controls.Add(this.button2); 
this.tabPage1.Controls.Add(this.richtext); 
this.tabPage1.Controls.Add(this.button1); 
this.tabPage1.Location = new System.Drawing.Point(4, 21); 
this.tabPage1.Name = "tabPage1"; 
this.tabPage1.Size = new System.Drawing.Size(408, 255); 
this.tabPage1.TabIndex = 0; 
this.tabPage1.Text = "得到鑰匙"; 
// 
// button6 
// 
this.button6.Location = new System.Drawing.Point(72, 168); 
this.button6.Name = "button6"; 
this.button6.TabIndex = 4; 
this.button6.Text = "寫入文件"; 
this.button6.Click += new System.EventHandler(this.button6_Click); 
// 
// button3 
// 
this.button3.Location = new System.Drawing.Point(200, 16); 
this.button3.Name = "button3"; 
this.button3.TabIndex = 3; 
this.button3.Text = "保存私匙"; 
this.button3.Click += new System.EventHandler(this.button3_Click); 
// 
// button2 
// 
this.button2.Location = new System.Drawing.Point(128, 16); 
this.button2.Name = "button2"; 
this.button2.TabIndex = 2; 
this.button2.Text = "保存公鑰"; 
this.button2.Click += new System.EventHandler(this.button2_Click); 
// 
// richtext 
// 
this.richtext.Location = new System.Drawing.Point(16, 56); 
this.richtext.Name = "richtext"; 
this.richtext.Size = new System.Drawing.Size(256, 96); 
this.richtext.TabIndex = 1; 
this.richtext.Text = "richTextBox1"; 
// 
// button1 
// 
this.button1.Location = new System.Drawing.Point(8, 16); 
this.button1.Name = "button1"; 
this.button1.Size = new System.Drawing.Size(88, 23); 
this.button1.TabIndex = 0; 
this.button1.Text = "得到鑰匙信息"; 
this.button1.Click += new System.EventHandler(this.button1_Click); 
// 
// tabPage2 
// 
this.tabPage2.Controls.Add(this.button8); 
this.tabPage2.Controls.Add(this.button7); 
this.tabPage2.Controls.Add(this.label3); 
this.tabPage2.Controls.Add(this.richtext3); 
this.tabPage2.Controls.Add(this.label2); 
this.tabPage2.Controls.Add(this.richtext2); 
this.tabPage2.Controls.Add(this.button5); 
this.tabPage2.Controls.Add(this.button4); 
this.tabPage2.Controls.Add(this.textBox1); 
this.tabPage2.Controls.Add(this.label1); 
this.tabPage2.Location = new System.Drawing.Point(4, 21); 
this.tabPage2.Name = "tabPage2"; 
this.tabPage2.Size = new System.Drawing.Size(408, 255); 
this.tabPage2.TabIndex = 1; 
this.tabPage2.Text = "加密解密文字"; 
// 
// button8 
// 
this.button8.Location = new System.Drawing.Point(216, 72); 
this.button8.Name = "button8"; 
this.button8.TabIndex = 9; 
this.button8.Text = "讀取私匙"; 
this.button8.Click += new System.EventHandler(this.button8_Click); 
// 
// button7 
// 
this.button7.Location = new System.Drawing.Point(56, 72); 
this.button7.Name = "button7"; 
this.button7.TabIndex = 8; 
this.button7.Text = "讀取公匙"; 
this.button7.Click += new System.EventHandler(this.button7_Click); 
// 
// label3 
// 
this.label3.Location = new System.Drawing.Point(200, 120); 
this.label3.Name = "label3"; 
this.label3.Size = new System.Drawing.Size(100, 16); 
this.label3.TabIndex = 7; 
this.label3.Text = "解密結果"; 
// 
// richtext3 
// 
this.richtext3.Location = new System.Drawing.Point(200, 144); 
this.richtext3.Name = "richtext3"; 
this.richtext3.Size = new System.Drawing.Size(120, 72); 
this.richtext3.TabIndex = 6; 
this.richtext3.Text = "richTextBox2"; 
// 
// label2 
// 
this.label2.Location = new System.Drawing.Point(48, 120); 
this.label2.Name = "label2"; 
this.label2.Size = new System.Drawing.Size(128, 16); 
this.label2.TabIndex = 5; 
this.label2.Text = "加密窗口:"; 
// 
// richtext2 
// 
this.richtext2.Location = new System.Drawing.Point(40, 144); 
this.richtext2.Name = "richtext2"; 
this.richtext2.Size = new System.Drawing.Size(120, 72); 
this.richtext2.TabIndex = 4; 
this.richtext2.Text = "richTextBox2"; 
// 
// button5 
// 
this.button5.Location = new System.Drawing.Point(200, 96); 
this.button5.Name = "button5"; 
this.button5.Size = new System.Drawing.Size(112, 23); 
this.button5.TabIndex = 3; 
this.button5.Text = "使用私匙解密"; 
this.button5.Click += new System.EventHandler(this.button5_Click); 
// 
// button4 
// 
this.button4.Location = new System.Drawing.Point(48, 96); 
this.button4.Name = "button4"; 
this.button4.Size = new System.Drawing.Size(96, 23); 
this.button4.TabIndex = 2; 
this.button4.Text = "使用公匙加密"; 
this.button4.Click += new System.EventHandler(this.button4_Click); 
// 
// textBox1 
// 
this.textBox1.Location = new System.Drawing.Point(104, 32); 
this.textBox1.Multiline = true; 
this.textBox1.Name = "textBox1"; 
this.textBox1.Size = new System.Drawing.Size(168, 32); 
this.textBox1.TabIndex = 1; 
this.textBox1.Text = "textBox1"; 
// 
// label1 
// 
this.label1.Location = new System.Drawing.Point(128, 8); 
this.label1.Name = "label1"; 
this.label1.Size = new System.Drawing.Size(120, 16); 
this.label1.TabIndex = 0; 
this.label1.Text = "請輸入加密的文字"; 
// 
// Form1 
// 
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); 
this.ClientSize = new System.Drawing.Size(504, 357); 
this.Controls.Add(this.tabControl1); 
this.Name = "Form1"; 
this.Text = "Form1"; 
this.tabControl1.ResumeLayout(false); 
this.tabPage1.ResumeLayout(false); 
this.tabPage2.ResumeLayout(false); 
this.ResumeLayout(false); 
} 
#endregion 
/// <summary> 
/// 應用程序的主入口點。 
/// </summary> 
[STAThread] 
static void Main() 
{ 
Application.Run(new Form1()); 
} 
//得到鑰匙信息 
private void button1_Click(object sender, System.EventArgs e) 
{ 
crypt=new RSACryptoServiceProvider(); 
publickey=crypt.ToXmlString(false); 
richtext.Text="導出秘匙的情況下:\n"+publickey+"\n"; 
privatekey=crypt.ToXmlString(true); 
string info="僅僅導出公匙的情況下:\n"+privatekey+"\n"; 
richtext.AppendText(info); 
crypt.Clear(); 
} 
//保存公匙信息 
private void button2_Click(object sender, System.EventArgs e) 
{ 
save=new SaveFileDialog(); 
save.Filter="File Text (*.txt)|*.txt|All File (*.*)|*.*"; 
save.ShowDialog(); 
publicinfo=save.FileName; 
} 
//保存密匙信息 
private void button3_Click(object sender, System.EventArgs e) 
{ 
save=new SaveFileDialog(); 
save.Filter="File Text (*.txt)|*.txt|All File (*.*)|*.*"; 
save.ShowDialog(); 
privateinfo=save.FileName; 
} 
//把鑰匙信息寫入文件 
private void button6_Click(object sender, System.EventArgs e) 
{ 
StreamWriter one=new StreamWriter(publicinfo,true,UTF8Encoding.UTF8); 
one.Write(publickey); 
StreamWriter two=new StreamWriter(privateinfo,true,UTF8Encoding.UTF8); 
two.Write(privatekey); 
one.Flush(); 
two.Flush(); 
one.Close(); 
two.Close(); 
MessageBox.Show("成功保存公匙和密匙!"); 
} 
//用公匙加密 
private void button4_Click(object sender, System.EventArgs e) 
{ 
crypt=new RSACryptoServiceProvider(); 
UTF8Encoding enc=new UTF8Encoding(); 
bytes=enc.GetBytes(textBox1.Text); 
crypt.FromXmlString( readpublickey ); 
bytes = crypt.Encrypt( bytes,false ); 
string encryttext=enc.GetString(bytes);//encryptbyte); 
richtext2.Text="加密結果:\n"+encryttext+"\n"+"加密結束!"; 
} 
private void button5_Click(object sender, System.EventArgs e) 
{ 
UTF8Encoding enc=new UTF8Encoding(); 
byte [] decryptbyte; 
crypt.FromXmlString ( readprivatekey ) ; 
decryptbyte = crypt.Decrypt( bytes,false ); 
string decrypttext=enc.GetString( decryptbyte ); 
richtext3.Text = "解密結果:\n" + decrypttext + "\n" + "解密結束!" ; 
} 
//從文件中讀取公匙信息 
private void button7_Click(object sender, System.EventArgs e) 
{ 
StreamReader sr ; 
open = new OpenFileDialog( ); 
open.Filter="Text File (*.txt)|*.txt|All File (*.*)|*.* "; 
// open.ShowDialog(); 
if(open.ShowDialog()==DialogResult.OK) 
{ 
sr = new StreamReader(open.FileName,UTF8Encoding.UTF8); 
} 
else 
{ 
MessageBox.Show("發生錯誤!"); 
return; 
} 
readpublickey = sr.ReadToEnd(); 
sr.Close(); 
} 
//從文件中讀取私匙信息 
private void button8_Click(object sender, System.EventArgs e) 
{ 
open = new OpenFileDialog( ); 
open.Filter="Text File (*.txt)|*.txt|All File (*.*)|*.* "; 
open.ShowDialog(); 
StreamReader sr = new StreamReader(open.FileName,UTF8Encoding.UTF8); 
readprivatekey = sr.ReadToEnd(); 
sr.Close(); 
} 
} 
}
『肆』 VB.NET開發的軟體,大家一般都是怎麼加密的
網上有很多專業的加密教程
最適合小開發者的軟體加密方式就是下面這個
獲取硬體信息和個人注冊時的姓名手機號等一系列信息,通過預先設定好的加密函數進行散列加密,生成一個只有本人本機能使用的序列號,軟體正版授權的時候用同樣的方式生成序列號進行比對,一樣則通過
『伍』 ASP.NET系統中如何實現軟體加密、授權
安裝系統的時候獲取cpu 和網卡號 形成注冊號
寫到注冊表中
安裝完成後要求輸入注冊號,把輸入的值存放到某個文件(比如xml文件中),如果錯誤要提示
void Application_Start(object sender, EventArgs e) 
application變數 
在系統啟動的時候就讀取寫在注冊表中的key和xml文件中保存的序列號  不同則提示 並退出
『陸』 用VB.net編寫一個加密解密軟體
"採用DES演算法"這個說法不明確,首先是使用多少位的DES進行加密,通常是128位或192位,其次是,要先把主密鑰轉化成散列,才能供DES進行加密,轉化的方法是什麼沒有明確,通常是md5,所以有的銀行卡說是128位md5 3DS就是指用md5轉換主密鑰散列,用DES進行加密,但是DES本身是64位(包含校驗碼),2DES是128位,3DES是192位,但是沒有2DES的叫法,所以128位、192位統稱3DES
要完整的md5+3DS實例,需要100分以上,要不到我的空間中查找相關的文章
『柒』 C#NET怎麼實現IDEA加密演算法
1、數據加密的基本過程就是對原來為明文的文件或數據按某種演算法進行處理,使其成為不可讀的一段代碼,通常稱為「密文」,使其只能在輸入相應的密鑰之後才能顯示出本來內容,通過這樣的途徑來達到保護數據不被非法人竊取、閱讀的目的。
2、常見加密演算法
DES(Data Encryption Standard):數據加密標准,速度較快,適用於加密大量數據的場合;
3DES(Triple DES):是基於DES,對一塊數據用三個不同的密鑰進行三次加密,強度更高;
RC2和 RC4:用變長密鑰對大量數據進行加密,比 DES 快;
IDEA(International Data Encryption Algorithm)國際數據加密演算法:使用 128 位密鑰提供非常強的安全性;
RSA:由 RSA 公司發明,是一個支持變長密鑰的公共密鑰演算法,需要加密的文件塊的長度也是可變的;
DSA(Digital Signature Algorithm):數字簽名演算法,是一種標準的 DSS(數字簽名標准);
AES(Advanced Encryption Standard):高級加密標准,是下一代的加密演算法標准,速度快,安全級別高,目前 AES 標準的一個實現是 Rijndael 演算法;
BLOWFISH,它使用變長的密鑰,長度可達448位,運行速度很快;
其它演算法,如ElGamal、Deffie-Hellman、新型橢圓曲線演算法ECC等。
比如說,MD5,你在一些比較正式而嚴格的網站下的東西一般都會有MD5值給出,如安全焦點的軟體工具,每個都有MD5。 
3、常式:
#include<stdio.h>
#include<process.h>
#include<conio.h>
#include<stdlib.h>
#define maxim 65537
#define fuyi 65536
#define one 65536
#define round 8
unsigned int inv(unsigned int xin);
unsigned int mul(unsigned int a,unsigned int b);
void cip(unsigned int IN[4],unsigned int OUT[4],unsigned int Z[7][10]);
void key(unsigned int uskey[9],unsigned int Z[7][10]);
void de_key(unsigned int Z[7][10],unsigned int DK[7][10]);
void main()
{ 
 int i,j,k,x;
    unsigned int Z[7][10],DK[7][10],XX[5],TT[5],YY[5];
    unsigned int uskey[9];
FILE *fpout,*fpin;
printf("\n Input Key");
for(i=1;i<=8;i++)
    scanf("%6u",&uskey[i]);
for(i=0;i<9;i++)
    uskey[i]=100+i*3;
    key(uskey,Z);/*產生加密子密鑰*/
    de_key(Z,DK);/*計算解密子密鑰*/
    if((fpin=fopen("ekey.txt","w"))==NULL)
    {
    printf("cannot open file!");
    exit(EXIT_FAILURE);
    }
    for(i=0;i<7;i++)
    {
    for(j=0;j<10;j++)
    fprintf(fpin,"%6u",Z[i][j]);
    fprintf(fpin,"\n");
    }
    fclose(fpin);
    
    /*XX[1..5]中為明文*/
    for(i=0;i<4;i++) XX[i]=2*i+101;
    clrscr();
    printf("Ming wen %6u %6u %6u %6u \n",XX[0],XX[1],XX[2],XX[3]);
    if((fpin=(fopen("ideaming.txt","w")))==NULL)
    {printf("cannot open file!");
    exit(EXIT_FAILURE);
    }
    fprintf(fpin,"%6u,%6u,%6u,%6u \n",XX[0],XX[1],XX[2],XX[3]);
    fclose(fpin);
    for(i=1;i<=30000;i++)
    cip(XX,YY,Z);/*用密鑰Z加密XX中的明文並存在YY中*/
    printf("\n\n Mingwen %6u %6u %6u %6u \n",YY[0],YY[1],YY[2],YY[3]);
 if((fpin=fopen("ideamiwn.txt","w"))==NULL)
 {
 printf("cannot open file!");
    exit(EXIT_FAILURE);
    }
    fprintf(fpout,"%6u %6u %6u %6u\n",YY[0],YY[1],YY[2],YY[3]);
    {
    printf("cannot open file!");
    exit(EXIT_FAILURE);
    }
    fprintf(fpout,"%6u %6u %6u %6u \n",YY[0],YY[1],YY[2],YY[3]);
    fclose(fpout);
    for(i=1;i<=30000;i++)
    cip(YY,TT,DK);/*encipher YY to TT with Key DK*/
    printf("\n Jie Mi %6u %6u %6u %6u \n",TT[0],TT[1],TT[2],TT[3]);
    if((fpout=fopen("dideaout.txt","w"))==NULL)
    {
    printf("cannot open file!");
    exit(EXIT_FAILURE);
    }
    fprintf(fpout,"%6u %6u %6u %6u \n",TT[0],TT[1],TT[2],TT[3]);
    fclose(fpout);
    }
    /* 此函數執行IDEA演算法中的加密過程*/
    
    void cip(unsigned int IN[4],unsigned int OUT[4],unsigned int Z[7][10])
    {
    unsigned int r,x1,x2,x3,x4,kk,t1,t2,a;
    x1=IN[0];x2=IN[1];x3=IN[2];x4=IN[3];
    for(r=1;r<=8;r++)
    {
    /* 對64位的塊進行分組運算*/
    x1=mul(x1,Z[1][r]);x4=mul(x4,Z[4][r]);
    x2=x2+Z[2][r]&one;x3=(x3+Z[3][r])&one;
    /* MA結構的函數 */
    kk=mul(Z[5][r],(x1^x3));
    t1=mul(Z[6][r],(kk+(x2^x4))&one;
    /* 隨機變換PI*/
    x1=x1^t1;x4=x4^t2;a=x2^t2;x2=x3^t1;x3=a;
    }
    /* 輸出轉換*/
    OUT[0]=mul(x1,Z[1][round+1]);
    OUT[3]=mul(x4,Z[1][round+1]);
    OUT[1]=(x3+Z[2][round+1])&one;
    OUT[2]=(x2+Z[3][round+1])&one;
    }
    
    /* 用高低演算法上實現乘法運算*/
    unsigned int mul(unsigned int a,unsigned int b)
    {
    long int p;
    long unsigned q;
    if(a==0) p=maxim-b;
    else if(b==0) p=maxim-a;
    else
    {
    q=(unsigned long)a*(unsigned long)b;
    p=(q&one)-(q>>16);
    if(p<=0) p=p+maxim;
    {
    return (unsigned) (p&one);
    }
    
    /*通過Euclidean gcd演算法計算xin的倒數*/
    unsigned int inv(unsigned int xin)
    {
    long n1,n2,q,r,b1,b2,t;
    if(xin==0)
    b2=0;
    else
    {n1=maxim;n2=xin;b2=1;b1=0;
    do{
    r=(n1%n2);q=(n1-r)/n2;
    if(r==0)
    if(b2<0) b2=maxim+b2;
    else
    {n1=n2;n2=r;
    t=b2;
    b2=b1-q*b2;b1=t;
    }
    }while(r!=0);
    }
    return (unsigned long int)b2;
    }
/*產生加密子密鑰Z*/
    void key(unsigned int uskey[9],unsigned int Z[7][10])
    {
    unsigned int S[54];
    int i,j,r;
    for(i=1;i<9;i++)
    S[i-1]=uskey[i];
    /* shifts */
    for(i=8;i<54;i++)
    {
    if(i+2)%8==0)/* 對於S[14],S[22],...進行計算 */
    S[i]=((S[i-7]<<0)^(S[i-14]>>7)&one;
    else if((i+1)%8==0)/* 對於S[15],S[23],...進行計算 */
    S[i]=((S[i-15]<<9)^(S[i-14]>>7)&one;
    else
    S[i]=((S[i-7]<<9)^(S[i-6]>>7)&one;
    }
    /*取得子密鑰*/
    for(r=1;r<=round+1;r++)
      for(j=1;j<7;j++)
      Z[j][r]=S[6*(r-1)+j-1];
    }
    
    /* 計算解子密鑰DK */
    void de_key(unsigned int Z[7][10],unsigned int DK[7][10])
    {
    int j;
    for(j=1;j<=round+1;j++)
    {DK[1][round-j+2]=inv(Z[1][j]);
    DK[4][round-j+2]=inv(Z[4][j]);
    if(i==1|j==round+1)
    {
    DK[2][round-j+2]=(fuyi-Z[2][j])&one;
    DK[3][round-j+2]=(fuyi-Z[3][j])&one;
    }
    else
    {
    DK[2][round-j+2]=inv(Z[3][j]);
    DK[3][round-j+2]=inv(Z[2][j]);
    }
    }
    for(j=1;j<=round+1;j++)
    {
    DK[5][round-j+2]=inv(Z[5][j]);
    DK[6][round-j+2]=inv(Z[6][j]);
    }
    
    }
『捌』 怎麼給asp.net的代碼加密呀,也就是說怎麼保護.aspx的源程序.
asp.net不需要加密,
它的程序會自動編譯成DLL。
aspx頁面只是頁面部分,真正的程序在.VB OR .cs文件中。
編譯後就不需要這些文件啊。
『玖』 VB.NET做的一個行業小軟體,請問如何加密,比如需要通過什麼硬體的序列號注冊;
最好的加密就是通過你的網站去加密!用網路伺服器驗證把一些主要程序都可以載入到伺服器上!這樣你的程序加密就完美了!(個人觀點純屬不懂裝懂的。哈哈見笑)
『拾』 net程序加密C#開發軟體的源代碼怎麼加密
一般的加密,通過反編譯和跟蹤程序運行都不難破解,所以不僅要加密,還要阻止編譯,防範跟蹤。這是很專業的,市場上有很多現成加密狗產品,可以方便地解決這個問題。源代碼只能採取保密措施,加密是不行的。