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

Implements OP_OPENSSL_RIPEMD160 to compute a RIPEMD-160 hash in hex. 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_RIPEMD160
char * s = value_to_string_alloc(&vdata)
char * hex = fun_openssl_ripemd160_hex((const unsigned char *)s, strlen(s))
Value out = make_string(hex)
 break

Detailed Description

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.

Definition in file ripemd160.c.

Function Documentation

◆ free() [1/2]

free(hex)

◆ free() [2/2]

free(s)

◆ free_value()

free_value(vdata)

◆ if()

if(!s)

Definition at line 33 of file ripemd160.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 46 of file ripemd160.c.

◆ hex

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

Definition at line 37 of file ripemd160.c.

◆ OP_OPENSSL_RIPEMD160

case OP_OPENSSL_RIPEMD160

Definition at line 29 of file ripemd160.c.

◆ out

Definition at line 43 of file ripemd160.c.

◆ s

char* s = value_to_string_alloc(&vdata)

Definition at line 31 of file ripemd160.c.