{"id":27064213,"url":"https://github.com/abeaumont/ocaml-chacha","last_synced_at":"2025-04-05T16:37:47.902Z","repository":{"id":26426327,"uuid":"105315220","full_name":"abeaumont/ocaml-chacha","owner":"abeaumont","description":"ChaCha20, ChaCha12 and ChaCha8 encryption functions, in OCaml","archived":false,"fork":false,"pushed_at":"2022-04-03T22:26:14.000Z","size":46,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2023-03-15T19:30:57.751Z","etag":null,"topics":["chacha","chacha20","cryptography","ocaml"],"latest_commit_sha":null,"homepage":"https://abeaumont.github.io/ocaml-chacha","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abeaumont.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-29T20:40:27.000Z","updated_at":"2023-02-12T08:57:58.000Z","dependencies_parsed_at":"2022-07-27T08:18:42.941Z","dependency_job_id":null,"html_url":"https://github.com/abeaumont/ocaml-chacha","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abeaumont%2Focaml-chacha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abeaumont%2Focaml-chacha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abeaumont%2Focaml-chacha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abeaumont%2Focaml-chacha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abeaumont","download_url":"https://codeload.github.com/abeaumont/ocaml-chacha/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247369796,"owners_count":20927923,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chacha","chacha20","cryptography","ocaml"],"created_at":"2025-04-05T16:37:47.221Z","updated_at":"2025-04-05T16:37:47.884Z","avatar_url":"https://github.com/abeaumont.png","language":"OCaml","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![docs](https://img.shields.io/badge/doc-online-blue.svg)](https://abeaumont.github.io/ocaml-chacha)\n[![Build Status](https://travis-ci.org/abeaumont/ocaml-chacha.svg?branch=master)](https://travis-ci.org/abeaumont/ocaml-chacha)\n\n# ChaCha family of encryption functions, in OCaml\n\nAn OCaml implementation of [ChaCha](https://cr.yp.to/chacha/chacha-20080120.pdf) functions,\nboth ChaCha20 and the reduced ChaCha8 and ChaCha12 functions.\nThe hot loop is implemented in C for efficiency reasons.\n\n## Installation\n\n```\nopam install chacha\n```\n\n## Usage\n\n```ocaml\nutop[0]\u003e #require \"mirage-crypto\";;\nutop[1]\u003e #require \"mirage-crypto-rng.unix\";;\nutop[2]\u003e Mirage_crypto_rng_unix.initialize ();;\n- : unit = ()\nutop[3]\u003e let key = Mirage_crypto_rng.generate 32;;\nval key : Cstruct.t = {Cstruct.buffer = \u003cabstr\u003e; off = 0; len = 32}\nutop[4]\u003e let nonce = Cstruct.create 8;;\nval nonce : Cstruct.t = {Cstruct.buffer = \u003cabstr\u003e; off = 0; len = 8}\nutop[5]\u003e #require \"chacha\";;\nutop[6]\u003e let state = Chacha.create key nonce;;\nval state : Chacha.t = \u003cabstr\u003e\nutop[7]\u003e Chacha.encrypt (Cstruct.of_string \"My secret text\") state |\u003e Cstruct.to_string;;\n- : string = \"\\026m.\\\\363\\\\026\\\\263\\\\207Xg\\\\256l\\\\262\\\\232F\"\n```\n\n* Key can either 32 (recommended) or 16 bytes\n* Chacha state may use a different hashing function,\n  the recommended `Chacha_core.chacha20` is used by default.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabeaumont%2Focaml-chacha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabeaumont%2Focaml-chacha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabeaumont%2Focaml-chacha/lists"}