{"id":20186217,"url":"https://github.com/bytemare/crypto","last_synced_at":"2025-04-10T06:23:41.263Z","repository":{"id":42436004,"uuid":"311735140","full_name":"bytemare/crypto","owner":"bytemare","description":"Abstracted prime-order elliptic curve groups in Go.","archived":false,"fork":false,"pushed_at":"2024-05-22T22:51:38.000Z","size":588,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-22T23:01:56.970Z","etag":null,"topics":["cryptography","elliptic","elliptic-curves","go","hash-to-curve","nist","p256","p384","p521","prime-order-group","rfc9380","ristretto255"],"latest_commit_sha":null,"homepage":"","language":"Go","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/bytemare.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-10T17:28:13.000Z","updated_at":"2024-07-07T14:20:09.531Z","dependencies_parsed_at":"2024-05-28T14:04:34.969Z","dependency_job_id":"b31f732a-19ac-4464-beef-29b051bf2789","html_url":"https://github.com/bytemare/crypto","commit_stats":null,"previous_names":["bytemare/cryptotools"],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytemare%2Fcrypto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytemare%2Fcrypto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytemare%2Fcrypto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytemare%2Fcrypto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bytemare","download_url":"https://codeload.github.com/bytemare/crypto/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248166868,"owners_count":21058481,"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":["cryptography","elliptic","elliptic-curves","go","hash-to-curve","nist","p256","p384","p521","prime-order-group","rfc9380","ristretto255"],"created_at":"2024-11-14T03:16:27.451Z","updated_at":"2025-04-10T06:23:41.237Z","avatar_url":"https://github.com/bytemare.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e [!WARNING]  \n\u003e This package has moved to [github.com/bytemare/ecc](https://github.com/bytemare/ecc). This one is outdated, archived, and won't be maintained.\n\n\u003c!---\n# Prime-order Elliptic Curve Groups\n[![CI](https://github.com/bytemare/crypto/actions/workflows/code-scan.yml/badge.svg)](https://github.com/bytemare/crypto/actions/workflows/code-scan.yml)\n[![Go Reference](https://pkg.go.dev/badge/github.com/bytemare/crypto.svg)](https://pkg.go.dev/github.com/bytemare/crypto)\n[![codecov](https://codecov.io/gh/bytemare/crypto/branch/main/graph/badge.svg?token=5bQfB0OctA)](https://codecov.io/gh/bytemare/crypto)\n\n```Go\n  import \"github.com/bytemare/crypto\"\n```\n\nThis package exposes abstract operations over opaque prime-order elliptic curve groups and their scalars and elements,\nand support hash-to-curve as per [RFC 9380](https://datatracker.ietf.org/doc/rfc9380).\n\nIt is made so you can swap between primitives with no code change and only the Group identifier.\nThe package serves as an interface to optimized and secure implementations that serve as backends, and to which you\ndon't need to adapt.\n\nThe following table indexes supported groups with hash-to-curve capability and links each one to the underlying implementations:\n\n| ID | Name         | Backend                       |\n|----|--------------|-------------------------------|\n| 1  | Ristretto255 | github.com/gtank/ristretto255 |\n| 2  | Decaf448     | not supported                 |\n| 3  | P-256        | filippo.io/nistec             |\n| 4  | P-384        | filippo.io/nistec             |\n| 5  | P-521        | filippo.io/nistec             |\n| 6  | Edwards25519 | filippo.io/edwards25519       |\n| 7  | Secp256k1    | github.com/bytemare/secp256k1 |\n| 8  | Double-Odd   | not yet supported             |\n\n## Prime-order group interface\n\nThis package exposes types that can handle different implementations under the hood, internally using an interface\nto the group and its scalars and elements, but you don't need to instantiate or implement anything. Just use the type in\nthe top package.\n\n### Group interface\n\n```Go\n// Group abstracts operations in a prime-order group.\ntype Group interface {\n    NewScalar() Scalar\n    NewElement() Element\n    Base() Element\n\tHashFunc() crypto.Hash\n    HashToScalar(input, dst []byte) Scalar\n    HashToGroup(input, dst []byte) Element\n    EncodeToGroup(input, dst []byte) Element\n    Ciphersuite() string\n    ScalarLength() int\n    ElementLength() int\n    Order() string\n}\n```\n\n### Scalar interface\n\n```Go\n// Scalar interface abstracts common operations on scalars in a prime-order Group.\ntype Scalar interface {\n    Zero() Scalar\n    One() Scalar\n    Random() Scalar\n    Add(Scalar) Scalar\n    Subtract(Scalar) Scalar\n    Multiply(Scalar) Scalar\n    Pow(Scalar) Scalar\n    Invert() Scalar\n    Equal(Scalar) int\n    LessOrEqual(Scalar) int\n    IsZero() bool\n    Set(Scalar) Scalar\n    SetUInt64(uint64) Scalar\n    UInt64() (uint64, error)\n    Copy() Scalar\n    Encode() []byte\n    Decode(in []byte) error\n\tHex() string\n\tHexDecode([]byte) error\n    encoding.BinaryMarshaler\n    encoding.BinaryUnmarshaler\n}\n```\n\n### Element interface\n```Go\n// Element interface abstracts common operations on an Element in a prime-order Group.\ntype Element interface {\n    Base() Element\n    Identity() Element\n    Add(Element) Element\n    Double() Element\n    Negate() Element\n    Subtract(Element) Element\n    Multiply(Scalar) Element\n    Equal(element Element) int\n    IsIdentity() bool\n    Set(Element) Element\n    Copy() Element\n    Encode() []byte\n    XCoordinate() []byte\n    Decode(data []byte) error\n    Hex() string\n    HexDecode([]byte) error\n    encoding.BinaryMarshaler\n    encoding.BinaryUnmarshaler\n}\n```\n\n## Documentation [![Go Reference](https://pkg.go.dev/badge/github.com/bytemare/crypto.svg)](https://pkg.go.dev/github.com/bytemare/crypto)\n\nYou can find the documentation and usage examples in [the package doc](https://pkg.go.dev/github.com/bytemare/crypto) and [the project wiki](https://github.com/bytemare/crypto/wiki) .\n\n## Versioning\n\n[SemVer](https://semver.org) is used for versioning. For the versions available, see the [tags on the repository](https://github.com/bytemare/crypto/tags).\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](.github/CONTRIBUTING.md) for details on the code of conduct, and the process for submitting pull requests.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n---\u003e \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytemare%2Fcrypto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbytemare%2Fcrypto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytemare%2Fcrypto/lists"}