cryptnox-pos 1.0.0
Standalone USDC payment terminal firmware (ESP32 + Cryptnox smart card)
Loading...
Searching...
No Matches
eth_addr.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: LGPL-3.0-or-later
3 * Copyright (c) 2026 Cryptnox SA
4 */
5
12
13#ifndef ETH_ADDR_H
14#define ETH_ADDR_H
15
16#include <stdint.h>
17#include <stddef.h>
18#include <stdbool.h> /* eth_addr_parse returns bool — keep this header self-contained */
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
25#define ETH_ADDR_LEN 20U
34#define ETH_ADDR_HEX_LEN ((size_t)ETH_ADDR_LEN * 2U)
35
51bool eth_addr_parse(const char *hex, uint8_t out[ETH_ADDR_LEN]);
52
68bool eth_addr_format(const uint8_t addr[ETH_ADDR_LEN], char *out, size_t n);
69
70#ifdef __cplusplus
71}
72#endif
73
74#endif /* ETH_ADDR_H */
#define ETH_ADDR_LEN
Length of a raw (binary) Ethereum address, in bytes.
Definition eth_addr.h:25
bool eth_addr_parse(const char *hex, uint8_t out[ETH_ADDR_LEN])
Parse a 20-byte Ethereum address from a hex string.
Definition eth_addr.cpp:34
bool eth_addr_format(const uint8_t addr[ETH_ADDR_LEN], char *out, size_t n)
Render a 20-byte address as an EIP-55 mixed-case "0x..." string.
Definition eth_addr.cpp:109