123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- using System;
- namespace Wayne.FDCPOSLibrary
- {
- public class MD5Crypter
- {
- System.Security.Cryptography.MD5CryptoServiceProvider cryptic;
- public static string passphrase = "DresserFusion}123";
- public MD5Crypter()
- {
- cryptic = new System.Security.Cryptography.MD5CryptoServiceProvider();
- cryptic.Initialize();
- }
- public byte[] getPassphrase()
- {
- return System.Text.Encoding.ASCII.GetBytes(MD5Crypter.passphrase);
-
- }
- public string getMD5Hash(string myString)
- {
- byte[] data = System.Text.Encoding.ASCII.GetBytes(myString);
-
- data = cryptic.ComputeHash(data);
- return System.Text.Encoding.ASCII.GetString(data, 0, data.GetLength(0));
-
- }
- public string getMD5Hash(byte[] data)
- {
- data = cryptic.ComputeHash(data);
- return System.Text.Encoding.ASCII.GetString(data, 0, data.GetLength(0));
-
- }
- public byte[] ComputeHash(byte[] data)
- {
- return cryptic.ComputeHash(data);
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public bool verifyMD5Hash(string input, string hash)
- {
-
- string hashOfInput = getMD5Hash(input);
-
- StringComparer comparer = StringComparer.OrdinalIgnoreCase;
- if (0 == comparer.Compare(hashOfInput, hash))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- }
- }
|