libhydrogen Cryptographic Library

repository·master·Indexed 21 days ago

https://github.com/jedisct1/libhydrogen

A small, lightweight cryptographic library written in C99, designed for simplicity and security. It provides a high-level API based on Curve25519 and the Gimli permutation, featuring zero dynamic memory allocations and low stack requirements suitable for microcontrollers, Linux, BSD, MacOS, Windows, and Arduino.

Tokens
349
Snippets
0
Records
1
Agent score
23%

What's inside libhydrogen

  1. Overview of libhydrogen cryptographic library

    master

    libhydrogen is a small, easy-to-use, and hard-to-misuse cryptographic library designed for simplicity and security. It provides a consistent high-level API inspired by libsodium, focusing on solving common cryptographic problems rather than exposing low-level primitives.

    Key Features

    • High-level API: Designed to prevent common cryptographic mistakes.
    • Minimalist Core: Built using only two building blocks: the Curve25519 elliptic curve and the Gimli permutation.
    • Extremely Lightweight: Zero dynamic memory allocations and very low stack requirements (median: 32 bytes, max: 128 bytes), making it suitable for microcontrollers.
    • Easy Integration: Implemented as a single .c file per set of operations; adding a single file to your project is sufficient for use.
    • Portable: Written in standard C99. Supports Linux, *BSD, MacOS, Windows, and the Arduino IDE.
    • Secure Randomness: Capable of generating cryptographically-secure random numbers even on constrained hardware like Arduino boards.
    • Resilient: Designed to mitigate accidental misuse even on systems with unreliable PRGs or no clock.

    Non-goals

    • Providing multiple primitives for the same purpose.
    • Networking (though a Noise-based key exchange API is available).
    • Interoperability with other libraries.
    • Replacing libsodium (libhydrogen prioritizes minimal API surface and code size).