تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
عرفنا على php :: خاص لمبرمجي c# و vb.net
#2
اولا في C#
اولا نقوم بادراج المكتبات
كود :
using System.Security;
using System.Security.Cryptography;
وهذه الدالة تعود با هاش كود
كود :
public static string CalculateMD5Hash(string input)
        {
            // step 1, calculate MD5 hash from input
            MD5 md5 = System.Security.Cryptography.MD5.Create();
            byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
            byte[] hash = md5.ComputeHash(inputBytes);

            // step 2, convert byte array to hex string
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < hash.Length; i++)
            {
                sb.Append(hash[i].ToString("X2"));
            }
            return sb.ToString();
        }

ثانيا في VB.NET
المكتبات
كود :
Imports System.Security
Imports System.Security.Cryptography
كود :
Public Shared Function CalculateMD5Hash(input As String) As String
    ' step 1, calculate MD5 hash from input
    Dim md5 As MD5 = System.Security.Cryptography.MD5.Create()
    Dim inputBytes As Byte() = System.Text.Encoding.ASCII.GetBytes(input)
    Dim hash As Byte() = md5.ComputeHash(inputBytes)

    ' step 2, convert byte array to hex string
    Dim sb As New StringBuilder()
    For i As Integer = 0 To hash.Length - 1
        sb.Append(hash(i).ToString("X2"))
    Next
    Return sb.ToString()
End Function

والان لنشاهد لمسة PHP السحرية فقط
كود :
[md5($string)

ستعود الدالة md5 بالهاش كود تبع النص فرق شاسع انهوا سحر php
الرد }}}
تم الشكر بواسطة: sherif khalid , الكاتب


الردود في هذا الموضوع
عرفنا على php :: خاص لمبرمجي c# و vb.net - بواسطة oneyemenweb2_mybb_import4801 - 15-08-13, 03:39 PM

التنقل السريع :


يقوم بقرائة الموضوع: