Place Ads here

Saturday, July 2, 2011

CRYPTOGRAPHY

Asp.Net sample projects


using System;
using System.Configuration;

using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Security.Cryptography;
using System.Text;


public partial class_Default:System.Web.UI.Page
{
byte[] hashvalue,Messagebytes;
string StringtoConvert;
UnicodeEncoding MyUnicodeEncoding;


protected void Page_Load(object sender,EventsArgs e)
{
}


protected void ButtonSHA1_click(object sender,EventsArgs e)
{
TextBox2.Text="";
StringtoConvert=TextBox1.Text;
MyUniCodeEncoding = new UniCodeEncoding();
MessageBytes = MyUniCodeEncoding.GetBytes(StringtoConvert);
SHA1Managed SHhash = new SHA1Managed();
hashvalue = SHhash.ComputeHash(MessageBytes);
foreach (byte b in hashValue)
{
TextBox2.Text= TextBox2.Text + String.Format(" {0:X2}",b);
}
}
protected void ButtonSHA256_click(object sender,EventsArgs e)
{
 SHA256Managed SHhash = new SHA256Managed();
}


 
protected void ButtonSHA384_click(object sender,EventsArgs e)
{
 SHA384Managed SHhash = new SHA384Managed();
}



protected void ButtonSHA512_click(object sender,EventsArgs e)
{
 SHA512Managed SHhash = new SHA512Managed();
}


}


No comments:

Post a Comment