Advertisement
niammuddin

fungsi base64url encode+decode

Jul 27th, 2017
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.24 KB | None | 0 0
  1. <?php
  2. function base64url_encode($data) {
  3.   return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
  4. }
  5.  
  6. function base64url_decode($data) {
  7.   return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement