11Jan/113
原来身份证号是可以自我验证的
在Google Reader上别人share的文章看到的,二代身份证号码可以通过一种机制去验真。同样道理的也可以基于这种方式生成伪造的身份证号码,只不过也只能逃过本地验证,联网验证肯定还是死翘翘的。
蛋疼Groovy练手一段:
id = "787416969231782985"
factors = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2] as int[]
results = [1, 0, "x", 9, 8, 7, 6, 5, 4, 3, 2] as String[]
sum = 0
factors.eachWithIndex { factor, i ->
sum += (id[i] as int) * factor
}
id[17].toLowerCase() == results[sum%11]
各位如果和我一样蛋疼的也可以把id换成自己的身份证号码run一下看看是不是正确。另外附上同样蛋疼的生成脚本一段:
id = ""
factors = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2] as int[]
results = [1, 0, "x", 9, 8, 7, 6, 5, 4, 3, 2] as String[]
sum = 0
random = new Random()
factors.each {
ide = random.nextInt(10)
id += ide
sum += ide * it
}
id += results[sum%11]
January 11th, 2011 - 22:32
求原文share
January 11th, 2011 - 23:08
见我的GR 我reshare了
September 24th, 2011 - 18:43
是有个规则的