diff options
author | polwex <polwex@sortug.com> | 2025-10-05 21:56:51 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2025-10-05 21:56:51 +0700 |
commit | fcedfddf00b3f994e4f4e40332ac7fc192c63244 (patch) | |
tree | 51d38e62c7bdfcc5f9a5e9435fe820c93cfc9a3d /vere/pkg/noun/jets/e/ripe.c |
claude is gud
Diffstat (limited to 'vere/pkg/noun/jets/e/ripe.c')
-rw-r--r-- | vere/pkg/noun/jets/e/ripe.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/vere/pkg/noun/jets/e/ripe.c b/vere/pkg/noun/jets/e/ripe.c new file mode 100644 index 0000000..5d08a9d --- /dev/null +++ b/vere/pkg/noun/jets/e/ripe.c @@ -0,0 +1,45 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" +#include "urcrypt.h" + + static u3_atom + _cqe_ripe(u3_atom wid, u3_atom dat) + { + c3_w len_w; + if ( !u3r_word_fit(&len_w, wid) ) { + return u3m_bail(c3__fail); + } + else { + u3_atom ret; + c3_y out_y[20]; + c3_y *dat_y = u3r_bytes_alloc(0, len_w, dat); + + ret = ( 0 == urcrypt_ripemd160(dat_y, len_w, out_y) ) + ? u3i_bytes(20, out_y) + : u3_none; + + u3a_free(dat_y); + return ret; + } + } + + u3_noun + u3we_ripe(u3_noun cor) + { + u3_noun wid, dat; + + if ( (c3n == u3r_mean(cor, u3x_sam_2, &wid, + u3x_sam_3, &dat, 0) || + u3ud(wid) || u3ud(dat)) + ) + { + return u3m_bail(c3__exit); + } + else { + return u3l_punt("ripe", _cqe_ripe(wid, dat)); + } + } |