I coded HMAC decryption. I try many time to decrypt the output.
This is my code
package javaapplication_HMAC;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import com.sun.org.apache.xml.internal.security.utils.Base64;
import java.util.Formatter;
public class Encryption {
public void Encryption_Base64(String x,String y){
String message = x;
String key = y;
String algorithm = "HmacSHA1";
try {
Mac sha256_hmac = Mac.getInstance(algorithm);
SecretKeySpec secret_key = new SecretKeySpec(key.getBytes("UTF-8"), algorithm);
sha256_hmac.init(secret_key);
String hash = Base64.encode(sha256_hmac.doFinal(message.getBytes("UTF-8")));
System.out.println(hash);
} catch (NoSuchAlgorithmException | UnsupportedEncodingException | InvalidKeyException e) {
e.printStackTrace();
}
}
public static void main(String args[]) {
Encryption encryption_base64 = new Encryption();
encryption_base64.Encryption_Base64("test", "123456");
}
}
The output is : QFemksWe6HuyDAJIepZd+ldchzc=
Is it possible to decrypt it?