{"id":15822955,"url":"https://github.com/sambacha/disco-ecdsa","last_synced_at":"2026-01-08T17:32:48.996Z","repository":{"id":103231548,"uuid":"584083726","full_name":"sambacha/disco-ecdsa","owner":"sambacha","description":"Gas and Size Optimized ECDSA contracts from Open Zeppelin","archived":false,"fork":false,"pushed_at":"2023-06-24T09:54:44.000Z","size":169,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T23:44:19.886Z","etag":null,"topics":["ecdsa","ethereum","evm","gas-optimized","openzeppelin","solidity"],"latest_commit_sha":null,"homepage":"","language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sambacha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2023-01-01T09:19:05.000Z","updated_at":"2023-08-24T11:35:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"d3f1db57-1a10-4c6d-ad70-036ec45fc0ad","html_url":"https://github.com/sambacha/disco-ecdsa","commit_stats":{"total_commits":23,"total_committers":1,"mean_commits":23.0,"dds":0.0,"last_synced_commit":"61737b61244a66b6b545047294f580fb57167d9b"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambacha%2Fdisco-ecdsa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambacha%2Fdisco-ecdsa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambacha%2Fdisco-ecdsa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambacha%2Fdisco-ecdsa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sambacha","download_url":"https://codeload.github.com/sambacha/disco-ecdsa/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246598198,"owners_count":20802975,"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":["ecdsa","ethereum","evm","gas-optimized","openzeppelin","solidity"],"created_at":"2024-10-05T08:01:56.334Z","updated_at":"2026-01-08T17:32:43.956Z","avatar_url":"https://github.com/sambacha.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [`@disco3/signatures`](#)\n\n\u003e v0.1.0\n\n![](https://img.shields.io/badge/license-upl--1.0-black)\n\n## Motivation\n\nReduce gas and size for ECDSA Signature Methods, reduce imported bloat, etc.\n\n\n## Benchmarks\n\n\n### Openzeppelin\n\n| Contract | Size (kB) | Margin (kB) |\n|----------|-----------|-------------|\n| ECDSA    | 0.086     | 24.49       |\n| Math     | 0.086     | 24.49       |\n| Strings  | 0.086     | 24.49       |\n\n\n### Disco\n\n| Contract | Size (kB) | Margin (kB) |\n|----------|-----------|-------------|\n| ECDSA    | 0.045     | 24.531      |\n| Strings  | 0.045     | 24.531      |\n\n\n## Changes\n\nFollowing changes have been made and tested\n\n### Strings \n\n`Strings.sol` includes the needed `SafeMath` logic that was removed in 4.8.0 of `OpenZeppelin/Contracts`. This reduces the size of the compiled contract by 50%. \n\n### ECDSA \n\nAssembly changes\n\n```solidity\n    /**\n     * @dev Returns an Ethereum Signed Message, created from `s`. This\n     * produces hash corresponding to the one signed with the\n     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n     * JSON-RPC method as part of EIP-191.\n     *\n     * See {recover}.\n     */\n    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Typed Data, created from a\n     * `domainSeparator` and a `structHash`. This produces hash corresponding\n     * to the one signed with the\n     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n     * JSON-RPC method as part of EIP-712.\n     *\n     * See {recover}.\n     */\n    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            let ptr := mload(0x40)\n            mstore(ptr, \"\\x19\\x01\")\n            mstore(add(ptr, 0x02), domainSeparator)\n            mstore(add(ptr, 0x22), structHash)\n            data := keccak256(ptr, 66)\n        }\n    }\n```\n\n```plantuml\n@startuml\n\n' -- classes --\n\n\nabstract ECDSA {\n    ' -- inheritance --\n\n    ' -- usingFor --\n\n    ' -- vars --\n\n    ' -- methods --\n\t-🔍_throwError()\n\t#🔍tryRecover()\n\t#🔍recover()\n\t#🔍tryRecover()\n\t#🔍recover()\n\t#🔍tryRecover()\n\t#🔍recover()\n\t#🔍toEthSignedMessageHash()\n\t#🔍toEthSignedMessageHash()\n\t#🔍toTypedDataHash()\n\n}\n' -- inheritance / usingFor --\n\n@enduml\n```\n\n ## License\n \n Licensed under either of\n\n * Universal Permissive License 1.0\n   ([LICENSE-UPL](LICENSE-UPL) or https://opensource.org/licenses/UPL)\n\n * MIT License\n   ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT)\n \n at your option.\n\n ### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Universal Permissive License v 1.0 \nlicense, shall be dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsambacha%2Fdisco-ecdsa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsambacha%2Fdisco-ecdsa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsambacha%2Fdisco-ecdsa/lists"}