DeterministicESPAsyncWebServer 1.2.0
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
sha1.h
Go to the documentation of this file.
1// Copyright (C) 2026 Douglas Quigg (dstroy0) <dquigg123@gmail.com>
2// SPDX-License-Identifier: AGPL-3.0-or-later
3
4/**
5 * @file sha1.h
6 * @brief Software SHA-1 implementation — no platform dependencies.
7 *
8 * Used exclusively for the WebSocket opening handshake (RFC 6455 §4.2.2).
9 * Output is always a 20-byte digest.
10 *
11 * @author Douglas Quigg (dstroy0)
12 * @date 2026
13 */
14
15#ifndef DETERMINISTICESPASYNCWEBSERVER_SHA1_H
16#define DETERMINISTICESPASYNCWEBSERVER_SHA1_H
17
18#include <stddef.h>
19#include <stdint.h>
20
21/** @brief SHA-1 digest length in bytes. */
22#define SHA1_DIGEST_LEN 20
23
24/**
25 * @brief Compute a SHA-1 digest over an arbitrary byte buffer.
26 *
27 * @param data Input bytes.
28 * @param len Number of input bytes.
29 * @param digest Output buffer; must be at least SHA1_DIGEST_LEN bytes.
30 */
31void sha1(const uint8_t *data, size_t len, uint8_t digest[SHA1_DIGEST_LEN]);
32
33#endif
void sha1(const uint8_t *data, size_t len, uint8_t digest[SHA1_DIGEST_LEN])
Compute a SHA-1 digest over an arbitrary byte buffer.
Definition sha1.cpp:24
#define SHA1_DIGEST_LEN
SHA-1 digest length in bytes.
Definition sha1.h:22