forked from fmendozaro/junit-tests
-
Notifications
You must be signed in to change notification settings - Fork 622
Expand file tree
/
Copy pathCodeupCrypt.java
More file actions
39 lines (37 loc) · 1.04 KB
/
CodeupCrypt.java
File metadata and controls
39 lines (37 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
public class CodeupCrypt {
public static double version = 0.0;
public static String hashPassword(String password){
String hash = "";
for (char character : password.toCharArray()){
switch (character){
case 'a':
case 'A':
hash += 4;
break;
case 'e':
case 'E':
hash += 3;
break;
case 'i':
case 'I':
hash += 1;
break;
case 'o':
case'O':
hash += 0;
break;
case 'u':
case 'U':
hash += 9;
break;
default:
hash += character;
break;
}
}
return hash;
}
public static boolean checkPassword(String password, String hash){
return hash.equals(hashPassword(password));
}
}