{"id":41022565,"url":"https://github.com/petoc/algo","last_synced_at":"2026-01-22T09:35:27.998Z","repository":{"id":57565635,"uuid":"287814344","full_name":"petoc/algo","owner":"petoc","description":"Collection of algorithm implementations for Go.","archived":false,"fork":false,"pushed_at":"2020-08-16T15:40:25.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-20T14:55:53.688Z","etag":null,"topics":["algorithm","damm","go","golang","luhn"],"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/petoc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-15T19:46:54.000Z","updated_at":"2020-08-16T15:40:27.000Z","dependencies_parsed_at":"2022-09-03T11:21:06.666Z","dependency_job_id":null,"html_url":"https://github.com/petoc/algo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/petoc/algo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petoc%2Falgo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petoc%2Falgo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petoc%2Falgo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petoc%2Falgo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/petoc","download_url":"https://codeload.github.com/petoc/algo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petoc%2Falgo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28660770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["algorithm","damm","go","golang","luhn"],"created_at":"2026-01-22T09:35:27.910Z","updated_at":"2026-01-22T09:35:27.970Z","avatar_url":"https://github.com/petoc.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Algorithms\n\nCollection of algorithm implementations for Go.\n\n### Error detection\n\n[Damm](https://github.com/petoc/algo/tree/master/damm)\u003cbr\u003e\n[Damm64](https://github.com/petoc/algo/tree/master/damm64) (using quasigroups for character base from 3 to 64 characters)\u003cbr\u003e\n[Luhn](https://github.com/petoc/algo/tree/master/luhn)\u003cbr\u003e\n\n### Math\n\n[Greatest common divisor](https://github.com/petoc/algo/tree/master/gcd) (Euclid)\u003cbr\u003e\n\n## Usage\n\n### Error detection\n\n#### Damm\n\nImplementation of error detection algorithm for numeric codes from H. Michael Damm.\n\n```go\nimport \"github.com/petoc/algo/damm\"\n```\n\n```go\ndamm.Calculate(\"123456789\") // 4\ndamm.Validate(\"1234567894\") // true\n```\n\n#### Damm64\n\nBased on error detection algorithm from H. Michael Damm. Uses pre-generated quasigroups for character base from 3 to 64 characters.\n\n```go\nimport \"github.com/petoc/algo/damm64\"\n```\n\n```go\nbase := \"0123456789ABCDEFGHIJKLMNOPQRSTUV\"\ndamm64.Calculate(base, \"G12Q\") // F\ndamm64.Validate(base, \"G12QF\") // true\n```\n\n#### Luhn\n\nImplementation of error detection algorithm for numeric codes from Hans Peter Luhn.\n\n```go\nimport \"github.com/petoc/algo/luhn\"\n```\n\n```go\nluhn.Calculate(\"123456789\") // 7\nluhn.Validate(\"1234567897\") // true\n```\n\n### Math\n\n#### Greatest common divisor\n\n```go\nimport \"github.com/petoc/algo/gcd\"\n```\n\n```go\ngcd.Euclid(8, 12) // 4\n```\n\n## Sources\n\nDamm Quasigroups (http://www.md-software.de/math/DAMM_Quasigruppen.txt)\u003cbr\u003e\n\n## License\n\nLicensed under MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetoc%2Falgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpetoc%2Falgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetoc%2Falgo/lists"}