Click here to Skip to main content
Licence Apache
First Posted 18 Aug 2003
Views 102,351
Bookmarked 61 times

XCrypt - encryption & decryption class wrapper

By | 18 Aug 2003 | Article
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.

License

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

About the Author

pdwolf



Singapore Singapore

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 3 Pinmemberyogeshpatil.psspl20:14 1 Jan '12  
Questionpossibly stupid question, twofish IV/key static to 0's? PinmemberVertigo00712:20 12 Sep '11  
Generalgot error in using BlowFish decryption Pinmemberthefalcon7910:15 27 Mar '10  
Generalcan't compile this project PinmemberMember 36517684:22 15 Feb '10  
QuestionWhat about to use this code??? PinmemberMichael Schaller12:08 18 Jun '08  
AnswerRe: What about to use this code??? Pinmemberpdwolf4:12 25 Jun '08  
NewsTwo other related encryption articles in CodeProject ... PinmemberTony Selke7:12 27 Sep '07  
GeneralRe: Two other related encryption articles in CodeProject ... PinmemberVerifier22:45 30 Sep '07  
AnswerRe: Two other related encryption articles in CodeProject ... PinmemberTony Selke2:10 1 Oct '07  
Generalcannot decrypt in php PinmemberMihai Dobrescu10:20 15 Feb '07  
I am trying to decrypt the string encrypted by your application in php.
The problem is the result is not correct - I get the first few characters (4-5) wrong, then the rest is correct.
 
Do you have any idea why this might happen?
 
Mihaido

GeneralDoesn't decrypt in VS 2005 Pinmemberjtang12314:46 27 Mar '06  
GeneralNot able to Decrypt Pinmemberglthomas293:40 13 Jan '06  
GeneralRe: Not able to Decrypt PinmemberShawn Bass5:25 18 Jan '06  
GeneralA little fix about key generator strategy PinmemberNigai4:12 27 Jul '05  
GeneralMinimum OS Requirements PinmemberaBrookland4:14 25 Jul '05  
GeneralRe: Minimum OS Requirements Pinmemberpdwolf14:11 1 Aug '05  
GeneralRe: Minimum OS Requirements Pinmemberborcondex8:33 18 Oct '05  
Generalsomething is wrong Pinmemberphatrice9316:55 7 Jul '05  
GeneralSpeed run Pinmembergodfathers23:01 17 Mar '05  
GeneralRe: Speed run PinmemberAshok Dhamija4:47 31 Dec '05  
Questionencrypting öäu?? PinmemberDavid30013:22 7 May '04  
AnswerRe: encrypting öäu?? PinmemberMarcus E12:35 25 Oct '04  
GeneralRe: encrypting öäu?? PinmemberSk8tz0:10 10 Mar '05  

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

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

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120529.1 | Last Updated 19 Aug 2003
Article Copyright 2003 by pdwolf
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid