{"id":17939404,"url":"https://github.com/libitx/eddy","last_synced_at":"2025-03-24T10:32:08.720Z","repository":{"id":65217386,"uuid":"588311229","full_name":"libitx/eddy","owner":"libitx","description":"A steady little Ed25519 library for Elixir.","archived":false,"fork":false,"pushed_at":"2023-01-12T23:37:24.000Z","size":1565,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-19T03:39:47.957Z","etag":null,"topics":["aldea","ed25519","eddsa","elixir","x25519"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/libitx.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}},"created_at":"2023-01-12T20:31:26.000Z","updated_at":"2024-09-09T15:39:08.000Z","dependencies_parsed_at":"2023-01-15T15:15:42.524Z","dependency_job_id":null,"html_url":"https://github.com/libitx/eddy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libitx%2Feddy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libitx%2Feddy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libitx%2Feddy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libitx%2Feddy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libitx","download_url":"https://codeload.github.com/libitx/eddy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245252426,"owners_count":20585060,"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":["aldea","ed25519","eddsa","elixir","x25519"],"created_at":"2024-10-29T00:07:10.086Z","updated_at":"2025-03-24T10:32:08.052Z","avatar_url":"https://github.com/libitx.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Eddy\n\n![Curvy](https://raw.githubusercontent.com/libitx/eddy/main/media/poster.png)\n\n![Hex.pm](https://img.shields.io/hexpm/v/eddy?color=informational)\n![License](https://img.shields.io/github/license/libitx/eddy?color=informational)\n![Build Status](https://img.shields.io/github/actions/workflow/status/libitx/eddy/elixir.yml?branch=main)\n\nMeet Eddy! A steady little `Ed25519` library for Elixir. Ed25519 is an elliptic\ncurve that can be used in signature schemes and ECDH shared secrets.\n\n## Highlights\n\n- Pure Elixir implementation of `Ed25519` (no external dependencies)\n- Secure generation of EdDSA key pairs\n- Ed25519 signature schemes\n- X25519 (ECDH) shared secrets\n- Build your own crypto - customisable hash algo\n\n## Instalation\n\nThe package can be installed by adding `eddy` to your list of dependencies in\n`mix.exs`.\n\n```elixir\ndef deps do\n  [\n    {:eddy, \"~\u003e 1.0.0\"}\n  ]\nend\n```\n\n## Quick start\n\nFor further examples, refer to the [full documentation](https://hexdocs.pm/eddy).\n\n### 1. Key generation\n\nGenerate new EdDSA keypairs.\n\n```elixir\niex\u003e privkey = Eddy.generate_key()\n%Eddy.PrivKey{}\n\niex\u003e pubkey = Eddy.get_pubkey(privkey)\n%Eddy.PubKey{}\n```\n\n### 2. Sign messages\n\nSign messages with a private key.\n\n```elixir\niex\u003e sig = Eddy.sign(\"test\", privkey)\n%Eddy.Sig{}\n```\n\n### 3. Verify messages\n\nVerify a signature against the message and a public key.\n\n```elixir\niex\u003e Eddy.verify(sig, \"test\", pubkey)\ntrue\n\niex\u003e Eddy.verify(sig, \"test\", wrong_pubkey)\nfalse\n```\n\n### 4. X25519 shared secrets\n\nECDH shared secrets are computed by multiplying a public key with a private key.\nThe operation yields the same result in both directions.\n\n```elixir\niex\u003e s1 = Eddy.get_shared_secret(priv_a, pubkey_b)\niex\u003e s2 = Eddy.get_shared_secret(priv_b, pubkey_a)\niex\u003e s1 == s2\ntrue\n```\n\n## Custom hash function\n\nAs per the [rfc8032 spec](https://www.rfc-editor.org/rfc/rfc8032#section-5.1),\nby default Eddy uses the `sha512` hash function internally. Optionally, a custom\nhash function can be configured in your application's\n`config/config.exs`.\n\n*The custom hash function **must** return 64 bytes.*\n\n```elixir\nimport Config\n\n# The hash function will be invoked as `:crypto.hash(:sha3_512, payload)`\nconfig :eddy, hash_fn: {:crypto, :hash, [:sha3_512], []}\n\n# The hash function will be invoked as `B3.hash(payload, length: 64)`\nconfig :eddy, hash_fn: {B3, :hash, [], [[length: 64]]}\n```\n\n## Disclaimer\n\nThe code in this library is well tested against offical test vectors. That said,\nI am not a cryptographer or mathemetician. The code has not been audited or\nbattle-tested against known attacks. Proceed at your own risk. If you're after\nthe most performant and battle tested code, consider using C or Rust bindings.\n\nWhat this library offers is a simple and small interface for common\nfunctionality. Written in pure Elixir, it is a lighter-weight option without the\ncompilation complexities of NIF bindings.\n\nI am very grateful to the author of [noble-ed25519](https://github.com/paulmillr/noble-ed25519)\nwhich has been an invaluable reference in creating the library.\n\n## License\n\nEddy is open source and released under the [Apache-2 License](https://github.com/libitx/eddy/blob/master/LICENSE).\n\n© Copyright 2023 [Chronos Labs Ltd](https://www.chronoslabs.net/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibitx%2Feddy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibitx%2Feddy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibitx%2Feddy/lists"}