base64codec.php 362 B

12345678910111213
  1. <?php
  2. // codec standard per le stringhe. fs-safe e url-safe, rfc4648 sez. 5
  3. function encoder($string){
  4. $string = base64_encode($string);
  5. // da indagare
  6. // $string = mb_convert_encoding( $string, "UTF-8", "BASE64" );
  7. return rtrim(strtr($string,"+/","-_"),"=");
  8. }
  9. function decoder($string){
  10. return base64_decode(strtr($string,"-_","+/"));
  11. }
  12. ?>