Skip to content

Latest commit

 

History

History
157 lines (123 loc) · 5.08 KB

README.md

File metadata and controls

157 lines (123 loc) · 5.08 KB

HashMe - Hardware accelerated hash library for C++ (SIMD intrinsics)

Version Platform CPU CPP

Hardware acceleration for

Intel logo ARM logo

Contents

See also: License (zlib)

Description

Library is currently WIP! Will be updated frequently.

A simple to use, fast and modern C++20 Hash library which supports hardware accelerated algorithms (SIMD intrinsics) for x86 and ARMv8 (like AppleSilicon). See Performance and Benchmarks for speeds. The static library provides very easy integration in your projects and ultra high speeds for the most common hash algorithms like MD5, MD6, SHA0, SHA1, SHA2 (SHA224, SHA256, SHA384, SHA512), SHA3 (SHA3-224, SHA3-256, SHA3-384, SHA3-512), CRC16, CRC32, CRC64, CRC128 and others. See Supported hash algorithms for details. CMake build environment is supported, as well as generating projects for VisualStudio or Xcode.

TODO WRITE: STREAMING FOR LARGE FILES

Supported hash algorithms

CRC

Algorithm Supported Hardware acceleration (SIMD)
CRC16 ✅ Yes ❌ ARM  |  ❌ x86
CRC32 ✅ Yes ✅ ARM  |  ❌ x86
CRC64 (ECMA) ✅ Yes ❌ ARM  |  ❌ x86

MD

Algorithm Supported Hardware acceleration (SIMD)
MD5 ✅ Yes ❌ ARM  |  ❌ x86
MD6 ❌ WIP ❌ ARM  |  ❌ x86

SHA

Algorithm Supported Hardware acceleration (SIMD)
SHA1 ❌ WIP ❌ ARM  |  ❌ x86
SHA224 ✅ Yes ✅ ARM  |  ⚠️ x86
SHA256 ✅ Yes ✅ ARM  |  ⚠️ x86
SHA384 ✅ Yes ✅ ARM  |  ❌ x86
SHA512 ✅ Yes ✅ ARM  |  ❌ x86
SHA512/224 ❌ WIP ❌ ARM  |  ❌ x86
SHA512/256 ❌ WIP ❌ ARM  |  ❌ x86
SHA3-512 ❌ WIP ❌ ARM  |  ❌ x86

⚠️ = Work in progress ❌ = Not yet supported


Additional algorithms

Algorithm Supported Hardware acceleration
Base64 ❌ WIP ❌ ARM  |  ❌ x86

⚠️ = Work in progress ❌ = Not yet supported


Performance and Benchmarks

ARMv8 (M1 Pro AppleSilicon)

Apple Clang, Release build, -O3 optimization

CRC

Algorithm Speed (MB/s)
CRC16 Software 375.54 MB/s
CRC16 Hardware (SIMD) xxx MB/s
CRC32 Software 376.49 MB/s
CRC32 Hardware (SIMD) 8031.77 MB/s
CRC64 Software 378.56 MB/s
CRC64 Hardware (SIMD) xxx MB/s

MD

Algorithm Speed (MB/s)
MD5 Software 538.12 MB/s
MD5 Hardware (SIMD) xxx MB/s

SHA

Algorithm Speed (MB/s)
SHA224 Software 218.50 MB/s
SHA224 Hardware (SIMD) 1944.76 MB/s
SHA256 Software 217.76 MB/s
SHA256 Hardware (SIMD) 1944.79 MB/s
SHA384 Software 317.07 MB/s
SHA384 Hardware (SIMD) xxx MB/s
SHA512 Software 317.10 MB/s
SHA512 Hardware (SIMD) 1337.49 MB/s

x86_64 (Intel)

TODO

Getting the library

To download the library simply clone the repository:

git clone https://github.com/LostInCompilation/HashMe

Compiling

Compilation of the library and examples can be done using CMake and make. Additionally projects for VisualStudio and Xcode can be generated. Small Shell scripts for compiling and generating projects are included.

CMake

TODO

Visual Studio

TODO

Xcode

TODO

How to use it

Include the main header file of the library in your project:

#include "HashMe.hpp"

LINKING

If you prefer, directly use the namespace for the library:

using namespace HashMe;

A shorter namespace alias HMis also available:

using namespace HM;

TODO

Hardware acceleration

TODO

Included Examples

TODO