bzr branch
http://gegoxaren.bato24.eu/bzr/magstudentportal/trunk
15.1.7
by Gustav Hartvigsson
* added a few things that will help with development |
1 |
package common; |
2 |
||
3 |
public class |
|
4 |
Utils { |
|
5 |
private Utils () {}; |
|
6 |
|
|
7 |
/** |
|
8 |
* A hash function that salts the password
|
|
9 |
* in a way that is pseudo dynamic.
|
|
10 |
*
|
|
11 |
* @param t the text to salt
|
|
12 |
* @param s the salt
|
|
13 |
* @return
|
|
14 |
*/
|
|
15 |
static public String |
|
16 |
real_hash_func (String t, String s) { |
|
17 |
int a = t.getBytes()[0]; |
|
15.1.8
by Gustav Hartvigsson
* humm... |
18 |
@SuppressWarnings("unused") |
15.1.7
by Gustav Hartvigsson
* added a few things that will help with development |
19 |
int b = t.getBytes()[a%t.length()]; |
20 |
|
|
15.1.8
by Gustav Hartvigsson
* humm... |
21 |
/* Rotate the string as here: |
22 |
*
|
|
23 |
*/
|
|
24 |
|
|
15.1.7
by Gustav Hartvigsson
* added a few things that will help with development |
25 |
|
26 |
return null; |
|
27 |
} |
|
28 |
|
|
29 |
/** |
|
30 |
* Hash a text with a salt.
|
|
31 |
*
|
|
32 |
* @param t
|
|
33 |
* @return
|
|
34 |
*/
|
|
35 |
static public String |
|
36 |
hash_func (String t) { |
|
37 |
return real_hash_func(t, common.Config.PW_SALT); |
|
38 |
} |
|
39 |
|
|
40 |
|
|
41 |
}
|