Encrypt PHP texts [duplicate]

0

I need to save encrypted text to my database, but I need to retrieve it afterwards, I found several examples with a password, but all one-way . and I also do not want to use the base64_encode/decode handle.

If anyone can give me a light and tell me the way, I am very grateful!

Example:

<?php
  function cripto ($texto, $tipo) {

    $chave = 'qwf4w58';

    if ($tipo == 'encriptar') {

      $texto + $chave = $texto_encriptado;
      return $texto_encriptado;

    } else if ($tipo == 'desencriptar') {

      $texto + $chave = $texto_desencriptado;
      return $texto_desencriptado;

    }
  }
?>
    
asked by anonymous 21.03.2018 / 14:45

0 answers