65.9K
CodeProject is changing. Read more.
Home

XCrypt - encryption & decryption class wrapper

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.51/5 (28 votes)

Aug 19, 2003

Apache
viewsIcon

152069

downloadIcon

2994

A generic encryption & decryption class wrapper for C#.

Introduction

This article includes a generic encryption & decryption class wrapper for C#. It also includes two extra algorithms BlowFish & TwoFish which are not included in standard .NET framework library.

Background

The basic concept is from Frank Fang & William M. Rawls 's example code for SymmetricAlgorithm.

The BelowFish code is from Markus Hahn 's BelowFish source code.

The TwoFish code is from Shaun Wilde's ManyMonkey source code of TwoFish.

Please refer this website to get more information about BlowFish and TwoFish.

Using the code

The sample code initializes the engine to 3DES, you also can call InitializeEngine again to reset the engine to a different algorithm.

XCryptEngine xe = new XCryptEngine();
...
xe.InitializeEngine(XCryptEngine.AlgorithmType.TripleDES);

enc_str = xe.Encrypt(src_str);
dec_str = xe.Decrypt(enc_str);

xe.DestroyEngine();

History

  • 01/06/2003 - First package finished.