calog/libs/calogCrypto.h
2026-07-03 02:13:23 -05:00

26 lines
1.1 KiB
C

// calogCrypto.h -- calog cryptography library.
//
// Bridges binary-safe calog strings to OpenSSL's one-shot primitives, so any engine gets
// hashing, HMAC, randomness, and common encodings without an engine-specific library:
// hashSha256(data) -> lowercase hex digest (64 chars)
// hashSha1(data) -> lowercase hex digest (40 chars)
// hmacSha256(key, data) -> lowercase hex HMAC-SHA-256 (64 chars)
// randomBytes(count) -> binary string of count cryptographically-random bytes
// base64Encode(data) -> base64 text
// base64Decode(text) -> decoded binary string
// hexEncode(data) -> lowercase hex text
// hexDecode(hexText) -> decoded binary string
// uuid() -> random RFC 4122 version-4 UUID string
// All natives are binary-safe and INLINE (pure computation over OpenSSL one-shots, no shared
// state), so there is nothing to shut down.
#ifndef CALOG_CRYPTO_H
#define CALOG_CRYPTO_H
#include "calog.h"
// Register the crypto natives on a runtime. Stateless: safe to call on any number of
// runtimes, and there is no matching shutdown.
int32_t calogCryptoRegister(CalogT *calog);
#endif