Fun 0.41.5
The programming language that makes You have fun
Loading...
Searching...
No Matches
md5.c File Reference

Implements OP_OPENSSL_MD5 to compute an MD5 hash in hexadecimal. More...

Go to the source code of this file.

Functions

 free_value (vdata)
 if (!s)
 free (s)
 free (hex)
 push_value (vm, out)

Variables

case OP_OPENSSL_MD5
char * s = value_to_string_alloc(&vdata)
char * hex = fun_openssl_md5_hex((const unsigned char *)s, strlen(s))
Value out = make_string(hex)
 break

Detailed Description

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.

Definition in file md5.c.

Function Documentation

◆ free() [1/2]

free(hex)

◆ free() [2/2]

free(s)

◆ free_value()

free_value(vdata)

◆ if()

if(!s)

Definition at line 35 of file md5.c.

Here is the call graph for this function:

◆ push_value()

push_value(vm,
out )
Here is the caller graph for this function:

Variable Documentation

◆ break

break

Definition at line 48 of file md5.c.

◆ hex

char* hex = fun_openssl_md5_hex((const unsigned char *)s, strlen(s))

Definition at line 39 of file md5.c.

◆ OP_OPENSSL_MD5

case OP_OPENSSL_MD5

Definition at line 31 of file md5.c.

◆ out

Definition at line 45 of file md5.c.

◆ s

char* s = value_to_string_alloc(&vdata)

Definition at line 33 of file md5.c.