• PHP Encrypt Decrypt using Base64

    Here, we use encrypt and decrypt string using base64. I have defined function for the encrypt and decrypt.

     

    1
    2
    3
    
    function encrypt($string, $key) {
    $result = '';
    for($i=0; $i

    You can call function like:

    1
    2
    
    $encrypted = encrypt("Hello How are you", "testdata");
    $decrypted = decrypt($encrypted, "testdata");

    So we can encrypt and decrypt string with our key.

Comments on this post

Leave a Reply

  • Security Code :


    − five = 4