Click here to Skip to main content
15,881,709 members
Home / Discussions / C#
   

C#

 
AnswerRe: pls explain the error i have stated with the code....(wen i tend to insert the datas into the table) Pin
#realJSOP27-Jan-10 1:26
mve#realJSOP27-Jan-10 1:26 
GeneralRe: pls explain the error i have stated with the code....(wen i tend to insert the datas into the table) Pin
J4amieC27-Jan-10 2:55
J4amieC27-Jan-10 2:55 
GeneralRe: pls explain the error i have stated with the code....(wen i tend to insert the datas into the table) Pin
#realJSOP27-Jan-10 9:36
mve#realJSOP27-Jan-10 9:36 
GeneralRe: pls explain the error i have stated with the code....(wen i tend to insert the datas into the table) Pin
Roger Wright27-Jan-10 18:26
professionalRoger Wright27-Jan-10 18:26 
QuestionSSL Certificate Status? Pin
Sunil G27-Jan-10 0:55
Sunil G27-Jan-10 0:55 
AnswerRe: SSL Certificate Status? Pin
SeMartens27-Jan-10 1:41
SeMartens27-Jan-10 1:41 
AnswerRe: SSL Certificate Status? Pin
Matt Meyer27-Jan-10 5:02
Matt Meyer27-Jan-10 5:02 
QuestionEncrytion and decryption a string [modified] Pin
3bood.ghzawi27-Jan-10 0:44
3bood.ghzawi27-Jan-10 0:44 
Hello anyone..,
How we can differentiate between an encrypted and none encrypted txt???

i need a method for that, to using in my project...,
Please help me.........,,,

An encryption methode is below:

using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;
using System.Configuration;

namespace SharpPcap.EnCryptDecrypt
{
    public class CryptorEngine
    {
        public static string Encrypt(string toEncrypt, bool useHashing)
        {
            byte[] keyArray;
            byte[] toEncryptArray = UTF8Encoding.UTF8.GetBytes(toEncrypt);

            System.Configuration.AppSettingsReader settingsReader = new AppSettingsReader();
            // Get the key from config file
            string key = (string)settingsReader.GetValue("SecurityKey", typeof(String));
            //System.Windows.Forms.MessageBox.Show(key);
            if (useHashing)
            {
                MD5CryptoServiceProvider hashmd5 = new MD5CryptoServiceProvider();
                keyArray = hashmd5.ComputeHash(UTF8Encoding.UTF8.GetBytes(key));
                hashmd5.Clear();
            }
            else
                keyArray = UTF8Encoding.UTF8.GetBytes(key);

            TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider();
            tdes.Key = keyArray;
            tdes.Mode = CipherMode.ECB;
            tdes.Padding = PaddingMode.PKCS7;

            ICryptoTransform cTransform = tdes.CreateEncryptor();
            byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
            tdes.Clear();
            return Convert.ToBase64String(resultArray, 0, resultArray.Length);
        }
    }
}


Regards...

modified on Wednesday, January 27, 2010 6:56 AM

AnswerRe: Encrytion and decryption a string Pin
Keith Barrow27-Jan-10 1:13
professionalKeith Barrow27-Jan-10 1:13 
QuestionSQL connectivity issue in My own Windows Serive Pin
WinCrs27-Jan-10 0:29
WinCrs27-Jan-10 0:29 
AnswerRe: SQL connectivity issue in My own Windows Serive Pin
SeMartens27-Jan-10 0:53
SeMartens27-Jan-10 0:53 
AnswerRe: SQL connectivity issue in My own Windows Serive Pin
Covean27-Jan-10 1:01
Covean27-Jan-10 1:01 
AnswerRe: SQL connectivity issue in My own Windows Serive Pin
PIEBALDconsult27-Jan-10 5:32
mvePIEBALDconsult27-Jan-10 5:32 
GeneralRe: SQL connectivity issue in My own Windows Serive Pin
WinCrs27-Jan-10 18:19
WinCrs27-Jan-10 18:19 
Questionrecursive folder compare Pin
vantoora26-Jan-10 23:39
vantoora26-Jan-10 23:39 
AnswerRe: recursive folder compare Pin
SeMartens26-Jan-10 23:55
SeMartens26-Jan-10 23:55 
GeneralRe: recursive folder compare Pin
vantoora27-Jan-10 19:00
vantoora27-Jan-10 19:00 
GeneralRe: recursive folder compare Pin
vantoora29-Jan-10 2:16
vantoora29-Jan-10 2:16 
QuestionRendering issue C# Pin
Paul Harsent26-Jan-10 23:28
Paul Harsent26-Jan-10 23:28 
AnswerRe: Rendering issue C# Pin
tolw27-Jan-10 19:30
tolw27-Jan-10 19:30 
QuestionExplicit casting with Type variable Pin
Kaikus26-Jan-10 23:21
Kaikus26-Jan-10 23:21 
AnswerRe: Explicit casting with Type variable Pin
OriginalGriff26-Jan-10 23:45
mveOriginalGriff26-Jan-10 23:45 
GeneralRe: Explicit casting with Type variable Pin
Kaikus27-Jan-10 0:48
Kaikus27-Jan-10 0:48 
GeneralRe: Explicit casting with Type variable Pin
OriginalGriff27-Jan-10 1:16
mveOriginalGriff27-Jan-10 1:16 
GeneralRe: Explicit casting with Type variable Pin
Kaikus27-Jan-10 22:21
Kaikus27-Jan-10 22:21 

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.