Created
June 9, 2020 18:03
-
-
Save Thisura98/6de20cdee4e1288b869d14be39be3175 to your computer and use it in GitHub Desktop.
Describes a method to generate MD5 hashes in C#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Security.Cryptography; | |
public class PaymentPayHereController : BasePaymentController{ | |
/** | |
MD5 Hashes the input string. | |
Return value contains only lowercase alphabeticals and numbers. | |
*/ | |
private string GenerateHash(string input) | |
{ | |
MD5 provider = new MD5CryptoServiceProvider(); | |
Byte[] inputBytes = ASCIIEncoding.Default.GetBytes(input); | |
Byte[] hashBytes = provider.ComputeHash(inputBytes); | |
return BitConverter.ToString(hashBytes).Replace("-", "").ToLower(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment