{"id":21649585,"url":"https://github.com/kaanaktas/luhn-algorithm","last_synced_at":"2025-10-13T01:46:39.834Z","repository":{"id":57707363,"uuid":"207182332","full_name":"kaanaktas/luhn-algorithm","owner":"kaanaktas","description":"Luhn Algorithm implementation with Go","archived":false,"fork":false,"pushed_at":"2020-09-06T12:27:02.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-13T01:46:37.338Z","etag":null,"topics":["go","golang","luhn-algorithm"],"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/kaanaktas.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}},"created_at":"2019-09-08T22:37:45.000Z","updated_at":"2021-01-19T12:21:00.000Z","dependencies_parsed_at":"2022-09-26T21:20:51.679Z","dependency_job_id":null,"html_url":"https://github.com/kaanaktas/luhn-algorithm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kaanaktas/luhn-algorithm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaanaktas%2Fluhn-algorithm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaanaktas%2Fluhn-algorithm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaanaktas%2Fluhn-algorithm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaanaktas%2Fluhn-algorithm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaanaktas","download_url":"https://codeload.github.com/kaanaktas/luhn-algorithm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaanaktas%2Fluhn-algorithm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279013906,"owners_count":26085326,"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","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"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":["go","golang","luhn-algorithm"],"created_at":"2024-11-25T07:34:44.486Z","updated_at":"2025-10-13T01:46:39.797Z","avatar_url":"https://github.com/kaanaktas.png","language":"Go","readme":"# Luhn Algorithm\n\n## Setup\n\n- Download and install [Golang](https://golang.org/dl/)\n- Download [Visual Studio Code](https://code.visualstudio.com/download) and install [go plugin](https://code.visualstudio.com/docs/languages/go)\n- Clone project ```git clone https://github.com/kaanaktas/luhn-algorithm.git``` and run:\n\n```bash\ngit clone https://github.com/kaanaktas/luhn-algorithm.git\ncd luhn-algorithm\ngo run main.go\n```\n\nIf you can see ```hello world from awesome golang land``` then run the following command:\n\n```bash\ngo test .\n```\n\nImplement [luhn.IsValid](./luhn.go) method and fix the tests.\n\nBenchmark test  ````go test -bench=. .````\n\n## Luhn Algorithm\n\nGiven a number determine whether or not it is valid per the Luhn formula.\n\nThe [Luhn algorithm](https://en.wikipedia.org/wiki/Luhn_algorithm) is a simple checksum formula used to validate a variety of identification numbers, such as credit card numbers and Canadian Social Insurance Numbers.\n\nThe task is to check if a given string is valid.\n\n### Validating a Number\n\nStrings of length 1 or less are not valid. Spaces are allowed in the input, but they should be stripped before checking. All other non-digit characters are disallowed.\n\n**Example 1: valid credit card number**\n\n\u003e 4539 1488 0343 6467\n\nThe first step of the Luhn algorithm is to double every second digit, starting from the right. We will be doubling\n\n\u003e 4_3_ 1_8_ 0_4_ 6_6_\n\nIf doubling the number results in a number greater than 9 then subtract 9 from the product. The results of our doubling:\n\n\u003e 8569 2478 0383 3437\n\nThen sum all of the digits:\n\n\u003e 8+5+6+9+2+4+7+8+0+3+8+3+3+4+3+7 = 80\n\nIf the sum is evenly divisible by 10, then the number is valid. This number is valid!\n\n\n**Example 2: invalid credit card number**\n\n\u003e 8273 1232 7352 0569\n\nDouble the second digits, starting from the right\n\n\u003e 7253 2262 5312 0539\n\nSum the digits\n\n\u003e 7+2+5+3+2+2+6+2+5+3+1+2+0+5+3+9 = 57\n\n*57* is not evenly divisible by *10*, so this number is not valid.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaanaktas%2Fluhn-algorithm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaanaktas%2Fluhn-algorithm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaanaktas%2Fluhn-algorithm/lists"}