Advertisement
Guest User

signature_new

a guest
Feb 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. <!--<?php
  2. /*
  3. date_default_timezone_set('UTC');
  4. $tStamp = strval(time()-strtotime('1970-01-01 00:00:00'));
  5.  
  6. $cons_id = "XXXXXX";
  7. $data= $cons_id."&".$tStamp;
  8. echo $data;
  9. $secretKey = "XXXXX";
  10.  
  11. echo $tStamp;
  12.  
  13. // Computes the signature by hashing the salt with the secret key as the key
  14.  
  15. $signature = hash_hmac('sha256', $data, $secretKey, true);
  16.  
  17.  
  18.  
  19. // base64 encode…
  20.  
  21. $encodedSignature = base64_encode($signature);
  22. # echo $encodedSignature;
  23.  
  24. // urlencode…
  25.  
  26. // $encodedSignature = urlencode($encodedSignature);
  27. */
  28. ?>-->
  29.  
  30.  
  31. <?php
  32. $data = "XXXX";
  33. $secretKey = "XXXXX";
  34. // Computes the timestamp
  35. //date_default_timezone_set('UTC');
  36. //$tStamp = strval(time()-strtotime('1970-01-01 00:00:00'));
  37.  
  38. date_default_timezone_set('UTC');
  39. $tStamp = strval(time()-strtotime('1970-01-01 00:00:00'));
  40. $signature = hash_hmac('sha256', $data."&".$tStamp, $secretKey, true);
  41. $encodedSignature = base64_encode($signature);
  42.  
  43.  
  44.  
  45.  
  46.  
  47. // Computes the signature by hashing the salt with the secret key as the key
  48. $signature = hash_hmac('sha256', $data."&".$tStamp, $secretKey, true);
  49.  
  50. // base64 encode…
  51. $encodedSignature = base64_encode($signature);
  52.  
  53. // urlencode…
  54. // $encodedSignature = urlencode($encodedSignature);
  55.  
  56. //echo "X-cons-id: " .$data ." ";
  57. //echo "X-timestamp:" .$tStamp ." ";
  58. //echo "X-signature: " .$encodedSignature;
  59.  
  60. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement