密码强度校验
function passwordStrength(password,username) { var shortPass = 1, badPass = 2, goodPass = 3, strongPass = 4, symbolSize = 0, natLog, score; if (password.length < 4 ) { return shortPass }; if (password.toLowerCase()==username.toLowerCase()) return badPass; if (password.match(/[0-9]/)) symbolSize +=10; if (password.match(/[a-z]/)) symbolSize +=26; if (password.match(/[A-Z]/)) symbolSize +=26; if (password.match(/[^a-zA-Z0-9]/)) symbolSize +=31; natLog = Math.log( Math.pow(symbolSize,password.length) ); score = natLog / Math.LN2; if (score < 40 ) return badPass if (score < 56 ) return goodPass return strongPass; }
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
蕃薯耀 2013年2月5日 16:06:22 星期二