All Projects → h5p9sl → hmac_sha256

h5p9sl / hmac_sha256

Licence: Unlicense license
Minimal HMAC-SHA256 implementation in C / C++

Programming Languages

c
50402 projects - #5 most used programming language
C++
36643 projects - #6 most used programming language
CMake
9771 projects

Projects that are alternatives of or similar to hmac sha256

cryptosuite2
Cryptographic suite for Arduino (SHA, HMAC-SHA)
Stars: ✭ 23 (-34.29%)
Mutual labels:  hmac, hmac-sha256
pbkdf2-hmac-sha256
sha256, hmac with sha256 and pbkdf2 with hmac-sha256 in one header file
Stars: ✭ 19 (-45.71%)
Mutual labels:  hmac, hmac-sha256
rust-hmac-sha256
A small, self-contained SHA256 and HMAC-SHA256 implementation.
Stars: ✭ 24 (-31.43%)
Mutual labels:  hmac, hmac-sha256
hkdf
A standalone Java 7 implementation of HMAC-based key derivation function (HKDF) defined in RFC 5869 first described by Hugo Krawczyk. HKDF follows the "extract-then-expand" paradigm which is compatible to NIST 800-56C Rev. 1 two step KDF
Stars: ✭ 47 (+34.29%)
Mutual labels:  hmac, hmac-sha256
lazysodium-java
A Java implementation of the Libsodium crypto library. For the lazy dev.
Stars: ✭ 110 (+214.29%)
Mutual labels:  hmac
mpc
Secure Multi-Party Computation (MPC) with Go. This project implements secure two-party computation with Garbled circuit protocol.
Stars: ✭ 41 (+17.14%)
Mutual labels:  hmac-sha256
Jwt
JSON Web Token library
Stars: ✭ 242 (+591.43%)
Mutual labels:  hmac
Orion
Usable, easy and safe pure-Rust crypto
Stars: ✭ 227 (+548.57%)
Mutual labels:  hmac
id-mask
IDMask is a Java library for masking internal ids (e.g. from your DB) when they need to be published to hide their actual value and to prevent forging. It has support optional randomisation has a wide support for various Java types including long, UUID and BigInteger. This library bases its security on strong cryptographic primitives.
Stars: ✭ 39 (+11.43%)
Mutual labels:  hmac
ngx http hmac secure link module
HMAC Secure Link module for NGINX.
Stars: ✭ 47 (+34.29%)
Mutual labels:  hmac
micro-service-practice
OpenStack+Docker+RestAPI+OAuth/HMAC+RabbitMQ/ZMQ+OpenResty/HAProxy/Nginx/APIGateway+Bootstrap/AngularJS+Ansible+K8S/Mesos/Marathon构建/探索微服务最佳实践。
Stars: ✭ 25 (-28.57%)
Mutual labels:  hmac
requests-http-signature
A Requests auth module for the IETF HTTP Message Signatures draft standard
Stars: ✭ 63 (+80%)
Mutual labels:  hmac
SpinalCrypto
SpinalHDL - Cryptography libraries
Stars: ✭ 36 (+2.86%)
Mutual labels:  hmac
webcrypto
A WebCrypto Polyfill for NodeJS
Stars: ✭ 111 (+217.14%)
Mutual labels:  hmac
larsign
Laravel signature certification with web API server.
Stars: ✭ 18 (-48.57%)
Mutual labels:  hmac
hmac.nim
HMAC-SHA1 and HMAC-MD5 hashing in Nim
Stars: ✭ 13 (-62.86%)
Mutual labels:  hmac
Privy
An easy, fast lib to correctly password-protect your data
Stars: ✭ 230 (+557.14%)
Mutual labels:  hmac
noble-hashes
Audited & minimal JS implementation of SHA2, SHA3, RIPEMD, BLAKE2/3, HMAC, HKDF, PBKDF2 & Scrypt
Stars: ✭ 213 (+508.57%)
Mutual labels:  hmac
hash-wasm
Lightning fast hash functions using hand-tuned WebAssembly binaries
Stars: ✭ 382 (+991.43%)
Mutual labels:  hmac
instacop
InstaCop — Enhanced shopping experience for the adidas.com online store 🦓
Stars: ✭ 68 (+94.29%)
Mutual labels:  hmac

hmac_sha256

Minimal HMAC-SHA256 implementation in C / C++

This repository provides minimal HMAC-Sha256 code you can copy into your own projects. The hmac_sha256 function looks like this:

size_t // Returns the number of bytes written to `out`
hmac_sha256(
    // [in]: The key and its length.
    //      Should be at least 32 bytes long for optimal security.
    const void* key, const size_t keylen,

    // [in]: The data to hash alongside the key.
    const void* data, const size_t datalen,

    // [out]: The output hash.
    //      Should be 32 bytes long. If it's less than 32 bytes,
    //      the resulting hash will be truncated to the specified length.
    void* out, const size_t outlen
);

Contributing

All contributions are welcome, feature requests, or issues. I aim to tailor this code not only for myself, but for other's use cases too.

Usage Example (C++)

const std::string str_data = "Hello World!";
const std::string str_key = "super-secret-key";
std::stringstream ss_result;
// Allocate memory for the HMAC
std::vector<uint8_t> out(SHA256_HASH_SIZE);
// Call hmac-sha256 function
hmac_sha256(
str_key.data(), str_key.size(),
str_data.data(), str_data.size(),
out.data(), out.size()
);

Sha256 Implementation

Big thank you to WjCryptLib for providing the Sha256 implementation of which this project is based off. If you need more public domain cryptographic functions in C (sha, aes, md5), check them out.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].