65.9K
CodeProject is changing. Read more.
Home

Cryptography/Network Security

starIconstarIconstarIconemptyStarIconemptyStarIcon

3.00/5 (24 votes)

Jun 1, 2006

CPOL
viewsIcon

39370

downloadIcon

1977

Cryptography Techniques(HASH,Asymmetric Cryptography,Symmetric Cryptography)

Introduction

This is class library which contains cryptography techniques

  • Asymmetric
  • Symmetric
  • Hash

These techniques also apply on files and text messages

Asymmetric Class

First we generate Keys

AsymmetricCryptography asy = new AsymmetricCryptography();

prk = asy.Private_Key;

pk = asy.Public_Key;

txtpk.Text=pk;
  • public keys
  • private keys
  • and then two static fucntion

Encrypt

AsymmetricCryptography asy = new AsymmetricCryptography();

asy.Private_Key = prk;

asy.Public_Key=pk;

txtcipher.Text = AsymmetricCryptography.Encript(txtplain.Text,asy.Public_Key);

And Decript

AsymmetricCryptography asy = new AsymmetricCryptography();

asy.Private_Key = prk;

asy.Public_Key=pk;

txtplain.Text = AsymmetricCryptography.Decript (txtcipher.Text,asy.Private_Key );

Symmetric Class

SymetricCryptography sym = new SymetricCryptography();

Initialization Vector

iv = sym.Initialization_Vector;

Session Key

sk = sym.Sessio_Key;

This is used to encrypt and decrypt files and texts

Encrypt

SymetricCryptography sym = new SymetricCryptography();

sym.Initialization_Vector = iv;

sym.Sessio_Key = sk;

txtcipher.Text= sym.EncryptString(txtplain.Text);

Decrypt

SymetricCryptography sym = new SymetricCryptography();

sym.Initialization_Vector = iv;

sym.Sessio_Key = sk;

txtcipher.Text= sym.EncryptString(txtplain.Text);

Hash Funtion

The hashcalulatore class uses the MD5 Hash function