TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
kailash r
NA
44
0
File enscryprtion using twofish
Nov 16 2010 7:31 AM
Hi,
I need to use twofish encryption method to decrypt the files. Already i have some files that encrypted using two fish. To decrypt those files currently i am using twofish algorithm from http://www.codeproject.com/KB/recipes/twofish_csharp.aspx
But my decryption is not working, Still the bytes and contents are encrypted. I am in very urgent situation.
My source code is,
public static bool TwoFishEncript(string filename)
{
Twofish fish = new Twofish();
fish.Mode = CipherMode.ECB;
fish.KeySize = 256;
System.IO.MemoryStream ms=new MemoryStream();
CryptoStream decStream;
ICryptoTransform decrypt = fish.CreateDecryptor();
CryptoStream cryptostream = new CryptoStream(ms, decrypt, CryptoStreamMode.Write);
byte[] data = File.ReadAllBytes(filename);
cryptostream.Write(data, 0, data.Length);
cryptostream.Close();
FileStream fs = new FileStream(filename.Replace(".enc", ""), FileMode.Create);
fs.Write(data, 0, data.Length - 1);
fs.Close();
return true;
}
I have attached the twofish class file with this. This attachment is downloaded from http://www.codeproject.com/KB/recipes/twofish_csharp.aspx
Attachment:
twofish_csharp.zip
Reply
Answers (
0
)
help with refreshing date inside a method of a simple taskmanager
How to read a txt file into a two-dimensional array