SHA implementation in pure C# (.NET 8) Available hash algorithms:
- SHA-1
- SHA2-224
- SHA2-256
- SHA2-384
- SHA2-512
Project contains two parts:
- SHA.NET - library with all SHA algorithms implementations
- SHA_Checksum - simple program to create a hash value of the file
This part contains SHA algorithms implementations. All uses pointers and some performance tricks like ArrayPool<T>.Shared or MethodImpl(MethodImplOptions.AggressiveInlining) attribute to be as fast as possible. If You never use pointers in C# You can look at this project to see how to use it. It was something new for me also.
Simple one-file program which is used to create and print in command line the hash value of the file.
This program will be hard to use, so we can add some registry entries that allows to create hash values for all files.
To achieve it You will need to run dotnet fsi config_registry.fsx
in command line. It is important that You have to run cmd with admin priviliges. If you've ever wondered how to add options to context menu, this could be a good example for You.
- build SHA_Checksum project using
dotnet build -c Release
command - run
dotnet fsi config_registry.fsx
in command line with admin priviliges - to use the program, right click on any file and select SHA Checksum option (in Windows 11 this option will be available after clicking Show more options button).