/**
  * Calculate a base 64 encoded SHA256 HMAC according to the rules at
  * https://docs.adyen.com/developers/hpp-manual#hmacpaymentsetupsha256
  *
  * @param GatewayType $adapter
  * @param array $values
  * @return string
  */
 public static function calculateSignature(GatewayType $adapter, $values)
 {
     $ignoredKeys = array('sig', 'merchantSig', 'title', 'liberated');
     foreach (array_keys($values) as $key) {
         if (substr($key, 0, 7) === 'ignore.' || in_array($key, $ignoredKeys)) {
             unset($values[$key]);
         } else {
             // escape colons and backslashes
             $values[$key] = str_replace('\\', '\\\\', $values[$key]);
             $values[$key] = str_replace(':', '\\:', $values[$key]);
         }
     }
     ksort($values, SORT_STRING);
     $merged = array_merge(array_keys($values), array_values($values));
     $joined = implode(':', $merged);
     $secret = $adapter->getAccountConfig('SharedSecret');
     return base64_encode(hash_hmac('sha256', $joined, pack("H*", $secret), true));
 }
 public static function calculateSignature(GatewayType $adapter, $message)
 {
     $key = $adapter->getAccountConfig('SecretKey');
     return strtoupper(hash_hmac('sha256', pack('A*', $message), pack('A*', $key)));
 }