{"id":13626698,"url":"https://github.com/jedisct1/zig-charm","last_synced_at":"2025-04-11T18:07:54.157Z","repository":{"id":49155210,"uuid":"307778836","full_name":"jedisct1/zig-charm","owner":"jedisct1","description":"A Zig version of the Charm crypto library.","archived":false,"fork":false,"pushed_at":"2025-03-13T20:34:23.000Z","size":21,"stargazers_count":83,"open_issues_count":0,"forks_count":6,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-25T14:03:27.793Z","etag":null,"topics":["charm","crypto","cryptography","lightweight","xoodoo","zig","zig-package","ziglang"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jedisct1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-27T17:32:21.000Z","updated_at":"2025-03-14T00:18:07.000Z","dependencies_parsed_at":"2024-09-24T16:04:30.243Z","dependency_job_id":"06c5faf6-7902-41f6-b2dc-423118764338","html_url":"https://github.com/jedisct1/zig-charm","commit_stats":{"total_commits":29,"total_committers":3,"mean_commits":9.666666666666666,"dds":"0.13793103448275867","last_synced_commit":"9921e8a90a5d4078f9be69fe7e2f8c5b7b648383"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jedisct1%2Fzig-charm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jedisct1%2Fzig-charm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jedisct1%2Fzig-charm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jedisct1%2Fzig-charm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jedisct1","download_url":"https://codeload.github.com/jedisct1/zig-charm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248456370,"owners_count":21106603,"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":["charm","crypto","cryptography","lightweight","xoodoo","zig","zig-package","ziglang"],"created_at":"2024-08-01T21:02:26.944Z","updated_at":"2025-04-11T18:07:54.130Z","avatar_url":"https://github.com/jedisct1.png","language":"Zig","readme":"# charm\n\nA tiny, self-contained cryptography library, implementing authenticated encryption and keyed hashing.\n\nCharm was especially designed for memory-constrained devices, but can also be used to add encryption support to WebAssembly modules with minimal overhead.\n\nAny number of hashing and authenticated encryption operations can be freely chained using a single rolling state.\nIn this mode, each authentication tag authenticates the whole transcript since the beginning of the session.\n\nThe [original implementation](https://github.com/jedisct1/charm) was written in C and is used by the [dsvpn](https://github.com/jedisct1/dsvpn) VPN software.\n\nThis is a port to the [Zig](https://ziglang.org) language. It is fully compatible with the C version.\n\n## Usage\n\n### Setting up a session\n\nCharm requires a 256-bit key, and, if the key is reused for different sessions, a unique session identifier (`nonce`):\n\n```zig\nvar key: [Charm.key_length]u8 = undefined;\nstd.crypto.random.bytes(\u0026key);\n\nvar charm = Charm.new(key, null);\n```\n\n### Hashing\n\n```zig\nconst h = charm.hash(\"data\");\n```\n\n### Authenticated encryption\n\n#### Encryption\n\n```zig\nconst tag = charm.encrypt(msg[0..]);\n```\n\nEncrypts `msg` in-place and returns a 128-bit authentication tag.\n\n#### Decryption\n\nStarting from the same state as the one used for encryption:\n\n```zig\ntry charm.decrypt(msg[0..], tag);\n```\n\nReturns `error.AuthenticationFailed` if the authentication tag is invalid for the given message and the previous transcript.\n\n## Security guarantees\n\n128-bit security, no practical limits on the size and length of messages.\n\n## Other implementations:\n\n- [charm](https://github.com/jedisct1/charm) original implementation in C.\n- [charm.js](https://github.com/jedisct1/charm.js) a JavaScript (TypeScript) implementation.\n","funding_links":[],"categories":["Zig","Libraries"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjedisct1%2Fzig-charm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjedisct1%2Fzig-charm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjedisct1%2Fzig-charm/lists"}