Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ol> <li>The PHP function you are after is Mcrypt (<a href="http://www.php.net/manual/en/intro.mcrypt.php" rel="nofollow noreferrer">http://www.php.net/manual/en/intro.mcrypt.php</a>).</li> </ol> <p>The example from the manual is slightly edited for this example):</p> <pre><code>&lt;?php $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $key = "This is a very secret key"; $pass = "PasswordHere"; echo strlen($pass) . "\n"; $crypttext = mcrypt_encrypt(MCRYPT_BLOWFISH, $key, $pass, MCRYPT_MODE_ECB, $iv); echo strlen($crypttext) . "\n"; ?&gt; </code></pre> <p>You would use <a href="http://www.php.net/manual/en/function.mcrypt-decrypt.php" rel="nofollow noreferrer"><strong>mcrypt_decrypt</strong></a> to decrypt your password.</p> <ol start="2"> <li><p>The best <a href="http://www.php.net/manual/en/mcrypt.ciphers.php" rel="nofollow noreferrer">algorithm</a> is rather subjective - ask 5 people, get 5 answers. Personally if the the default (Blowfish) isn't good enough for you, you probably have bigger problems! </p></li> <li><p>Given that it is needed by PHP to encrypt - not sure you can hide it anywhere - welcome comments on this. Standard PHP best coding practices apply of course!</p></li> <li><p>Given that the encryption key will be in your code anyway, not sure what you will gain, providing the rest of your application is secure.</p></li> <li><p>Obviously, if the encrypted password and the encryption key are stolen, then game over. </p></li> </ol> <p>I'd put a rider on my answer - I'm not a PHP crypto expert, but, I think what I have answered is standard practice - I welcome comments other may have. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload