.NET Framework

Work with SHA1 in C#

Introduction#

in this project you see how to work with SHA1 cryptographic hash function. for example get hash from string and how to crack SHA1 hash. source on git hub: https://github.com/mahdiabasi/SHA1Tool

#Generate SHA1 checksum of a file function

First you add System.Security.Cryptography and System.IO to your project

 public string GetSha1Hash(string filePath)
    {
        using (FileStream fs = File.OpenRead(filePath))
        {
            SHA1 sha = new SHA1Managed();
            return BitConverter.ToString(sha.ComputeHash(fs));
        }
    }

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow