been breaking my head for the past day,
given a token and salt, I need to generated a hashed token that matches the one produce by Spring's MessageDigestPasswordEncoder.encodePassword:
I have tried everything available in CommonCrypto, 10 different ways, no luck.
The Java code:
public static void main(String[] args) {
String token = "a token";
String secret = "a salt";
String sha = "SHA-256";
String proposedMatch = "";
MessageDigestPasswordEncoder encoder = new MessageDigestPasswordEncoder(sha);
String encryptedToken = encoder.encodePassword(token, secret);
System.out.println("Encrypted Token: " + encryptedToken);
isMatch = encoder.isPasswordValid(encryptedToken, token, secret);
System.out.println("Is the actual encrypted token valid? " + isMatch);
}
is there any c/c++ library I could use to match the output? (i dont have that bit above so I can run it, i've been given a token, a salt i cant share ~for obvious reasons~ and an expected output)