{"_id":"@bradthomasbrown/finite-curve","_rev":"9-75b44b4ddfe55c60bee17ed660741eb2","name":"@bradthomasbrown/finite-curve","dist-tags":{"latest":"3.0.0"},"versions":{"1.0.0":{"name":"@bradthomasbrown/finite-curve","version":"1.0.0","author":{"name":"Brad Brown","email":"https://t.me/bradthomasbrown"},"_id":"@bradthomasbrown/finite-curve@1.0.0","maintainers":[{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"}],"dist":{"shasum":"e94ae62e84083c80d0ebbdb47e497e0dd5329e49","tarball":"https://registry.npmjs.org/@bradthomasbrown/finite-curve/-/finite-curve-1.0.0.tgz","fileCount":5,"integrity":"sha512-B9Wy7hg1Sz/AscvImxPgrFPHk1UECtI0Bm1s8NCsa2ykVHlz+EXMgb9g4cn+vu2ZUBsXWeui4bzr3zYcizBnXg==","signatures":[{"sig":"MEQCIG3xk7v9u8wwCJovDqokeS2ogzh3Yv3WkssTMLyG7fF0AiB7XEdEi7LyBiUuDWYRpnK0jYBo6rXM3pnqbthuyZppnw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":11179},"main":"./dist/finite-curve.js","type":"module","types":"./dist/finite-curve.d.ts","gitHead":"4478d00e957accb9f503a44f2aced1eefc40db30","_npmUser":{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"},"_npmVersion":"10.9.2","description":"Minimal, unoptimized, and unaudited elliptic curve over finite fields library in JavaScript/TypeScript.","directories":{},"_nodeVersion":"22.16.0","dependencies":{"@bradthomasbrown/finite-field":"^1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.3"},"_npmOperationalInternal":{"tmp":"tmp/finite-curve_1.0.0_1765087922279_0.4065761514986157","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@bradthomasbrown/finite-curve","version":"1.0.1","author":{"name":"Brad Brown","email":"https://t.me/bradthomasbrown"},"_id":"@bradthomasbrown/finite-curve@1.0.1","maintainers":[{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"}],"dist":{"shasum":"7c9f6e50864db252b3071cc3bb1984ea2c63429f","tarball":"https://registry.npmjs.org/@bradthomasbrown/finite-curve/-/finite-curve-1.0.1.tgz","fileCount":5,"integrity":"sha512-BmyMh2vL0ac7qnUyJXZkMyNdA7jqfVz+p/MvT/HUujZX13QbKJplL3IumVA71tS/GXgPSd/LEBt7glp0oewopg==","signatures":[{"sig":"MEUCIF+6AZGsc5rplRpQ5CUJPYkEBzCi8TRlVcwUTK8ECzRFAiEA9a+VP5L6wL2zuIMsawyTYUljnZz5mI2dUgeZaarlPU0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":11179},"main":"./dist/finite-curve.js","type":"module","types":"./dist/finite-curve.d.ts","gitHead":"f5f4badadd7ca370166ef6bfd80844863b3045fa","_npmUser":{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"},"_npmVersion":"10.9.2","description":"Minimal, unoptimized, and unaudited elliptic curve over finite fields library in JavaScript/TypeScript.","directories":{},"_nodeVersion":"22.16.0","dependencies":{"@bradthomasbrown/finite-field":"^1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.3"},"_npmOperationalInternal":{"tmp":"tmp/finite-curve_1.0.1_1765112671339_0.06908569122963448","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@bradthomasbrown/finite-curve","version":"2.0.0","author":{"name":"Brad Brown","email":"https://t.me/bradthomasbrown"},"_id":"@bradthomasbrown/finite-curve@2.0.0","maintainers":[{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"}],"dist":{"shasum":"9f84aac08b44408498c1f0ef28f32d6fd11023bc","tarball":"https://registry.npmjs.org/@bradthomasbrown/finite-curve/-/finite-curve-2.0.0.tgz","fileCount":5,"integrity":"sha512-DrHrFa7cm5mOR7PYBz+2DxO4X10Fq9EIQxPM2HUAGPVIQstZsTLNZCqGrEdJ3RRtHw21jB11Rwp0ahlKz7zfDQ==","signatures":[{"sig":"MEQCIBWWuJyNOlKMFnkNX/TMcpUxcJO/d2lBW7UN8e5qszdlAiBR7CMJOEDCgNEhamP7f/XONIlnU+EX1iH5PP1f/Vef+w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8708},"main":"./dist/finite-curve.js","type":"module","types":"./dist/finite-curve.d.ts","gitHead":"a29a7492a330ac750ce510a3c1838f1970c1790d","_npmUser":{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"},"_npmVersion":"10.9.2","description":"Minimal, unoptimized, and unaudited elliptic curve over finite fields library in JavaScript/TypeScript.","directories":{},"_nodeVersion":"22.16.0","dependencies":{"@bradthomasbrown/finite-field":"^1.0.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/finite-curve_2.0.0_1765576051069_0.9838939581648865","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"name":"@bradthomasbrown/finite-curve","version":"2.0.1","author":{"name":"Brad Brown","email":"https://t.me/bradthomasbrown"},"_id":"@bradthomasbrown/finite-curve@2.0.1","maintainers":[{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"}],"dist":{"shasum":"5cd7ce0f10074305a86408c56930f54bebf353b2","tarball":"https://registry.npmjs.org/@bradthomasbrown/finite-curve/-/finite-curve-2.0.1.tgz","fileCount":5,"integrity":"sha512-EfwtGKAHWjgLFbReBGpfYJLhFgpQuPr6knbwTHUbQxAeTeIT5W7A8bs6hO2EuWzlQa2njhL1JGvk2PKB6aqoYw==","signatures":[{"sig":"MEUCIQC1GUYoGeX9amIAPIvrdSrwZdIRGvskh2OQM1q8xoVqjQIgbm8rJ87RxzUOVUqG3Tlo/5HnTk21oLg/zYKW6qNnAJ0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13683},"main":"./dist/finite-curve.js","type":"module","types":"./dist/finite-curve.d.ts","gitHead":"615b7ff36a831ed73ba9d35e5a668ee70846fabf","_npmUser":{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"},"_npmVersion":"10.9.2","description":"Minimal, unoptimized, and unaudited elliptic curve over finite fields library in JavaScript/TypeScript.","directories":{},"_nodeVersion":"22.16.0","dependencies":{"@bradthomasbrown/finite-field":"^1.0.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/finite-curve_2.0.1_1765576652414_0.11501971512331233","host":"s3://npm-registry-packages-npm-production"}},"2.0.2":{"name":"@bradthomasbrown/finite-curve","version":"2.0.2","author":{"name":"Brad Brown","email":"https://t.me/bradthomasbrown"},"_id":"@bradthomasbrown/finite-curve@2.0.2","maintainers":[{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"}],"dist":{"shasum":"0d1c9d99de76402204195e40f7454314026ead45","tarball":"https://registry.npmjs.org/@bradthomasbrown/finite-curve/-/finite-curve-2.0.2.tgz","fileCount":5,"integrity":"sha512-0qaQlSorXjI1swLHxJ09FXusC9wKYb7XazWfiTXcB7lbA7/t+jCzcopiPbT/M9QiHSqEcy7qRs0yAh5iNOh5tQ==","signatures":[{"sig":"MEQCIGesmiJ+n5RbhNXs4zDKrguOOnATtNwGwVA17hYhsIyXAiBXWnQ3eQTzZiHlo59QhTosHqUKg4ht/NNjlIquREPiiA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13683},"main":"./dist/finite-curve.js","type":"module","types":"./dist/finite-curve.d.ts","gitHead":"b244e9e1cbfb04fbde0668892e70e52b18679ff9","_npmUser":{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"},"_npmVersion":"10.9.2","description":"Minimal, unoptimized, and unaudited elliptic curve over finite fields library in JavaScript/TypeScript.","directories":{},"_nodeVersion":"22.16.0","dependencies":{"@bradthomasbrown/finite-field":"^1.0.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/finite-curve_2.0.2_1765582452506_0.38203681426821334","host":"s3://npm-registry-packages-npm-production"}},"2.0.3":{"name":"@bradthomasbrown/finite-curve","version":"2.0.3","author":{"name":"Brad Brown","email":"https://t.me/bradthomasbrown"},"_id":"@bradthomasbrown/finite-curve@2.0.3","maintainers":[{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"}],"dist":{"shasum":"0ba4e8b3269b14ce73a10ec044efacc63afd391f","tarball":"https://registry.npmjs.org/@bradthomasbrown/finite-curve/-/finite-curve-2.0.3.tgz","fileCount":5,"integrity":"sha512-+1tbXg+A/k+1QGpjzFdH+yJ+IJQ5wxjnkFmDRVhhwvwsR94PPkuFyudJ+qiTt91oCdOk9E3W+b23gY/6pZBBhw==","signatures":[{"sig":"MEYCIQDwUHbPc2nN2K1jJR5/r96cfkxky9V27pFh0kpPCd6C4gIhAIhcZhXcPMB4uDea+qfvyRUU8oFHt83ufjL+q9tV/tcn","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13672},"main":"./dist/finite-curve.js","type":"module","types":"./dist/finite-curve.d.ts","gitHead":"5c581cf546e83cd24058bd01feb86f3c6d9e995c","_npmUser":{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"},"_npmVersion":"10.9.2","description":"Minimal, unoptimized, and unaudited elliptic curve over finite fields library in JavaScript/TypeScript.","directories":{},"_nodeVersion":"22.16.0","dependencies":{"@bradthomasbrown/finite-field":"^1.0.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/finite-curve_2.0.3_1765582638363_0.006244231541542744","host":"s3://npm-registry-packages-npm-production"}},"2.1.0":{"name":"@bradthomasbrown/finite-curve","version":"2.1.0","author":{"name":"Brad Brown","email":"https://t.me/bradthomasbrown"},"_id":"@bradthomasbrown/finite-curve@2.1.0","maintainers":[{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"}],"dist":{"shasum":"afdbc0c7aa11367b440e3ed3cd1f11f790d83c35","tarball":"https://registry.npmjs.org/@bradthomasbrown/finite-curve/-/finite-curve-2.1.0.tgz","fileCount":5,"integrity":"sha512-Nsd47WrpHMeJfXlPCl4GguZgfTK90sNtjqcFQUAG5Cyiw0MXj85xxvx5Wd5QLjuHaQeDIO5tNKXn9syP/ZPk5g==","signatures":[{"sig":"MEYCIQCVbVDuQRNdJ6BXD5P4dgM/vkBAEEUd0omTzOLpXvKGBgIhAMlFFPq+rJOI9NkFhb+SRYXj37aapJnb0H4i6D0Z5GIW","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14720},"type":"module","exports":{".":"./dist/finite-curve.js"},"gitHead":"0c461a6cece37ce6151267e49ec6f24264849e44","_npmUser":{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"},"_npmVersion":"10.9.2","description":"Minimal, unoptimized, and unaudited elliptic curve over finite fields library in JavaScript/TypeScript.","directories":{},"_nodeVersion":"22.16.0","dependencies":{"@bradthomasbrown/finite-field":"^1.1.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/finite-curve_2.1.0_1765587526169_0.07308173638968052","host":"s3://npm-registry-packages-npm-production"}},"2.2.0":{"name":"@bradthomasbrown/finite-curve","version":"2.2.0","author":{"name":"Brad Brown","email":"https://t.me/bradthomasbrown"},"_id":"@bradthomasbrown/finite-curve@2.2.0","maintainers":[{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"}],"dist":{"shasum":"50602ba56cd80de8351df2fed8fcd3926ddd7668","tarball":"https://registry.npmjs.org/@bradthomasbrown/finite-curve/-/finite-curve-2.2.0.tgz","fileCount":5,"integrity":"sha512-tYC8Tf2S6xSUUrfSbx8eWXWj4Nz3w2AEYJJWnKnIXm1NxG32IuHucJWBFr56k1GbUD2byTzsAfupoRWngkhqmA==","signatures":[{"sig":"MEYCIQCNGulOksUoCH8FCSa1EPxycbeNVlgsB+6obhCI1l14mwIhAPyiSWvn3Veple/x34biC35RW6hKTrL2xHF8V4jq7wob","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16173},"type":"module","exports":{".":"./dist/finite-curve.js"},"gitHead":"1731ce5b02d580aedf6e05cb95d3f25fa9bfc235","_npmUser":{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"},"_npmVersion":"10.9.2","description":"Minimal, unoptimized, and unaudited elliptic curve over finite fields library in JavaScript/TypeScript.","directories":{},"_nodeVersion":"22.16.0","dependencies":{"@bradthomasbrown/finite-field":"^1.1.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/finite-curve_2.2.0_1765591905872_0.41887387087692085","host":"s3://npm-registry-packages-npm-production"}},"3.0.0":{"name":"@bradthomasbrown/finite-curve","description":"Minimal, unoptimized, and unaudited elliptic curve over finite fields library in JavaScript/TypeScript.","version":"3.0.0","author":{"name":"Brad Brown","email":"https://t.me/bradthomasbrown"},"type":"module","scripts":{"bump-patch":"npm version patch && git push && npm publish --access=public","prepublishOnly":"bun test.ts"},"exports":{".":"./dist/finite-curve.js"},"dependencies":{"@bradthomasbrown/finite-field":"^2.0.0"},"devDependencies":{"fc_a":"npm:@bradthomasbrown/finite-curve@^2.2.0","ff_a":"npm:@bradthomasbrown/finite-field@^1.1.0"},"_id":"@bradthomasbrown/finite-curve@3.0.0","gitHead":"c7f180c254c20248f3d9957e45fc2801f355ef37","_nodeVersion":"22.16.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-iUnTvhfAjp5iYWU89KWyNMRN4Z1SdeOB963vMW48ea3/OgSWCcgtd7BM2mZJm/hez0+iEPo8LIFuE5EsH6jzqA==","shasum":"0e46f58489d6b9ab49f6dc5a54612c1a175ec360","tarball":"https://registry.npmjs.org/@bradthomasbrown/finite-curve/-/finite-curve-3.0.0.tgz","fileCount":5,"unpackedSize":16099,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDFZFr0MFQo3Hm4gf57dQl5OJ6M5tYkAERpiqDvNfWozAiEAsyI3MTRReRGaUg4sZczOHFUOJbvJDILoaK8rWLfx5rk="}]},"_npmUser":{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"},"directories":{},"maintainers":[{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/finite-curve_3.0.0_1766212254932_0.8514312806814313"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-07T06:12:02.223Z","modified":"2025-12-20T06:30:55.291Z","1.0.0":"2025-12-07T06:12:02.430Z","1.0.1":"2025-12-07T13:04:31.495Z","2.0.0":"2025-12-12T21:47:31.205Z","2.0.1":"2025-12-12T21:57:32.554Z","2.0.2":"2025-12-12T23:34:12.719Z","2.0.3":"2025-12-12T23:37:18.499Z","2.1.0":"2025-12-13T00:58:46.323Z","2.2.0":"2025-12-13T02:11:46.046Z","3.0.0":"2025-12-20T06:30:55.089Z"},"author":{"name":"Brad Brown","email":"https://t.me/bradthomasbrown"},"description":"Minimal, unoptimized, and unaudited elliptic curve over finite fields library in JavaScript/TypeScript.","maintainers":[{"name":"bradthomasbrown","email":"bradthomasbrown@outlook.com"}],"readme":"# finite-curve\r\nThis is a simple, minimal implementation of elliptical curve arithmetic over finite fields in TypeScript/JavaScript. \r\n\r\n## Why?\r\nThere is surprisingly little information on all aspects of the \"cryptographic stack\" in JavaScript and elsewhere that is simple and minimal. This repository is part of a series of repositories that builds up this stack from first principles, including:\r\n- [Finite field arithmetic](https://github.com/bradthomasbrown/finite-field)\r\n- Elliptic curves over finite fields (this repository)\r\n- Sponge constructions\r\n- Keccak\r\n- The concrete instances of secp256k1, Keccak-256, and more as well as how these are made from the above concepts\r\n- ECDSA\r\n- Interacting with EVM nodes\r\n- And potentially more\r\n\r\n## Dependencies\r\n- [@bradthomasbrown/finite-field](https://github.com/bradthomasbrown/finite-field) (this should be installed when you install the `finite-curve` package, but this is listed here for completeness)\r\n\r\n## Installation\r\n```sh\r\nnpm i @bradthomasbrown/finite-curve\r\n```\r\n\r\n## Usage\r\n```js\r\nimport { FiniteField } from \"@bradthomasbrown/finite-field\";\r\nimport { FiniteCurve, FinitePoint } from \"@bradthomasbrown/finite-curve\";\r\n\r\nconst p = // secp256k1 field order\r\n      (1n << 256n)\r\n    - (1n << 32n)\r\n    - 977n;\r\nconst q = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n; // order n of the generator point of secp256k1\r\nconst F = new FiniteField(p);\r\nconst G = new FiniteField(q);\r\nconst E = new FiniteCurve(F, 0, 7); // secp256k1\r\n\r\nconst P = new FinitePoint( // generator point of secp256k1\r\n    0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n,\r\n    0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n\r\n);\r\nconst s = G.reciprocal(2);\r\nconst R = new FinitePoint();\r\nE.multiply(R, s, P);\r\nconsole.log({ x: R.x, y: R.y });\r\n// x: 86918276961810349294276103416548851884759982251107n\r\n// y: 87194829221142880348582938487511785107150118762739500766654458540580527283772n\r\n// # note the relatively extremely low value of x after halving the generator point,\r\n// # a characteristic of SEC 2 curves (https://bitcoin.stackexchange.com/a/113122)\r\n```","readmeFilename":"README.md"}