{"id":22283338,"url":"https://github.com/kilic/fp256","last_synced_at":"2026-04-29T08:08:57.594Z","repository":{"id":144311525,"uuid":"183308632","full_name":"kilic/fp256","owner":"kilic","description":"256-bit prime field Golang implementation","archived":false,"fork":false,"pushed_at":"2019-06-26T21:59:43.000Z","size":41,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T17:39:15.337Z","etag":null,"topics":["elliptic-curve-cryptography","ethereum","finite-fields"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kilic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-04-24T21:21:16.000Z","updated_at":"2019-06-26T21:59:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"3b18e55c-57ff-40d8-ac05-068946981519","html_url":"https://github.com/kilic/fp256","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/kilic%2Ffp256","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kilic%2Ffp256/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kilic%2Ffp256/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kilic%2Ffp256/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kilic","download_url":"https://codeload.github.com/kilic/fp256/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245535309,"owners_count":20631292,"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":["elliptic-curve-cryptography","ethereum","finite-fields"],"created_at":"2024-12-03T16:39:41.438Z","updated_at":"2026-04-29T08:08:57.566Z","avatar_url":"https://github.com/kilic.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"This library contains arithmetic operations for prime fields upto 256 bit. Operations are optimized for AMD64 architecture.\n\n### Usage\n\n#### Field\n\nNew field can be created from standart big.Int prime number. Montgomery constants are precomputed during construction of new field.\n\n```go\npStr = \"0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001\"\npBig := new(big.Int).SetString(pStr[:2],16)\nfield := NewField(pBig)\n```\n\n#### Field Element\n\nNew field element can be created using bytes input. Given 32 bytes input new field element is transformed into Montgomery domain.\n\n```go\n// input bytes with big endian order\nfeBytes := []byte{12, 14, 250, ... }\nfe := field.NewElementFromBytes(feBytes)\n\n// random element\nfe2 := new(FieldElement)\nfield.RandElement(fe2, rand.Reader)\n```\n\n### Benchmarks\n\nPrime field operations benchmarked on _2,7 GHz i5_.\n\n```\nBenchmarkAddition                      5.90 ns/op\nBenchmarkMontgomeryMultiplication      37.1 ns/op\nBenchmarkMontgomerySquaring            32.9 ns/op\nBenchmarkInvertion                     2829 ns/op\n```\n\n### References\n\n#### Books and papers\n\n* [Handbook of Applied Cryptography](http://cacr.uwaterloo.ca/hac/)\n* [Guide to Elliptic Curve Cryptography](https://www.springer.com/gp/book/9780387952734)\n* [Efficient Software-Implementation of Finite Fields with Applications to Cryptography](https://www.researchgate.net/publication/225962646_Efficient_Software-Implementation_of_Finite_Fields_with_Applications_to_Cryptography)\n* [The Montgomery Modular Inverse - Revisited](https://ieeexplore.ieee.org/abstract/document/863048)\n\n#### Related or reference libraries\n\n* [cloudflare/bn256](https://github.com/ethereum/go-ethereum/tree/master/crypto/bn256)\n* [zkcrypto/jubjub](https://github.com/zkcrypto/jubjub/blob/master/src/fq.rs)\n* [matter-labs/eip1829](https://github.com/matter-labs/eip1829/blob/master/src/field.rs)\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkilic%2Ffp256","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkilic%2Ffp256","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkilic%2Ffp256/lists"}