Native OCaml Rego/OPA policy engine
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-rego: add crypto.md5 / sha1 / sha256 / hmac.* builtins via digestif

+27 -1
+1
dune-project
··· 31 31 (menhirLib (>= 20230608)) 32 32 (uutf (>= 1.0)) 33 33 (ptime (>= 1.1)) 34 + (digestif (>= 1.2)) 34 35 (alcotest :with-test) 35 36 (odoc :with-doc) 36 37 (mdx :with-test)
+11 -1
lib/dune
··· 1 1 (library 2 2 (name rego) 3 3 (public_name rego) 4 - (libraries fmt nox-json astring re sedlex menhirLib nox-loc uutf ptime) 4 + (libraries 5 + fmt 6 + nox-json 7 + astring 8 + re 9 + sedlex 10 + menhirLib 11 + nox-loc 12 + uutf 13 + ptime 14 + digestif.c) 5 15 (preprocess 6 16 (pps sedlex.ppx))) 7 17
+15
lib/eval.ml
··· 2611 2611 Value.String (base64_decode_alpha b64url_alpha s) 2612 2612 (* Hex *) 2613 2613 | "hex.encode", [ Value.String s ] -> Value.String (hex_encode s) 2614 + (* Crypto hashes *) 2615 + | "crypto.md5", [ Value.String s ] -> 2616 + Value.String Digestif.MD5.(to_hex (digest_string s)) 2617 + | "crypto.sha1", [ Value.String s ] -> 2618 + Value.String Digestif.SHA1.(to_hex (digest_string s)) 2619 + | "crypto.sha256", [ Value.String s ] -> 2620 + Value.String Digestif.SHA256.(to_hex (digest_string s)) 2621 + | "crypto.hmac.md5", [ Value.String msg; Value.String key ] -> 2622 + Value.String Digestif.MD5.(to_hex (hmac_string ~key msg)) 2623 + | "crypto.hmac.sha1", [ Value.String msg; Value.String key ] -> 2624 + Value.String Digestif.SHA1.(to_hex (hmac_string ~key msg)) 2625 + | "crypto.hmac.sha256", [ Value.String msg; Value.String key ] -> 2626 + Value.String Digestif.SHA256.(to_hex (hmac_string ~key msg)) 2627 + | "crypto.hmac.sha512", [ Value.String msg; Value.String key ] -> 2628 + Value.String Digestif.SHA512.(to_hex (hmac_string ~key msg)) 2614 2629 | "hex.decode", [ Value.String s ] -> Value.String (hex_decode s) 2615 2630 (* URL query *) 2616 2631 | "urlquery.encode", [ Value.String s ] -> Value.String (url_encode s)