powered by nequal
Home » Wozozo_TinyCrypt » Timeline » 1259

Changeset 1259 -- 2009-10-06 17:04:04

Comment
[Package Release] Wozozo_TinyCrypt

Diffs

Wozozo_TinyCrypt/tags/release-1.0.0-20091006170404/Wozozo/TinyCrypt.php

@@ -0,0 +1,27 @@
+<?php
+// $Id$
+
+class Wozozo_TinyCrypt {
+    static public function encode($input) {
+        // RFC3548: URL safe Base64 encoding
+        static $search = array('+', '/');
+        static $replace = array('-', '_');
+
+        $gzed = gzdeflate($input);
+        $encoded = base64_encode($gzed);
+        $result = str_replace($search, $replace, $encoded);
+        // trim trailing '='
+        return rtrim($result, '=');
+    }
+
+    static public function decode($encoded) {
+        static $search = array('-', '_');
+        static $replace = array('+', '/');
+        $str = str_replace($search, $replace, $encoded);
+
+        $decoded = base64_decode($str);
+        return gzinflate($decoded);
+    }
+}
+
+?>
属性に変更があったパス: Wozozo_TinyCrypt/tags/release-1.0.0-20091006170404/Wozozo/TinyCrypt.php
___________________________________________________________________
追加: svn:keywords
+ Id Revision
追加: svn:eol-style
+ native