"복잡한 패스워드인지 확인"의 두 판 사이의 차이

잔글 (Complex Password 문서를 복잡한 패스워드(으)로 옮김)
잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
(사용자 2명의 중간 판 9개는 보이지 않습니다)
1번째 줄: 1번째 줄:
*Is complex password
;함수 is_complex_password
*IsComplexPassword
;Is complex password
;IsComplexPassword


==C#==
==C#==
<source lang='csharp'>
<syntaxhighlight lang='csharp'>
bool IsComplexPassword(string pwd)
bool IsComplexPassword(string pwd)
{
{
9번째 줄: 10번째 줄:
   return Regex.IsMatch(pwd, pattern);
   return Regex.IsMatch(pwd, pattern);
}
}
</source>
</syntaxhighlight>


==PHP==
==PHP==
<source lang='php'>
<syntaxhighlight lang='php'>
function IsComplexPassword($pwd) {
function IsComplexPassword($pwd) {
   if(!preg_match('/(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/', $pwd))return false;
   if(!preg_match('/(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/', $pwd))return false;
   return true;
   return true;
}
}
</source>
</syntaxhighlight>


==Java==
==Java==
<source lang='java'>
<syntaxhighlight lang='java'>
private Boolean IsComplexPassword(String pwd) {
private Boolean IsComplexPassword(String pwd) {
   Pattern p = Pattern.compile("/(?=^.{8,}$)((?=.*\\d)|(?=.*\\W+))(?![.\\n])(?=.*[A-Z])(?=.*[a-z]).*$/");
   Pattern p = Pattern.compile("/(?=^.{8,}$)((?=.*\\d)|(?=.*\\W+))(?![.\\n])(?=.*[A-Z])(?=.*[a-z]).*$/");
26번째 줄: 27번째 줄:
   return m.matches();
   return m.matches();
}
}
</source>
</syntaxhighlight>
[[category:validation]]
 
[[category:password]]
==같이 보기==
*[[복잡한 패스워드 생성기]]
*[[matches]]
 
==참고==
*http://eqcode.com/wiki/index.php/Is_complex_password
 
[[category:패스워드]]
[[category:유효성 검증]]
[[category:csharp]]
[[category:csharp]]
[[category:java]]
[[category:java]]
[[category:php]]
[[category:PHP]]

2020년 11월 2일 (월) 02:36 기준 최신판

함수 is_complex_password
Is complex password
IsComplexPassword

1 C#[ | ]

bool IsComplexPassword(string pwd)
{
  string pattern = @"/(?=^.{8,}$)((?=.*\\d)|(?=.*\\W+))(?![.\\n])(?=.*[A-Z])(?=.*[a-z]).*$/";
  return Regex.IsMatch(pwd, pattern);
}

2 PHP[ | ]

function IsComplexPassword($pwd) {
  if(!preg_match('/(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/', $pwd))return false;
  return true;
}

3 Java[ | ]

private Boolean IsComplexPassword(String pwd) {
  Pattern p = Pattern.compile("/(?=^.{8,}$)((?=.*\\d)|(?=.*\\W+))(?![.\\n])(?=.*[A-Z])(?=.*[a-z]).*$/");
  Matcher m = p.matcher(pwd);
  return m.matches();
}

4 같이 보기[ | ]

5 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}