3
import org.bouncycastle.jcajce.provider.digest.SHA3.*;
4
import org.bouncycastle.util.encoders.*;
12
* A hash function that salts the password
13
* in a way that is pseudo dynamic.
15
* @param t the text to salt
20
real_hash_func (String t, String s) {
21
int a = t.getBytes()[0];
22
int b = t.getBytes()[a%t.length()];
24
StringBuilder sb = new StringBuilder ();
25
sb.append (t).insert (b, s);
27
DigestSHA3 md = DigestSHA3 (2048);
28
md.update (sb.toString().getBytes("UTF-8"));
30
return Hex.toHexString (md.digits ());
34
* Hash a text with a salt.
40
hash_func (String t) {
41
return real_hash_func(t, common.Config.PW_SALT);