This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "crypto/hmac" | |
| "crypto/sha512" | |
| "encoding/base64" | |
| "encoding/json" | |
| "fmt" | |
| "strconv" | |
| "time" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "crypto/hmac" | |
| "crypto/sha512" | |
| "encoding/base64" | |
| "encoding/json" | |
| "errors" | |
| "fmt" | |
| "net/url" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import hmac, hashlib, json, time, base64 | |
| SHARED_SECRET = 'sup3rs3cr3t!!' | |
| def signString(string_to_sign, shared_secret): | |
| return hmac.new(shared_secret, string_to_sign, hashlib.sha512).digest() | |
| if __name__ == '__main__': | |
| payload = { | |
| 'name': 'joe smith', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import hmac, hashlib, json, time, base64, urlparse | |
| SHARED_SECRET = 'sup3rs3cr3t!!' | |
| def verifySignature(string_to_verify, signature, shared_secret): | |
| return ct_compare(hmac.new(shared_secret, | |
| string_to_verify, hashlib.sha512).digest(), signature) | |
| def verifyTime(decoded_json): | |
| j = json.loads(decoded_json) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'digest' | |
| require 'base64' | |
| require 'cgi' | |
| require 'time' | |
| require 'openssl' | |
| require 'json' | |
| SHARED_SECRET = 'sup3rs3cr3t!!' | |
| def signString(string_to_sign, shared_secret) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'digest' | |
| require 'base64' | |
| require 'cgi' | |
| require 'uri' | |
| require 'time' | |
| require 'openssl' | |
| require 'json' | |
| require 'active_support/security_utils' | |
| SHARED_SECRET = 'sup3rs3cr3t!!' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| define("SHARED_SECRET", "sup3rs3cr3t!!"); | |
| function signString($string_to_sign, $shared_secret) { | |
| return hash_hmac("sha512", $string_to_sign, $shared_secret); | |
| } | |
| $payload = array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| define("SHARED_SECRET", "sup3rs3cr3t!!"); | |
| if(!function_exists('hash_equals')) { | |
| function hash_equals($str1, $str2) { | |
| // Run constant-time comparison for PHP < 5.6 which doesn't support hmac_equals | |
| $str1_len = strlen($str1); | |
| $str2_len = strlen($str2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var crypto = require('crypto'); | |
| var SHARED_SECRET = "sup3rs3cr3t!!"; | |
| function signString(string_to_sign, shared_secret) { | |
| var hmac = crypto.createHmac('sha512', shared_secret); | |
| hmac.write(string_to_sign); | |
| hmac.end() | |
| return hmac.read(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var crypto = require('crypto'); | |
| // Added for safer string equality checking | |
| var bufferEq = require('buffer-equal-constant-time'); | |
| var url = require('url'); | |
| var SHARED_SECRET = "sup3rs3cr3t!!"; | |
| function verifySignature(string_to_sign, signature, shared_secret) { | |
| var hmac = crypto.createHmac('sha512', shared_secret); | |
| hmac.write(string_to_sign); | |
| hmac.end() |
OlderNewer