Skip to content

Repository files navigation

SharpHash LicenseBuild StatusNugetNuget

SharpHash is a C# hashing library that provides a fluent interface for computing hashes and checksums of strings, files, streams, bytearrays and untyped data to mention but a few.

It also supports Incremental Hashing, Cloning, NullDigest and HashName Builder.

Available Algorithms

Hashes


Cyclic Redundancy Checks
  • All CRC Variants from CRC3 to CRC64 ✔️
Checksums
  • Adler32 ✔️
Non-Cryptographic Hash Functions

32 bit hashes
  • APBKDRBernsteinBernstein1DEKDJBELFFNV ✔️

  • FNV1aJSJenkins3Murmur2MurmurHash3_x86_32OneAtTime ✔️

  • PJWRSRotatingSDBMShiftAndXorSuperFastXXHash32 ✔️

64 bit hashes
  • FNV64FNV1a64Murmur2_64SipHash64_2_4XXHash64 ✔️
128 bit hashes
  • MurmurHash3_x86_128MurmurHash3_x64_128SipHash128_2_4 ✔️
Cryptographic Hash Functions

  • MD2 ✔️

  • MD4 ✔️

  • MD5 ✔️

  • SHA-0 ✔️

  • SHA-1 ✔️

  • SHA-2 (224, 256, 384, 512, 512-224, 512-256) ✔️

  • GOST 34.11-94 ✔️

  • GOST R 34.11-2012 (AKA Streebog) (256, 512) ✔️

  • Grindahl (256, 512) ✔️

  • HAS160 ✔️

  • RIPEMD (128, 256, 256, 320) ✔️

  • Tiger (128, 160, 192 (Rounds 3, 4, 5)) ✔️

  • Tiger2 (128, 160, 192 (Rounds 3, 4, 5)) ✔️

  • Snefru (128, 256) ✔️

  • Haval (128, 160, 192, 224, 256 (Rounds 3, 4, 5)) ✔️

  • Panama ✔️

  • RadioGatun (RadioGatun32, RadioGatun64) ✔️

  • WhirlPool ✔️

  • Blake2B (160, 256, 384, 512) ✔️

  • Blake2S (128, 160, 224, 256) ✔️

  • SHA-3 (224, 256, 384, 512) ✔️

  • Keccak (224, 256, 288, 384, 512) ✔️

  • Blake2BP ✔️

  • Blake2SP ✔️

  • Blake3 ✔️

Key Derivation Functions


Password Hashing Schemes (Password Based Key Derivation Functions)

  • PBKDF2 ✔️

  • Argon2 (2i, 2d and 2id variants) ✔️

  • Scrypt ✔️

MAC


  • HMAC (all supported hashes) ✔️

  • KMAC (KMAC128, KMAC256) ✔️

  • Blake2MAC (Blake2BMAC, Blake2SMAC) ✔️

XOF (Extendable Output Function)


  • Shake (Shake-128, Shake-256) ✔️

  • CShake (CShake-128, CShake-256) ✔️

  • Blake2X (Blake2XS, Blake2XB) ✔️

  • KMACXOF (KMAC128XOF, KMAC256XOF) ✔️

  • Blake3XOF ✔️

Usage Examples


usingSharpHash.Base;usingSharpHash.Interfaces;usingSystem;usingSystem.Text;namespaceProgram{publicclassHello{publicstaticvoidMain(){// Chaining modestringresult=HashFactory.Crypto.CreateMD5().ComputeString("Hello C#",Encoding.UTF8).ToString();// Incremental modeIHashhash=HashFactory.Crypto.CreateMD5();hash.Initialize();hash.TransformString("Hello",Encoding.UTF8);hash.TransformString(" C#",Encoding.UTF8);stringresult_2=hash.TransformFinal().ToString();boolcheck=result==result_2;// Using the HashName Builder variationIHashhash_builder=HashFactory.CreateHash("md5");stringresult_3=hash_builder.ComputeString("Hello C#",Encoding.UTF8).ToString();boolcheck_2=result==result_3;}}}

Other Implementations


If you want implementations in other languages, you can check out these

Tip Jar


  • 💵 Bitcoin: 1Mcci95WffSJnV6PsYG7KD1af1gDfUvLe6

About

SharpHash is a C# hashing library which provides an easy to use interface for computing hashes and checksums of data. It also supports state based (incremental) hashing.

Topics

Resources

Stars

47 stars

Watchers

3 watching

Forks

Used by

Contributors

Languages