以下はJava関数です。私はPHP上でこの関数にしたい。すでに私は、コードを使用しているJAVA関数をPHPに隠す
public static String getPassword(String spId, String password, String timestamp)
{
try {
String dgStr = spId + password + timestamp;
byte[] enc = MessageDigest.getInstance("SHA-256").digest(dgStr.getBytes());
return new String(Base64.encodeBase64(new String(Hex.encodeHex(enc)).toUpperCase().getBytes()));
} catch (NoSuchAlgorithmException ex) {
ex.printStackTrace();
}
return "";
}
は
BASE64_ENCODE(hash_hmac( "SHA256"、$ spPassword、真))、以下を参照してください。
有効ですか?そうでなければ私に提案してください。
これはJavaスクリプト機能です。パスワードの暗号化のためにPHPで同じ機能が必要です。 – Aphrodite