QSC Post Quantum Cryptographic Library 1.0.0.6c (A6)
A post quantum secure library written in Ansi C
 
Loading...
Searching...
No Matches
arrayutils.h
Go to the documentation of this file.
1/*
2 * ================= LICENSE INFORMATION =================
3 * 2025 Quantum Resistant Cryptographic Solutions Corporation
4 * All Rights Reserved.
5 *
6 * NOTICE: This software and all accompanying materials are the exclusive
7 * property of Quantum Resistant Cryptographic Solutions Corporation (QRCS).
8 * The intellectual and technical concepts contained within this implementation
9 * are proprietary to QRCS and its authorized licensors and are protected under
10 * applicable U.S. and international copyright, patent, and trade secret laws.
11 *
12 * CRYPTOGRAPHIC STANDARDS:
13 * - This software includes implementations of cryptographic algorithms such as
14 * SHA3, AES, and others. These algorithms are public domain or standardized
15 * by organizations such as NIST and are NOT the property of QRCS.
16 * - However, all source code, optimizations, and implementations in this library
17 * are original works of QRCS and are protected under this license.
18 *
19 * RESTRICTIONS:
20 * - Redistribution, modification, or unauthorized distribution of this software,
21 * in whole or in part, is strictly prohibited.
22 * - This software is provided for non-commercial, educational, and research
23 * purposes only. Commercial use in any form is expressly forbidden.
24 * - Licensing and authorized distribution are solely at the discretion of QRCS.
25 * - Any use of this software implies acceptance of these restrictions.
26 *
27 * DISCLAIMER:
28 * This software is provided "as is," without warranty of any kind, express or
29 * implied, including but not limited to warranties of merchantability or fitness
30 * for a particular purpose. QRCS disclaims all liability for any direct, indirect,
31 * incidental, or consequential damages resulting from the use or misuse of this software.
32 *
33 * FULL LICENSE:
34 * This software is subject to the Quantum Resistant Cryptographic Solutions
35 * Proprietary License (QRCS-PL). The complete license terms are included
36 * in the LICENSE.txt file distributed with this software.
37 *
38 * Written by: John G. Underhill
39 * Contact: john.underhill@protonmail.com
40 */
41
42#ifndef QSC_ARRAYUTILS_H
43#define QSC_ARRAYUTILS_H
44
45#include "common.h"
46#include <stdio.h>
47
48QSC_CPLUSPLUS_ENABLED_START
49
89
96#define QSC_ARRAYTILS_NPOS -1LL
97
113QSC_EXPORT_API size_t qsc_arrayutils_find_string(const char* str, size_t slen, const char* token);
114
126QSC_EXPORT_API uint8_t qsc_arrayutils_hex_to_uint8(const char* str, size_t slen);
127
138QSC_EXPORT_API void qsc_arrayutils_uint8_to_hex(char* output, size_t otplen, uint8_t value);
139
150QSC_EXPORT_API void qsc_arrayutils_uint16_to_hex(char* output, size_t otplen, uint16_t value);
151
162QSC_EXPORT_API void qsc_arrayutils_uint32_to_hex(char* output, size_t otplen, uint32_t value);
163
174QSC_EXPORT_API void qsc_arrayutils_uint64_to_hex(char* output, size_t otplen, uint64_t value);
175
186QSC_EXPORT_API uint8_t qsc_arrayutils_string_to_uint8(const char* str, size_t slen);
187
198QSC_EXPORT_API uint16_t qsc_arrayutils_string_to_uint16(const char* str, size_t slen);
199
210QSC_EXPORT_API uint32_t qsc_arrayutils_string_to_uint32(const char* str, size_t slen);
211
222QSC_EXPORT_API uint64_t qsc_arrayutils_string_to_uint64(const char* str, size_t slen);
223
232
233QSC_CPLUSPLUS_ENABLED_END
234
235#endif
QSC_EXPORT_API uint8_t qsc_arrayutils_string_to_uint8(const char *str, size_t slen)
Parse an 8-bit unsigned integer from a string.
Definition arrayutils.c:90
QSC_EXPORT_API void qsc_arrayutils_uint8_to_hex(char *output, size_t otplen, uint8_t value)
Convert an 8-bit unsigned integer to a hexadecimal string.
Definition arrayutils.c:46
QSC_EXPORT_API void qsc_arrayutils_uint32_to_hex(char *output, size_t otplen, uint32_t value)
Convert a 32-bit unsigned integer to a hexadecimal string.
Definition arrayutils.c:68
QSC_EXPORT_API void qsc_arrayutils_uint64_to_hex(char *output, size_t otplen, uint64_t value)
Convert a 64-bit unsigned integer to a hexadecimal string.
Definition arrayutils.c:79
QSC_EXPORT_API uint64_t qsc_arrayutils_string_to_uint64(const char *str, size_t slen)
Parse a 64-bit unsigned integer from a string.
Definition arrayutils.c:141
QSC_EXPORT_API uint8_t qsc_arrayutils_hex_to_uint8(const char *str, size_t slen)
Convert a hexadecimal encoded string to an 8-bit unsigned integer.
Definition arrayutils.c:25
QSC_EXPORT_API uint32_t qsc_arrayutils_string_to_uint32(const char *str, size_t slen)
Parse a 32-bit unsigned integer from a string.
Definition arrayutils.c:124
QSC_EXPORT_API bool qsc_arrayutils_self_test(void)
Perform a self-test of the array utilities.
Definition arrayutils.c:158
QSC_EXPORT_API uint16_t qsc_arrayutils_string_to_uint16(const char *str, size_t slen)
Parse a 16-bit unsigned integer from a string.
Definition arrayutils.c:107
QSC_EXPORT_API void qsc_arrayutils_uint16_to_hex(char *output, size_t otplen, uint16_t value)
Convert a 16-bit unsigned integer to a hexadecimal string.
Definition arrayutils.c:57
QSC_EXPORT_API size_t qsc_arrayutils_find_string(const char *str, size_t slen, const char *token)
Find the first instance of a token in a string.
Definition arrayutils.c:5
Contains common definitions for the Quantum Secure Cryptographic (QSC) library.
#define QSC_EXPORT_API
API export macro for Microsoft compilers when importing from a DLL.
Definition common.h:520