• ¡Welcome to Square Theme!
  • This news are in header template.
  • Please ignore this message.
مهمان عزیز خوش‌آمدید. ورود عضــویت


امتیاز موضوع:
  • 7 رای - 3 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
Title: Generate an MD5 hash of a given string
حالت موضوعی
#1
کد پی‌اچ‌پی:
Generate an MD5 hash of a given string
This is a snippet used to produce an MD5 hash of the string provided 

کد پی‌اچ‌پی:
InstructionsNeed references to the following Namespaces

System.Security.Cryptography
System.Web.Security

در کد زیر ساخت کد هش md5 رو در سی شارپ یاد میگیرید.
کد:
/// <summary>
/// method to generate a MD5 hash of a string
/// </summary>
/// <param name="strToHash">string to hash</param>
/// <returns>hashed string</returns>
public string GenerateMD5(string str)
{
    MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();

    byte[] byteArray = Encoding.ASCII.GetBytes(str);

    byteArray = md5.ComputeHash(byteArray);

    string hashedValue = "";

    foreach (byte b in byteArray)
    {
        hashedValue += b.ToString("x2");
    }

    return hashedValue;
}
گروه دور همی پارسی کدرز
https://t.me/joinchat/GxVRww3ykLynHFsdCvb7eg
 
پاسخ
  


موضوعات مشابه ...
موضوع نویسنده پاسخ بازدید آخرین ارسال
  Connection String mahsa_18 1 3,009 07-17-2013، 09:06 AM
آخرین ارسال: Amin_Mansouri

پرش به انجمن:


Browsing: 1 مهمان