HashLibCpp

This repository aims to provide an easy-to-use implementation of the Secure Hash Standard. (currently implemented are SHA224, SHA256 and SHA512)

All functions are implemented as specified in NIST-FIPS 180-4.

Feel free to fork, contribute to, use or open issues in, this repository. Since I am neither a C++ nor a cryptography professional, suggestions and or help is appreciated.

Status

Branch master dev
CMake CMake CMake
CircleCi CircleCI CircleCI
Flawfinder flawfinder flawfinder

Disclaimer

I am neither a C++ nor a cryptography professional, thus my implementation of the Secure Hash Standard should not be used in production code.

Example

SHA256:

// main.cpp
#include <iostream>
#include <HashLib/sha256.hpp>

int main() {
    std::string msg = "Hello World";
    auto sha256_hash = SHA2::SHA256::hash(msg);
    std::cout << "\nInput:  " << msg << "\nSHA256: " << sha256_hash;

    return 0;
}

Output:

Input:  Hello World
SHA256: a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e
Process finished with exit code 0

GitHub

View Github