diff options
| author | Estevan Castilho <tevo@riajuu.net> | 2026-08-29 02:28:12 +0000 |
|---|---|---|
| committer | Estevan Castilho <tevo@riajuu.net> | 2026-08-29 02:28:42 +0000 |
| commit | 5fe3502865a9d9e187bb9560dc42bb7a1439e588 (patch) | |
| tree | bf5c266fd9275e3c3841fb7579254930cd8a4e8d /lib/concepts/Hash.ml | |
| parent | f87767c3e5b0f1920a6179d5cd0d4613cca92658 (diff) | |
| download | RNT-5fe3502865a9d9e187bb9560dc42bb7a1439e588.tar.gz RNT-5fe3502865a9d9e187bb9560dc42bb7a1439e588.zip | |
Identity mixins
Diffstat (limited to 'lib/concepts/Hash.ml')
| -rw-r--r-- | lib/concepts/Hash.ml | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/concepts/Hash.ml b/lib/concepts/Hash.ml index 922851a..5f023fc 100644 --- a/lib/concepts/Hash.ml +++ b/lib/concepts/Hash.ml @@ -11,6 +11,11 @@ let hash_of_bytes bytes = Digestif.SHA256.digest_bytes bytes let hash_of_blob blob = Blob.bytes_of_blob blob |> Digestif.SHA256.digest_bytes +let hash_of_int i = + let b = Blob.create 8 in + Blob.set_int64_be b 0 (Int64.of_int i); + hash_of_blob b + let bytes_of_hash (h : hash) = Bytes.of_string (Digestif.SHA256.to_raw_string h) let blob_of_hash h = bytes_of_hash h |> Blob.blob_of_bytes |
