Created
October 18, 2018 09:07
-
-
Save ashkanRmk/226ff51dd9f21cf1a2f1e7f64968342c to your computer and use it in GitHub Desktop.
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
| function base64url_encode($plainText) | |
| { | |
| $base64 = base64_encode($plainText); | |
| $base64 = trim($base64, "="); | |
| $base64url = strtr($base64, '+/', '-_'); | |
| return ($base64url); | |
| } | |
| $random = bin2hex(openssl_random_pseudo_bytes(32)); | |
| $verifier = base64url_encode(pack('H*', $random)); | |
| $challenge = base64url_encode(pack('H*', hash('sha256', $verifier))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment