private static byte[] F(String P, String S, int c, int i) throws Exception { byte[] U_LAST = null; byte[] U_XOR = null; SecretKeySpec key = new SecretKeySpec(P.getBytes("UTF-8"), "HmacSHA512"); Mac mac = Mac.getInstance(key.getAlgorithm()); mac.init(key); for (int j = 0; j < c; j++) { if (j == 0) { byte[] baS = S.getBytes("UTF-8"); byte[] baI = INT(i); byte[] baU = new byte[baS.length + baI.length]; System.arraycopy(baS, 0, baU, 0, baS.length); System.arraycopy(baI, 0, baU, baS.length, baI.length); U_XOR = mac.doFinal(baU); U_LAST = U_XOR; mac.reset(); } else { byte[] baU = mac.doFinal(U_LAST); mac.reset(); for (int k = 0; k < U_XOR.length; k++) { U_XOR[k] = (byte) (U_XOR[k] ^ baU[k]); } U_LAST = baU; } } return U_XOR; }
private static byte[] F(String P, String S, int c, int i) throws Exception { byte[] U_LAST = null; byte[] U_XOR = null; SecretKeySpec key = new SecretKeySpec(P.getBytes("UTF-8"), "HmacSHA512"); Mac mac = Mac.getInstance(key.getAlgorithm()); mac.init(key); for (int j = 0; j < c; j++) { if (j == 0) { byte[] baS = S.getBytes("UTF-8"); byte[] baI = INT(i); byte[] baU = new byte[baS.length + baI.length]; System.arraycopy(baS, 0, baU, 0, baS.length); System.arraycopy(baI, 0, baU, baS.length, baI.length); U_XOR = mac.doFinal(baU); U_LAST = U_XOR; mac.reset(); } else { byte[] baU = mac.doFinal(U_LAST); mac.reset(); for (int k = 0; k < U_XOR.length; k++) { U_XOR[k] = (byte) (U_XOR[k] ^ baU[k]); } U_LAST = baU; } } return U_XOR; }
private static byte[] F(String P, String S, int c, int i) throws Exception { byte[] U_LAST = null; byte[] U_XOR = null; SecretKeySpec key = new SecretKeySpec(P.getBytes("UTF-8"), "HmacSHA512"); Mac mac = Mac.getInstance(key.getAlgorithm()); mac.init(key); for (int j = 0; j < c; j++) { if (j == 0) { byte[] baS = S.getBytes("UTF-8"); byte[] baI = INT(i); byte[] baU = new byte[baS.length + baI.length]; System.arraycopy(baS, 0, baU, 0, baS.length); System.arraycopy(baI, 0, baU, baS.length, baI.length); U_XOR = mac.doFinal(baU); U_LAST = U_XOR; mac.reset(); } else { byte[] baU = mac.doFinal(U_LAST); mac.reset(); for (int k = 0; k < U_XOR.length; k++) { U_XOR[k] = (byte) (U_XOR[k] ^ baU[k]); } U_LAST = baU; } } return U_XOR; }
private static byte[] F(String P, String S, int c, int i) throws Exception { byte[] U_LAST = null; byte[] U_XOR = null; SecretKeySpec key = new SecretKeySpec(P.getBytes("UTF-8"), "HmacSHA512"); Mac mac = Mac.getInstance(key.getAlgorithm()); mac.init(key); for (int j = 0; j < c; j++) { if (j == 0) { byte[] baS = S.getBytes("UTF-8"); byte[] baI = INT(i); byte[] baU = new byte[baS.length + baI.length]; System.arraycopy(baS, 0, baU, 0, baS.length); System.arraycopy(baI, 0, baU, baS.length, baI.length); U_XOR = mac.doFinal(baU); U_LAST = U_XOR; mac.reset(); } else { byte[] baU = mac.doFinal(U_LAST); mac.reset(); for (int k = 0; k < U_XOR.length; k++) { U_XOR[k] = (byte) (U_XOR[k] ^ baU[k]); } U_LAST = baU; } } return U_XOR; }