function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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