Last active
November 4, 2015 17:15
-
-
Save greymd/84ba9faf1ee8af09038f to your computer and use it in GitHub Desktop.
チェックデジットが正しい正規のマイナンバーをランダムに生成するシェル芸
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
paste <(cat /dev/urandom | gtr -dc '0-9' | fold -w 1 | head -n 11) <(echo 2 3 4 5 6 7 2 3 4 5 6 | rev | tr ' ' '\n') | \ | |
awk '{n=n"\n"$1; s+=$1*$2} END {c=(s%11); if(c<=1){print 0}else{print 11-c} print n}' | awk NF | xargs |
Author
greymd
commented
Nov 4, 2015
- 参考: http://qiita.com/qube81/items/fa6ef94d3c8615b0ce64
- 検証1(http://qiita.com/qube81/items/fa6ef94d3c8615b0ce64)
- 検証2(http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q10147037045)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment