>& STDOUT

主にソフトウェアに関する日々の標準出力+標準エラー出力

入力したパスワードの危険度を500位中何位か表示する

よく使われる危険なパスワードトップ500
http://gigazine.net/index.php?/news/comments/20090105_bad_password/


に触発されて。
とりあえず動きを試してみたい方 | コミコミでよろ な方はこちらからどうぞ。
http://snsk.moo.jp/playground/passcheck.html

<script>
/*from "The Top 500 Worst Passwords of All Time" 
http://www.whatsmypass.com/?p=415*/

checklist = new Array( 
	"123456",
	"password",
(中略)
	"hentai",
	"newyork",
);

var checkTargetInputId = "tgt"; //チェックしたい入力フォームのID
var displayResultElmId = "view";//チェック結果を出したい要素のID

function passCheck(inputVal){
	if(inputVal.length < 4){
		document.getElementById(displayResultElmId).innerHTML = "too short!";
		document.getElementById(checkTargetInputId).style.backgroundColor = "#FF99FF";
		return;
	}
	for(var i=0; i<checklist.length; i++){
		if(checklist[i] == inputVal){
			var suffix = (i == 0)?"st" :(i == 1)?"nd":(i == 2)?"rd":"th";
			document.getElementById(displayResultElmId).innerHTML = "the " + (i+1) + suffix + " worst passwords!";
			document.getElementById(checkTargetInputId).style.backgroundColor = "#FF99FF";
			break;
		}else{
			document.getElementById(displayResultElmId).innerHTML = "";
			document.getElementById(checkTargetInputId).style.backgroundColor = "#FFFFFF";
		}
	}
}

</script>

にしても


hentai って。
万一、再利用とか改変して使いたい方いたらお好きにどうぞ。