· 7 years ago · May 10, 2018, 07:52 PM
1<?php
2// From example:
3// $data = "{\"key\": \"value\"}";
4// $secret_key = "secretkey";
5// hashed data from example: 1eed4b3d41f4653ac64fd56f1bf1cbfd349e4482cbc11dff7134bd93e5da4b0a
6
7
8$secret_key = "secretkey";
9$data = $_POST;
10$SendCloud_Signature = apache_request_headers()['SendCloud-Signature'];
11
12$hashed_signature = hash_hmac ( "sha256" , $data , $secret_key );
13
14// You can compare the hashed signature from example with the one you can hash yourself using the example $data variable.
15assert("1eed4b3d41f4653ac64fd56f1bf1cbfd349e4482cbc11dff7134bd93e5da4b0a" == $hashed_signature);