+ Start a Discussion
@altius_rup@altius_rup 

Apex equivalent of PhP pack('H*') or Java SecretKeySpec()

Hi,

 

I'm trying to reproduce some PhP or Java stuff in APEX.

 

What is the APEX equivalent of this line of PhP code :

$binkey = pack("H*", $key); 

 

I could also ask : what is the APEX equivalent of this line of Java code :

finalSecretKeySpec secretKey = newSecretKeySpec(DatatypeConverter.parseHexBinary(key),"HmacSHA512");

 

I hope you can help me.

Rup