Click here to Skip to main content
15,903,362 members
Home / Discussions / C#
   

C#

 
AnswerRe: Logon Failed Error For Crystal Report. Pin
thatraja8-Dec-10 1:48
professionalthatraja8-Dec-10 1:48 
Question10 digit Crypted Value Pin
Enobong Adahada6-Dec-10 22:48
Enobong Adahada6-Dec-10 22:48 
AnswerRe: 10 digit Crypted Value Pin
OriginalGriff7-Dec-10 0:40
mveOriginalGriff7-Dec-10 0:40 
GeneralRe: 10 digit Crypted Value Pin
Enobong Adahada7-Dec-10 0:59
Enobong Adahada7-Dec-10 0:59 
GeneralRe: 10 digit Crypted Value Pin
OriginalGriff7-Dec-10 1:09
mveOriginalGriff7-Dec-10 1:09 
AnswerRe: 10 digit Crypted Value Pin
Yvan Rodrigues12-Dec-10 13:59
professionalYvan Rodrigues12-Dec-10 13:59 
AnswerRe: 10 digit Crypted Value Pin
Sathesh Sakthivel7-Dec-10 0:52
Sathesh Sakthivel7-Dec-10 0:52 
GeneralRe: 10 digit Crypted Value Pin
Enobong Adahada7-Dec-10 1:03
Enobong Adahada7-Dec-10 1:03 
here is my code:

public static string iEncrypt(string plainText, string passPhrase, string saltValue,
string HashAlgorithm, int passwordIterations, string initVector,
int KeySizes)
{
byte[] initVectorBytes = Encoding.ASCII.GetBytes(initVector);
byte[] saltValueBytes = Encoding.ASCII.GetBytes(saltValue);
byte[] plainTextBytes = Encoding.UTF8.GetBytes(plainText);
PasswordDeriveBytes password = new PasswordDeriveBytes(passPhrase, saltValueBytes, HashAlgorithm, passwordIterations);
byte[] keyBytes = password.GetBytes(KeySizes / 8);
RijndaelManaged symmetricaKey = new RijndaelManaged();
symmetricaKey.Mode = CipherMode.CBC;
ICryptoTransform encryptor = symmetricaKey.CreateEncryptor(keyBytes, initVectorBytes);
MemoryStream memoryStream = new MemoryStream();
CryptoStream cryptoStream = new CryptoStream(memoryStream, encryptor, CryptoStreamMode.Write);
cryptoStream.Write(plainTextBytes, 0, plainTextBytes.Length);
cryptoStream.FlushFinalBlock();
byte[] cipherTextBytes = memoryStream.ToArray();
memoryStream.Close();
cryptoStream.Close();
string cipherText = Convert.ToBase64String(cipherTextBytes);
return cipherText;
}




static void Main(string[] args)
{
//string plainText="Hello World!";
string plainText;
string passPhrase = "Pas5pr@se";
//string passPhrase = "123456789";
//string saltValue = "123456789";//s@ltValue";
string saltValue = "s@ltValue";
string hashAlgorithm = "SHA1";
int passwordIterations = 1;
//string initVector = "abcdefghijklmnop";//@1B2c3D4e5F6g7H8";
string initVector = "@1B2c3D4e5F6g7H8";
int keySize = 64;//256;
//Console.WriteLine(string.Format("Plaintext : {0}", plainText));
Console.WriteLine(string.Format("Type Plaintext : "));
plainText= Console.ReadLine();
string cipherText = dEncrypt.iEncrypt(plainText, passPhrase, saltValue, hashAlgorithm, passwordIterations, initVector, keySize);
Console.WriteLine(string.Format("Encrypted : {0}", cipherText));

}
GeneralRe: 10 digit Crypted Value Pin
Not Active7-Dec-10 2:16
mentorNot Active7-Dec-10 2:16 
QuestionASP C# WebSite to load a simple CSV File Pin
gorovdude6-Dec-10 21:54
gorovdude6-Dec-10 21:54 
AnswerRe: ASP C# WebSite to load a simple CSV File [modified] Pin
Dan Mos6-Dec-10 22:17
Dan Mos6-Dec-10 22:17 
QuestionRe: ASP C# WebSite to load a simple CSV File Pin
Luc Pattyn6-Dec-10 22:26
sitebuilderLuc Pattyn6-Dec-10 22:26 
AnswerRe: ASP C# WebSite to load a simple CSV File Pin
Dan Mos6-Dec-10 22:27
Dan Mos6-Dec-10 22:27 
GeneralRe: ASP C# WebSite to load a simple CSV File Pin
Luc Pattyn6-Dec-10 22:30
sitebuilderLuc Pattyn6-Dec-10 22:30 
GeneralRe: ASP C# WebSite to load a simple CSV File Pin
Dan Mos6-Dec-10 22:31
Dan Mos6-Dec-10 22:31 
GeneralRe: ASP C# WebSite to load a simple CSV File Pin
Luc Pattyn6-Dec-10 22:32
sitebuilderLuc Pattyn6-Dec-10 22:32 
AnswerRe: ASP C# WebSite to load a simple CSV File Pin
TweakBird7-Dec-10 1:35
TweakBird7-Dec-10 1:35 
AnswerRe: ASP C# WebSite to load a simple CSV File Pin
Alok Sharma ji7-Dec-10 1:49
Alok Sharma ji7-Dec-10 1:49 
GeneralRe: ASP C# WebSite to load a simple CSV File Pin
gorovdude7-Dec-10 1:52
gorovdude7-Dec-10 1:52 
AnswerRe: ASP C# WebSite to load a simple CSV File Pin
Muhammad Mazhar7-Dec-10 3:47
Muhammad Mazhar7-Dec-10 3:47 
QuestionLOGFONT in C# Pin
VCsamir6-Dec-10 19:46
VCsamir6-Dec-10 19:46 
AnswerRe: LOGFONT in C# Pin
_Erik_7-Dec-10 0:16
_Erik_7-Dec-10 0:16 
AnswerRe: LOGFONT in C# Pin
RaviRanjanKr17-Dec-10 17:46
professionalRaviRanjanKr17-Dec-10 17:46 
Questionhow to make excel with zero before the number in C# Pin
goldsoft6-Dec-10 19:31
goldsoft6-Dec-10 19:31 
AnswerRe: how to make excel with zero before the number in C# Pin
Mycroft Holmes6-Dec-10 20:49
professionalMycroft Holmes6-Dec-10 20:49 

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.