{"id":18892403,"url":"https://github.com/hf/galois","last_synced_at":"2026-02-26T06:30:15.019Z","repository":{"id":27845741,"uuid":"31335971","full_name":"hf/galois","owner":"hf","description":"An implementation of finite fields for C or OpenCL.","archived":false,"fork":false,"pushed_at":"2015-06-09T17:22:24.000Z","size":296,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-31T06:29:53.280Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","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/hf.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}},"created_at":"2015-02-25T21:09:56.000Z","updated_at":"2021-03-03T19:48:59.000Z","dependencies_parsed_at":"2022-09-02T15:51:53.317Z","dependency_job_id":null,"html_url":"https://github.com/hf/galois","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/hf%2Fgalois","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hf%2Fgalois/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hf%2Fgalois/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hf%2Fgalois/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hf","download_url":"https://codeload.github.com/hf/galois/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239868617,"owners_count":19710474,"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":[],"created_at":"2024-11-08T08:02:04.996Z","updated_at":"2026-02-26T06:30:14.960Z","avatar_url":"https://github.com/hf.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Galois\n\nThis is a tiny, header only C / OpenCL library for dealing with\n[Galois fields](http://en.wikipedia.org/wiki/Finite_field).\n\nIt was mainly developed for a cryptography project in OpenCL, but since it does\nnot use OpenCL specifics it can be used in-place for any C99 implementation.\n\nIt supports `GF(2^n)` fields where `n` is a non-zero multiple of 8.\n\nFor full performance it requires a loop-unrolling compiler (such as GCC or an\nLLVM based compiler).\n\nMost of the 'functions' are essentially macros. (This is so it can work with\nany arguments of the disjoint memory spaces in OpenCL.)\n\nIt does not use any caching techniques such as logarithm tables or tables of\ninverses.\n\nIt uses big-endian ordering.\n\n## Usage\n\nCode is in the file `finite_fields.cl`.\n\nInclude it in your OpenCL sources or your C99-compatible program. The macro\n`ffwidth` should be defined to the number of bytes in the field.\n\n```c\nuchar a[ffwidth];\nuchar b[ffwidth];\nuchar result[ffwidth];\nuchar irreducible_polynomial[ffwidth];\n\nFiniteFieldAdd(a, b, result);\nFiniteFieldMultiply(a, b, result, irreducible_polynomial);\nFiniteFieldMultiplicativeInverse(a, result, irreducible_polynomial);\n```\n\nPure C users may need to: `#define uchar unsigned char`.\n\n### Polynomials\n\nThe Rijndael (AES) polynomial can be represented by `0x1B`.\n\nA 16-bit polynomial that is suitable is `0x3F 0x80`.\n\n## Tools\n\nIncluded inside the `tools` directory are some Ruby scripts that are helpful\nto develop finite field implementations.\n\n## License\n\nCopyright \u0026copy; 2015 Stojan Dimitrovski\n\nAll of the code herein, except where otherwise noted is distributed under\n[The MIT License](http://opensource.org/licenses/MIT).\n\nSee the file `LICENSE.txt` for the full text.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhf%2Fgalois","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhf%2Fgalois","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhf%2Fgalois/lists"}