Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C# ¼ÓÃÜ£­RSA ¸ß¼¶

RSA
ʵ¼ÊÓ¦ÓÃÖÐÊÇ£º½ÓÊÕ·½²úÉú¹«Ô¿ºÍ˽Կ£¬·¢ËÍ·½ÓÃÆ乫Կ¼ÓÃÜ£¬ÔٰѼÓÃܺóµÄÄÚÈÝ·¢Ë͸ø½ÓÊÕ·½¡£
CspParameters
µÄÃû³Æ¿Õ¼äÊÇ£º
System.Security.Cryptography
CspParameters cpSend = new CspParameters(); //Csp = Cryptography Service Provider
CspParameters cpReceive = new CspParameters();
cpSend.KeyContainerName = "SendTestContainer";
cpReceive.KeyContainerName = "ReceiveTestContainer";
RSACryptoServiceProvider rsaSend = new RSACryptoServiceProvider(cpSend); ;
RSACryptoServiceProvider rsaReceive = new RSACryptoServiceProvider(cpReceive);
rsaSend.fromXmlString(rsaReceive.ToXmlString(false)); //·¢ËÍ·½Ê¹ÓýÓÊÕ·½¸øËüµÄ¹«Ô¿½øÐмÓÃÜ
string plaintext = "Ç°¼¸ÌìÎÒÅöµ½Ò»¸öÅóÓÑ£¬Ô¼ÎÒ¸úÂíÔô´ò¼Ü£¬ÎÒÁ¢Âí´ðÓ¦ÁËËû£¬ÒòΪÎÒ¾õµÃÕâ¼þʺÃÎÞÁÄ¡£";
byte[] ciphertext = rsaSend.Encrypt(System.Text.Encoding.UTF8.GetBytes(plaintext), false); //¼ÓÃܺó
byte[] decryption = rsaReceive.Decrypt(ciphertext, false); //½âÃܺó
lbl.Width = 760;
lbl.Text = "";
lbl.Text += Convert.ToBase64String(ciphertext) + "<br />"; //ÏÔʾ¼ÓÃܺóµÄ
lbl.Text += System.Text.Encoding.UTF8.GetString(decryption) + "<br />"; //ÏÔʾ½âÃܺóµÄ
lbl.Text += Server.HtmlEncode(rsaSend.ToXmlString(false)) + "<br />"; //ÏÔʾ·¢ËÍ·½¹«Ô¿
lbl.Text += Server.HtmlEncode(rsaReceive.ToXmlString(true)) + "<br />"; //ÏÔʾ½ÓÊÕ·½¹«Ô¿ºÍ˽Կ
lbl.Text += Server.HtmlEncode(rsaReceive.ToXmlString(false)) + "<br />"; //ÏÔʾ½ÓÊÕ·½¹«Ô¿
rsaSend.PersistKeyInCsp = true; //ÃÜÔ¿Òª±£´æÆðÀ´
//rsaSend.Clear();
rsaReceive.PersistKeyInCsp = true;
//rsaReceive.Clear();
ÔÚÉÏÃæµÄ´úÂëÖУ¬ÎÒÃÇʹÓà CspParameters ½«ÃÜÔ¿±£´æÆðÀ´£¬ToXmlString
ºÍ fromXmlString
½«½ÓÊÕ·½µÄ¹«Ô¿¸æË߸ø·¢ËÍ·½¡£


Ïà¹ØÎĵµ£º

ʹÓÃC#ÕýÔò±í´ïʽƥÅäÏà¹Ø×Ö·û´®

C#ÕýÔò±í´ïʽƥÅä×Ö·û´®µÄ·½·¨ÈçÏ£º
1.ʹÓÃC#ÖÐʹÓÃÕýÔò±í´ïʽSystem.Text.RegularExpressionsÃüÃû¿Õ¼ä£»
2.ʹÓÃC#ÖÐʹÓÃÕýÔò±í´ïʽMatches()·½·¨Æ¥Åä×Ö·û´®£¬¸ñʽÈçÏ£º
MatchCollection Matches = Regex.Matches(Str, Pattern, RegexOptions.IgnoreCase | RegexOptions.ExplicitC ......

C#ʵÏÖÎļþ¹ØÁª

ºÍÆäËûÓïÑÔÒ»Ñù£¬C#ʵÏÖÎļþ¹ØÁªÍ¬ÑùÐèÒªÖ±½Ó²Ù×÷×¢²á±í£¬¼´°´¹æÔò·Ö±ðÉèÖÃÎļþÀ©Õ¹Ãû£¬ÎĵµÀàÐÍ˵Ã÷£¬ÓѺÃÃû³Æ£¬Í¼±ê£¬µ÷Ó÷½·¨µÈ¼üÖµ¼´¿É£¬ÍøÉÏËæ±ã²é²é¾Í¿ÉÒÔд³öÒÔϵĴúÂë¡£ using Microsoft.Win32; RegistryKey key = Registry.ClassesRoot.OpenSubKey(".jb");
if (key == null)
{
 ......

C#¶ÔͼƬµÄ¼¸ÖÖ¼òµ¥´¦Àí

ÓÖÓÐÒ»¶Îʱ¼äûÓиüÐÂÁË£¬È±ÉÙѧϰµÄÈÈÇéÁË¡£½ñÌìÌù¼¸¸öͼƬ´¦ÀíµÄС¼¼ÇÉ£¬Ï£Íû¶Ô´ó¼ÒÓÐÓãº
(1)ÈçºÎ»ñÈ¡.gifͼƬÖеĸ÷¸öÖ¡£¿
(2)ÈçºÎ»ñȡͼƬµÄËõÂÔͼ£¿
(3)ÈçºÎ“½ØÈ¡”ͼƬµÄÖ¸¶¨ÇøÓò£¿
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
public class ImageHelp ......

c#º¯ÊýͼÏñ²é¿´Æ÷ ¿ÉÒԲ鿴»ý·Ö¡¢µ¼Êý

http://download.csdn.net/source/1935080
ÕâÓ¦¸ÃËãÊÇÎҵĵÚÒ»¸ö³ÌÐò°É ºÇºÇ
×îÂé·³µÄ¼ÇµÃÊÇ×ø±êÍøµÄ¼ÆË㺯ÊýÁË
ÒÔºóд³ÌÐòÒª¼ÇµÃ¶àÓÃ×¢ÊÍ£¬Ìá¸ß¿É¶ÁÐÔ
Ë㺯Êý»ý·ÖµÄËã·¨ ÊÇÓÃÔÚX=0µÄʱºò Y=0 ÍƵ¼ÆäËûµÄÖµ
¶ÔÓÐЩº¯ÊýYÎÞ·¨»ý·ÖΪ0 µÄ»°£¬¿ÉÒÔÓûý·Ö¶à³öÀ´µÄÁ½¸ö ÍÏÀ­ÌõÍÏÀ­  £¬Ò²ÐíÄܳöÀ´  -_-||
BUG ¶àÊ ......

C# ¼ÓÃÜ£­É¢ÁÐËã·¨

´´½¨É¢ÁÐÂëµÄ·½·¨·Ç³£¶à£¬¼´Ê¹ÊÇͬһÖÖÉ¢ÁÐËã·¨Ò²¿ÉÒÔͨ¹ýÐí¶àÀàÀ´ÊµÏÖ£¬Ç°ÃæÕ½ڽéÉܵÄËãÒ»ÖÖ£¬ÏÂÃæÔÙ½éÉÜÒ»ÖÖ¡£ÒÔ SHA1
ΪÀý£º
string plaintext = "Ã÷ÎÄ";
byte[] srcBuffer = System.Text.Encoding.UTF8.GetBytes(plaintext);
HashAlgorithm hash = HashAlgorithm.Create("SHA1"); //½«²ÎÊý»» ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ