ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!
Home
Upgrade
Credits
Help
Search
Awards
Achievements
 3610

[C#] SHA1 & MD5 Hashing

by IcyJake - 11-16-2017 - 05:03 AM
#1
I got bored the other day and I don't visit this forum that much and I'm gonna try to change that, so to start that off, I'm going to share my class with you guys.

Code:
public class Hash
    {
        public string SHA1(string input)
        {
            byte[] hash;
            using (var sha1 = new System.Security.Cryptography.SHA1CryptoServiceProvider())
            {
                hash = sha1.ComputeHash(Encoding.Unicode.GetBytes(input));
            }
            var sb = new StringBuilder();
            foreach (byte b in hash) sb.AppendFormat("{0:x2}", b);
            return sb.ToString();
        }
        public string MD5(string input)
        {
            MD5 md5 = new MD5CryptoServiceProvider();
            string pass = Console.ReadLine();
            byte[] checkSum = md5.ComputeHash(Encoding.Unicode.GetBytes(input));
            string result = BitConverter.ToString(checkSum).Replace("-", String.Empty);
            return result.ToLower();
        }
    }

If you guys encounter any problems, just apprise me about it and I will try to implement some kind of fix to any problems. Enjoy. Cool
Reply

Messages In This Thread
[C#] SHA1 & MD5 Hashing - by IcyJake - 11-16-2017 - 05:03 AM
RE: [C#] SHA1 & MD5 Hashing - by adz8cika1 - 11-16-2017 - 12:42 PM
RE: [C#] SHA1 & MD5 Hashing - by IcyJake - 01-23-2018 - 04:58 PM
RE: [C#] SHA1 & MD5 Hashing - by FTPService - 03-08-2018 - 07:52 PM
RE: [C#] SHA1 & MD5 Hashing - by IcyJake - 03-11-2018 - 06:41 PM
RE: [C#] SHA1 & MD5 Hashing - by bitm0de - 03-22-2018 - 09:56 PM
RE: [C#] SHA1 & MD5 Hashing - by leeac - 03-22-2018 - 10:18 PM
RE: [C#] SHA1 & MD5 Hashing - by Testingout123 - 12-22-2018 - 04:46 AM

Users browsing: 2 Guest(s)