Click here to Skip to main content
15,886,110 members
Articles / Programming Languages / C#
Article

XCrypt - encryption & decryption class wrapper

Rate me:
Please Sign up or sign in to vote.
4.51/5 (31 votes)
18 Aug 2003Apache 150K   3K   72   24
A generic encryption & decryption class wrapper for C#.

Image 1

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.

C#
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.

License

This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0


Written By
Singapore Singapore
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 5 Pin
bitzhuwei4-Jan-13 14:43
bitzhuwei4-Jan-13 14:43 
GeneralMy vote of 3 Pin
yogeshpatil.psspl1-Jan-12 20:14
yogeshpatil.psspl1-Jan-12 20:14 
Questionpossibly stupid question, twofish IV/key static to 0's? Pin
Vertigo00712-Sep-11 12:20
Vertigo00712-Sep-11 12:20 
Generalgot error in using BlowFish decryption Pin
thefalcon7927-Mar-10 10:15
thefalcon7927-Mar-10 10:15 
Generalcan't compile this project Pin
Member 365176815-Feb-10 4:22
Member 365176815-Feb-10 4:22 
QuestionWhat about to use this code??? Pin
Michael Schaller18-Jun-08 12:08
Michael Schaller18-Jun-08 12:08 
AnswerRe: What about to use this code??? Pin
pdwolf25-Jun-08 4:12
pdwolf25-Jun-08 4:12 
NewsTwo other related encryption articles in CodeProject ... Pin
Tony Selke27-Sep-07 7:12
Tony Selke27-Sep-07 7:12 
GeneralRe: Two other related encryption articles in CodeProject ... Pin
jgauffin30-Sep-07 22:45
jgauffin30-Sep-07 22:45 
AnswerRe: Two other related encryption articles in CodeProject ... Pin
Tony Selke1-Oct-07 2:10
Tony Selke1-Oct-07 2:10 
Generalcannot decrypt in php Pin
Mihai Dobrescu15-Feb-07 10:20
Mihai Dobrescu15-Feb-07 10:20 
GeneralDoesn't decrypt in VS 2005 Pin
jtang12327-Mar-06 14:46
jtang12327-Mar-06 14:46 
GeneralNot able to Decrypt Pin
glthomas2913-Jan-06 3:40
glthomas2913-Jan-06 3:40 
GeneralRe: Not able to Decrypt Pin
Shawn Bass18-Jan-06 5:25
Shawn Bass18-Jan-06 5:25 
GeneralA little fix about key generator strategy Pin
Nigai27-Jul-05 4:12
Nigai27-Jul-05 4:12 
GeneralMinimum OS Requirements Pin
aBrookland25-Jul-05 4:14
aBrookland25-Jul-05 4:14 
GeneralRe: Minimum OS Requirements Pin
pdwolf1-Aug-05 14:11
pdwolf1-Aug-05 14:11 
GeneralRe: Minimum OS Requirements Pin
borcondex18-Oct-05 8:33
borcondex18-Oct-05 8:33 
Generalsomething is wrong Pin
phatrice937-Jul-05 16:55
phatrice937-Jul-05 16:55 
GeneralSpeed run Pin
godfathers17-Mar-05 23:01
godfathers17-Mar-05 23:01 
GeneralRe: Speed run Pin
Ashok Dhamija31-Dec-05 4:47
Ashok Dhamija31-Dec-05 4:47 
Questionencrypting öäu?? Pin
David30017-May-04 3:22
David30017-May-04 3:22 
AnswerRe: encrypting öäu?? Pin
Marcus E25-Oct-04 12:35
Marcus E25-Oct-04 12:35 
GeneralRe: encrypting öäu?? Pin
Sk8tz10-Mar-05 0:10
professionalSk8tz10-Mar-05 0:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.