/* * (c) Copyright, Real-Time Innovations, 2025. * All rights reserved. * * No duplications, whole or partial, manual or electronic, may be made * without express written permission. Any such copies, or * revisions thereof, must display this notice unaltered. * This code contains trade secrets of Real-Time Innovations, Inc. */ #ifndef osapi_sha1_h #define osapi_sha1_h #include "osapi/osapi_dll.h" #include "osapi/osapi_type.h" #define RTI_OSAPI_SHA1_DIGEST_SIZE 20 #ifdef __cplusplus extern "C" { #endif /** * @internal * @brief SHA1 state structure for incremental hashing. */ struct RTIOsapiSHA1State { RTI_UINT32 State[5]; RTI_UINT32 Count[2]; RTI_UINT8 Buffer[64]; }; /** * @internal * @brief Initializes or resets a SHA1 state. * * @attention This SHA1 implementation is not intended for use in any * security-related features and MUST NOT BE USED for such purposes. * * @param[out] self Pointer to the SHA1 state to initialize. */ extern RTIOsapiDllExport void RTIOsapiSHA1State_start( struct RTIOsapiSHA1State *self); /** * @internal * @brief Adds data to the SHA1 state. * * This processes the data and updates the internal state. * Call repeatedly until all data is added, then call RTIOsapiSHA1State_finish. * * @attention This SHA1 implementation is not intended for use in any * security-related features and MUST NOT BE USED for such purposes. * * @param[in,out] self Pointer to the SHA1 state. * @param[in] input Pointer to the data buffer to add. * @param[in] inputSize Size of the data buffer in bytes. */ extern RTIOsapiDllExport void RTIOsapiSHA1State_update( struct RTIOsapiSHA1State *self, const RTI_UINT8 *input, RTI_UINT32 inputSize); /** * @internal * @brief Finalizes the SHA1 hash and writes the digest. * * After calling this, RTIOsapiSHA1State_start must be used to reuse the state. * * @attention This SHA1 implementation is not intended for use in any * security-related features and MUST NOT BE USED for such purposes. * * @param[in,out] self Pointer to the SHA1 state. * @param[out] digest Pointer to a buffer to receive the hash. */ extern RTIOsapiDllExport void RTIOsapiSHA1State_finish( struct RTIOsapiSHA1State *self, RTI_UINT8 *digest); /** * @internal * @brief Calculates the SHA1 hash of a buffer in one call. * * Combines start, update, and finish into a single operation. * * @attention This SHA1 implementation is not intended for use in any * security-related features and MUST NOT BE USED for such purposes. * * @param[out] digest Pointer to a buffer to receive the hash. * @param[in] input Pointer to the data buffer to hash. * @param[in] inputSize Size of the data buffer in bytes. */ extern RTIOsapiDllExport void RTIOsapiSHA1_computeSHA1( RTI_UINT8 *digest, const char *input, size_t inputSize); #ifdef __cplusplus } /* extern "C" */ #endif #endif /* osapi_sha1_h */