S
S
s2sk13372017-05-16 14:00:14
PHP
s2sk1337, 2017-05-16 14:00:14

How good are the encryption features?

Hi all. I wanted to ask how good these encryption / decryption functions are? And it is worth using them to encrypt important data.

function encode($unencoded, $key)
    {
        $string = base64_encode($unencoded);

        $arr = array();
        $x = 0;
        while($x++ < strlen($string))
        {
            $arr[$x-1] = md5(md5($key.$string[$x-1]).$key);
            $newstr = $newstr.$arr[$x-1][3].$arr[$x-1][6].$arr[$x-1][1].$arr[$x-1][2];
        }
        return $newstr;
    }

    function decode($encoded, $key)
    {
        $strofsym = "qwertyuiopasdfghjklzxcvbnm1234567890QWERTYUIOPASDFGHJKLZXCVBNM=";
        $x = 0;
        while($x++ <= strlen($strofsym))
        {
            $tmp = md5(md5($key.$strofsym[$x-1]).$key);
            $encoded = str_replace($tmp[3].$tmp[6].$tmp[1].$tmp[2], $strofsym[$x-1], $encoded);
        }
        return base64_decode($encoded);
    }

If they are bad, then please throw an alternative. Please do not offer mcrypt, it is already outdated ...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Anton, 2017-05-16
@s2sk1337

But what about php.net/manual/ru/function.openssl-encrypt.php ?

N
ns5d, 2017-05-16
@ns5d

I don't understand how this can even work if md5() is a hashing function.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question