avatar image
1
Convert hexadecimal string to bytes
By Created

How to convert a hexadecimal string to bytes, that are used to generate a signature by the HMACSHA256 class?

We are using a webservice which requires a signature (generated HMACSHA256 hash), based on a message and private key combination. This private key is provided in a hexadecimal string and needs te be converted to be used in the hash.

Below a representation of simiral functions in .NET and PHP;

  • .NET:
  • PHP: hex2bin($private_key)

How to convert a hexadecimal string to bytes, that are used to generate a signature by the HMACSHA256 class?

We are using a webservice which requires a signature (generated HMACSHA256 hash), based on a message and private key combination. This private key is provided in a hexadecimal string and needs te be converted to be used in the hash.

Below a representation of simiral functions in .NET and PHP;

  • .NET:
  • PHP: hex2bin($private_key)
Answers
Sort by:

Please login to reply to the topic.