1
0
Fork 0
forked from fun/fun

Doxygen code comment cleanups and new blog post. No code changes. (0.41.5)

This commit is contained in:
Johannes Findeisen 2026-05-01 15:15:42 +02:00
commit 4309ec2a52
212 changed files with 423 additions and 476 deletions

View file

@ -7,14 +7,27 @@
* https://opensource.org/license/apache-2-0
*/
/**
* @file md5.c
* @brief VM opcode snippet: compute MD5 hash (OP_MD5). Included by vm.c.
*/
/**
* OpenSSL MD5 builtin
* @file md5.c
* @brief Implements OP_OPENSSL_MD5 to compute an MD5 hash in hexadecimal.
*
* Behavior:
* - Pops one value from the VM stack and converts it to a byte sequence by
* obtaining its string representation using value_to_string_alloc().
* - Computes the MD5 digest of the resulting bytes via fun_openssl_md5_hex()
* and pushes the lowercase hexadecimal string back onto the stack.
* - On allocation or hashing failure, pushes an empty string ("").
*
* Notes:
* - Non-string inputs are accepted; they are stringified first.
* - This snippet is included by vm.c and executed when OP_OPENSSL_MD5 is
* dispatched.
*
* Errors:
* - This opcode does not terminate the VM. Failures result in an empty
* string being pushed.
*/
case OP_OPENSSL_MD5: {
Value vdata = pop_value(vm);
char *s = value_to_string_alloc(&vdata);

View file

@ -7,9 +7,25 @@
* https://opensource.org/license/apache-2-0
*/
/*
* OpenSSL RIPEMD-160 builtin
/**
* @file ripemd160.c
* @brief Implements OP_OPENSSL_RIPEMD160 to compute a RIPEMD-160 hash in hex.
*
* Behavior:
* - Pops one value from the VM stack and converts it to bytes by first
* producing its string representation with value_to_string_alloc().
* - Computes the RIPEMD-160 digest via fun_openssl_ripemd160_hex() and
* pushes the lowercase hexadecimal string.
* - On allocation or hashing failure, pushes an empty string ("").
*
* Notes:
* - Accepts any value type; non-strings are stringified first.
* - Included by vm.c and executed for OP_OPENSSL_RIPEMD160.
*
* Errors:
* - Does not abort the VM; failures result in an empty string.
*/
case OP_OPENSSL_RIPEMD160: {
Value vdata = pop_value(vm);
char *s = value_to_string_alloc(&vdata);

View file

@ -8,8 +8,24 @@
*/
/**
* OpenSSL SHA-256 builtin
* @file sha256.c
* @brief Implements OP_OPENSSL_SHA256 to compute a SHA-256 hash in hex.
*
* Behavior:
* - Pops one value from the VM stack and converts it to bytes by first
* producing its string form with value_to_string_alloc().
* - Computes the SHA-256 digest via fun_openssl_sha256_hex() and pushes the
* lowercase hexadecimal string.
* - On allocation or hashing failure, pushes an empty string ("").
*
* Notes:
* - Non-string inputs are allowed; values are stringified first.
* - Snippet is included by vm.c and executed for OP_OPENSSL_SHA256.
*
* Errors:
* - No hard VM error is raised; failures push an empty string.
*/
case OP_OPENSSL_SHA256: {
Value vdata = pop_value(vm);
char *s = value_to_string_alloc(&vdata);

View file

@ -8,8 +8,24 @@
*/
/**
* OpenSSL SHA-512 builtin
* @file sha512.c
* @brief Implements OP_OPENSSL_SHA512 to compute a SHA-512 hash in hex.
*
* Behavior:
* - Pops one value from the VM stack and converts it to bytes by first
* turning it into a string with value_to_string_alloc().
* - Computes the SHA-512 digest via fun_openssl_sha512_hex() and pushes the
* lowercase hexadecimal string back on the stack.
* - On allocation or hashing failure, pushes an empty string ("").
*
* Notes:
* - Non-string inputs are accepted and stringified first.
* - This file is included by vm.c and handles OP_OPENSSL_SHA512.
*
* Errors:
* - Does not abort the VM; failures return an empty string.
*/
case OP_OPENSSL_SHA512: {
Value vdata = pop_value(vm);
char *s = value_to_string_alloc(&vdata);