Last active
October 29, 2023 07:36
-
-
Save herdianf/6ed2def10de57704997660f4641c2eda to your computer and use it in GitHub Desktop.
BASE64 URL RFC4648
This file contains 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 | |
function base64url_encode($data) { | |
return $data ? rtrim(strtr(base64_encode($data), '+/', '-_'), '=') : ''; | |
} | |
function base64url_decode($data) { | |
return $data ? base64_decode(strtr((string)$data, '-_', '+/'), TRUE) : ''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment