{"id":18010798,"url":"https://github.com/guanguans/id-validator","last_synced_at":"2025-05-16T01:04:57.964Z","repository":{"id":36978649,"uuid":"327857020","full_name":"guanguans/id-validator","owner":"guanguans","description":"China ID number validator. - 中国身份证号验证器。","archived":false,"fork":false,"pushed_at":"2025-05-05T21:45:25.000Z","size":541,"stargazers_count":216,"open_issues_count":3,"forks_count":41,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-10T15:52:04.030Z","etag":null,"topics":["id","idcard","idcard-check","idcard-detect","idcard-generator","idcardnumber-validation","idcardocr-china","validate","validation","validator","verify"],"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/guanguans.png","metadata":{"files":{"readme":"README-EN.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"patreon":"guanguans","custom":"https://www.guanguans.cn/images/wechat.jpeg"}},"created_at":"2021-01-08T09:29:05.000Z","updated_at":"2025-04-25T02:13:09.000Z","dependencies_parsed_at":"2022-07-15T21:00:31.145Z","dependency_job_id":"1c121759-6b34-4adf-b8e3-439be29c49fd","html_url":"https://github.com/guanguans/id-validator","commit_stats":{"total_commits":153,"total_committers":9,"mean_commits":17.0,"dds":"0.30718954248366015","last_synced_commit":"488cc9d8003eea4c5c100af81a33d655cc0115e6"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guanguans%2Fid-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guanguans%2Fid-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guanguans%2Fid-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guanguans%2Fid-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guanguans","download_url":"https://codeload.github.com/guanguans/id-validator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254448579,"owners_count":22072764,"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":["id","idcard","idcard-check","idcard-detect","idcard-generator","idcardnumber-validation","idcardocr-china","validate","validation","validator","verify"],"created_at":"2024-10-30T02:15:22.841Z","updated_at":"2025-05-16T01:04:57.936Z","avatar_url":"https://github.com/guanguans.png","language":"Go","readme":"# id-validator\n\n[简体中文](README.md) | [ENGLISH](README-EN.md)\n\n\u003e China ID number validator. - 中国身份证号验证器。\n\n## Features\n\n* Verify China ID number\n* Get ID number information\n* Upgrade 15-digit ID number to 18\n* Forged ID number that meets the verification\n\n## Requirement\n\n* Go \u003e= 1.14\n\n## Installation\n\n```shell script\n$ go get -u github.com/guanguans/id-validator\n```\n\n## Usage\n\nThis is just a quick introduction, view the [GoDoc](https://godoc.org/github.com/guanguans/id-validator) for details.\n\nLet's start with a trivial example:\n\n```go\npackage main\n\nimport (\n    idvalidator \"github.com/guanguans/id-validator\"\n    \"gopkg.in/ffmt.v1\"\n)\n\nfunc main() {\n    // 验证身份证号合法性\n    ffmt.P(idvalidator.IsValid(\"500154199301135886\", true))  // 严格模式验证大陆居民身份证18位\n    ffmt.P(idvalidator.IsValid(\"500154199301135886\", false)) // 非严格模式验证大陆居民身份证18位\n    ffmt.P(idvalidator.IsValid(\"11010119900307803X\", false)) // 大陆居民身份证末位是X18位\n    ffmt.P(idvalidator.IsValid(\"610104620927690\", false))    // 大陆居民身份证15位\n    ffmt.P(idvalidator.IsValid(\"810000199408230021\", false)) // 港澳居民居住证18位\n    ffmt.P(idvalidator.IsValid(\"830000199201300022\", false)) // 台湾居民居住证18位\n\n    // 获取身份证号信息\n    ffmt.P(idvalidator.GetInfo(\"500154199301135886\", true))  // 严格模式获取身份证号信息\n    ffmt.P(idvalidator.GetInfo(\"500154199301135886\", false)) // 非严格模式获取身份证号信息\n    // []interface {}[\n    //     github.com/guanguans/id-validator.IdInfo{          // 身份证号信息\n    //         AddressCode: int(500154)                           // 地址码\n    //         Abandoned:   int(0)                                // 地址码是否废弃：1为废弃的，0为正在使用的\n    //         Address:     string(\"重庆市市辖区开州区\")             // 地址\n    //         AddressTree: []string[                             // 省市区三级列表\n    //             string(\"重庆市\")                                    // 省\n    //             string(\"市辖区\")                                    // 市\n    //             string(\"开州区\")                                    // 区\n    //         ]\n    //         Birthday:      \u003c1993-01-13 00:00:00 +0800 CST\u003e     // 出生日期\n    //         Constellation: string(\"摩羯座\")                     // 星座\n    //         ChineseZodiac: string(\"酉鸡\")                       // 生肖\n    //         Sex:           int(0)                              // 性别：1为男性，0为女性\n    //         Length:        int(18)                             // 号码长度\n    //         CheckBit:      string(\"6\")                         // 校验码\n    //     }\n    //     \u003cnil\u003e                                              // 错误信息\n    // ]\n\n    // 生成可通过校验的假身份证号\n    ffmt.P(idvalidator.FakeId())                                  // 随机生成\n    ffmt.P(idvalidator.FakeRequireId(true, \"江苏省\", \"200001\", 1)) // 生成出生于2000年1月江苏省的男性居民身份证\n\n    // 15位号码升级为18位\n    ffmt.P(idvalidator.UpgradeId(\"610104620927690\"))\n    // []interface {}[\n    // \tstring(\"610104196209276908\") // 升级后号码\n    // \t\u003cnil\u003e                        // 错误信息\n    // ]\n}\n```\n\n## Testing\n\n```shell script\n$ make test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n* [guanguans](https://github.com/guanguans)\n* [All Contributors](../../contributors)\n\n## Related projects\n\n* [jxlwqq/id-validator](https://github.com/jxlwqq/id-validator), by jxlwqq\n* [jxlwqq/id-validator.py](https://github.com/jxlwqq/id-validator.py), by jxlwqq\n* [mc-zone/IDValidator](https://github.com/mc-zone/IDValidator), by mc-zone\n* [renyijiu/id_validator](https://github.com/renyijiu/id_validator), by renyijiu\n\n## Reference material\n\n* [People's Republic of China citizenship number](https://zh.wikipedia.org/wiki/中华人民共和国公民身份号码)\n* [Ministry of Civil Affairs of the People's Republic of China: Administrative division code](http://www.mca.gov.cn/article/sj/xzqh/)\n* [Historical data set of administrative division codes of the People's Republic of China](https://github.com/jxlwqq/address-code-of-china)\n* [Notice of the General Office of the State Council on Issuing the Measures for the Application and Issuance of Residence Permits for Hong Kong, Macao and Taiwan Residents](http://www.gov.cn/zhengce/content/2018-08/19/content_5314865.htm)\n* [Residence Permit for Hong Kong, Macao and Taiwan Residents](https://zh.wikipedia.org/wiki/港澳台居民居住证)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n","funding_links":["https://patreon.com/guanguans","https://www.guanguans.cn/images/wechat.jpeg"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguanguans%2Fid-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguanguans%2Fid-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguanguans%2Fid-validator/lists"}