title: PHP and Mcrypt for alphabet only crypts?
body: <p>Below is my current encryption function.</p>
  
  <pre><code>define('ENCRYPT_KEY', 'ldkKKmeJddeFffKdjeddd'); 
  
  function market_dock_api_encrypt($string) {
          $key = ENCRYPT_KEY; //preset key to use on all encrypt and decrypts.
          $result = '';
     for($i=0; $i&lt;strlen($string); $i++) {
       $char = substr($string, $i, 1);
       $keychar = substr($key, ($i % strlen($key))-1, 1);
       $char = chr(ord($char)+ord($keychar));
       $result.=$char;
     }
     return urlencode(base64_encode($result));
  }
  </code></pre>
  
  <p>I just realised that this sometimes results in keys with characters such as "%" in it, and I need a key that I can use in URLs. How can I change this to allow for that? I was under the impression that that's what the base64_encode part does. Obviously, I'm wrong.</p>