Welcome Guest, Not a member yet? Register   Sign In
Issue with Encrypting
#3

(This post was last modified: 04-16-2020, 11:13 AM by illmaren.)

Still getting
Code:
Decrypting: authentication failed.

Code is just a quick and dirty version of it...so dont wonder about it Smile

PHP Code:
    /**
     * @param array $user
     */
    public function createUser(Array $user)
    {
        $user['user'] = bin2hex($this->encrypter->encrypt($user['user']));
        $user['salt'] = bin2hex($this->encrypter->encrypt($user['salt']));
        $user['email'] = bin2hex($this->encrypter->encrypt($user['email']));
        $this->db->table('users')->insert($user);
    }

    public function getUser()
    {
        $builder $this->db->table('users');
        $builder->where('id''1');
        $query $builder->get("1");
        $result $query->getResultObject();
        $result $result[0];

$user = new User();
$user->id $result->id;
$user->user $this->encrypter->decrypt(bin2hex($result->user));
$user->email $this->encrypter->decrypt(bin2hex($result->email));

        return $user;
    

Can be closed, solved the problem. You should'nt save your encrypted string into a varchar(100) coulmn :$
Reply


Messages In This Thread
Issue with Encrypting - by illmaren - 04-15-2020, 08:27 PM
RE: Issue with Encrypting - by Leo - 04-16-2020, 01:24 AM
RE: Issue with Encrypting - by illmaren - 04-16-2020, 08:20 AM
RE: Issue with Encrypting - by jreklund - 04-17-2020, 12:43 PM
RE: Issue with Encrypting - by InsiteFX - 04-18-2020, 03:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB