All Projects → guanguans → Id Validator

guanguans / Id Validator

Licence: mit
中国身份证号验证、获取身份证号信息、升级 15 位身份证号为 18 位、伪造符合校验的身份证号。

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to Id Validator

VerificationCode
简单的滑动验证码JS插件 图片验证码
Stars: ✭ 15 (-59.46%)
Mutual labels:  verify
EnhanceDiskUtility
SIMBL plugin for Disk Utility that aims to enable Verify / Repair Permissions support
Stars: ✭ 17 (-54.05%)
Mutual labels:  verify
Awesome bot
✅ Validate links in awesome projects
Stars: ✭ 697 (+1783.78%)
Mutual labels:  verify
verify-service-provider
👑 ☑️ The easiest way to connect to GOV.UK Verify
Stars: ✭ 15 (-59.46%)
Mutual labels:  verify
checktestdata
checks integrity of test data in programming contests like the ACM ICPC
Stars: ✭ 19 (-48.65%)
Mutual labels:  verify
Tpinappreceipt
Reading and Validating In App Purchase Receipt Locally.
Stars: ✭ 305 (+724.32%)
Mutual labels:  verify
flutter-openpgp
OpenPGP for flutter made with golang for fast performance with support for android, ios, macos, linux, windows, web and hover
Stars: ✭ 35 (-5.41%)
Mutual labels:  verify
Rverify.js
✅❎ A lightweight image rotation verification plugin.
Stars: ✭ 33 (-10.81%)
Mutual labels:  verify
git-conventional-commits
Git Conventional Commits Util to generate Semantic Version and Markdown Change Log and Validate Commit Messag
Stars: ✭ 58 (+56.76%)
Mutual labels:  verify
Uber Apk Signer
A cli tool that helps signing and zip aligning single or multiple Android application packages (APKs) with either debug or provided release certificates. It supports v1, v2 and v3 Android signing scheme has an embedded debug keystore and auto verifies after signing.
Stars: ✭ 677 (+1729.73%)
Mutual labels:  verify
cfv
Command-line File Verify
Stars: ✭ 36 (-2.7%)
Mutual labels:  verify
vonage-node-code-snippets
NodeJS code examples for using Nexmo
Stars: ✭ 46 (+24.32%)
Mutual labels:  verify
React Native Phone Verification
The best React Native example for phone verification (an alternative to Twitter Digits).
Stars: ✭ 332 (+797.3%)
Mutual labels:  verify
pdf-scripts
📑 Scripts to repair, verify, OCR, compress, wrangle, crop (etc.) PDFs
Stars: ✭ 33 (-10.81%)
Mutual labels:  verify
Keys
Key management is hard
Stars: ✭ 733 (+1881.08%)
Mutual labels:  verify
go-captcha
Go Captcha is a behavioral captcha, which implements the generation of random verification text and the verification of click position information.
Stars: ✭ 86 (+132.43%)
Mutual labels:  verify
hoice
An ICE-based predicate synthesizer for Horn clauses.
Stars: ✭ 41 (+10.81%)
Mutual labels:  verify
Nexmo Node Code Snippets
NodeJS code examples for using Nexmo
Stars: ✭ 36 (-2.7%)
Mutual labels:  verify
Vue express session nodb
这是一个带有express session验证的vue项目,其中server适用于其他任何前端框架,开发者可以根据自己的需求进行更改;另外session存储不涉及数据库存储,使用的是内存存储。
Stars: ✭ 24 (-35.14%)
Mutual labels:  verify
Mtgjson3
MTGJSON repository for Magic Cards
Stars: ✭ 538 (+1354.05%)
Mutual labels:  verify

id-validator

简体中文 | ENGLISH

中国身份证号验证。

Tests gocover.io Go Report Card GoDoc GitHub release GitHub license

功能

  • 中国身份证号验证
  • 获取身份证号信息
  • 升级 15 位身份证号为 18 位
  • 伪造符合校验的身份证号

环境要求

  • Go >= 1.11

安装

$ go get -u github.com/guanguans/id-validator

使用

这只是一个快速介绍, 请查看 GoDoc 获得详细信息。

package main

import (
	idvalidator "github.com/guanguans/id-validator"
	"gopkg.in/ffmt.v1"
)

func main() {

	// 验证身份证号合法性
	ffmt.P(idvalidator.IsValid("440308199901101512"))  // 大陆居民身份证18位
	ffmt.P(idvalidator.IsValid("610104620927690"))     // 大陆居民身份证15位
	ffmt.P(idvalidator.IsValid("810000199408230021"))  // 港澳居民居住证18位
	ffmt.P(idvalidator.IsValid("830000199201300022"))  // 台湾居民居住证18位

	// 获取身份证号信息
	ffmt.P(idvalidator.GetInfo("440308199901101512"))
	// []interface {}[
	// 	github.com/guanguans/id-validator.IdInfo{          // 身份证号信息
	// 		AddressCode: int(440308)                           // 地址码
	// 		Abandoned:   int(0)                                // 地址码是否废弃:1为废弃的,0为正在使用的
	// 		Address:     string("广东省深圳市盐田区")             // 地址
	// 		AddressTree: []string[                             // 省市区三级列表
	//			string("广东省")                                    // 省
	//			string("深圳市")                                    // 市
	//			string("盐田区")                                    // 区
	//		]
	// 		Birthday:      <1999-01-10 00:00:00 +0000 UTC>     // 出生日期
	// 		Constellation: string("摩羯座")                     // 星座
	// 		ChineseZodiac: string("卯兔")                       // 生肖
	// 		Sex:           int(1)                              // 性别:1为男性,0为女性
	// 		Length:        int(18)                             // 号码长度
	// 		CheckBit:      string("2")                         // 校验码
	// 	}
	// 	<nil>                                              // 错误信息
	// ]

	// 生成可通过校验的假身份证号
	ffmt.P(idvalidator.FakeId()) // 随机生成
	ffmt.P(idvalidator.FakeRequireId(true, "江苏省", "200001", 1)) // 生成出生于2000年1月江苏省的男性居民身份证

	// 15位号码升级为18位
	ffmt.P(idvalidator.UpgradeId("610104620927690"))
	// []interface {}[
	// 	string("610104196209276908") // 升级后号码
	// 	<nil>                        // 错误信息
	// ]
}

测试

$ make test

变更日志

请参阅 CHANGELOG 获取最近有关更改的更多信息。

贡献指南

请参阅 CONTRIBUTING 有关详细信息。

安全漏洞

请查看我们的安全政策了解如何报告安全漏洞。

贡献者

相关项目

参考资料

协议

MIT 许可证(MIT)。有关更多信息,请参见协议文件

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].