最近每天晚上基本都是十点才回来,白天上班也没事干,就研究一下新公司的内部框架。刚好一不小心看到了加密的方法,就随手记下来了。
public static String encIBankingPasswd(String plainTextPwd) {
byte SHAS2[] = new byte[21];
byte input[] = new byte[1024];
String encPwd = null;
try {
Base64 b64 = new Base64();
input = plainTextPwd.getBytes();
SHA1 sha1 = new SHA1();
sha1.init();
sha1.update(input, input.length);
SHAS2 = sha1.end();
b64.startEncode();
b64.encode(SHAS2, SHAS2.length);
b64.endEncode();
byte byEncoded[] = b64.getEncodedResult();
encPwd = new String(byEncoded);
} catch (Exception e) {
return null;
}
return encPwd;
}