hyperic
Results 1 to 9 of 9

Thread: How to encrypt string in c#...

Threaded View

  1. #1
    svr2112 Guest

    How to encrypt string in c#...

    You can use following code for encryption

    private string encryptString(string strToEncrypt)
    {
    System.Text.UTF8Encoding ue = new System.Text.UTF8Encoding();
    byte[] bytes = ue.GetBytes(strToEncrypt);

    // encrypt bytes
    System.Security.Cryptography.MD5CryptoR*0; der md5 = new System.Security.Cryptography.MD5CryptoSeR*0; der();
    byte[] hashBytes = md5.ComputeHash(bytes);

    // Convert the encrypted bytes back to a string (base *6)
    string hashString = "";

    for(int i=0;i
    {
    hashString += Convert.ToString(hashBytes[i],*6).PadLefR*0;
    }

    return hashString.PadLeft(*2,'0');
    }

    _____________
    Last edited by DougN; 06-09-2015 at 05:10 PM.

Similar Threads

  1. how to encrypt private photos?
    By meiling277869 in forum Security & Encryption
    Replies: 5
    Last Post: 12-14-2009, 03:02 AM
  2. My Encrypt program help
    By Moonbat in forum Security & Encryption
    Replies: 8
    Last Post: 09-23-2006, 01:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts