public function setType($type)
    {
        $this->type = $type;

        if (static::isSodiumAlgo($this->type)) {
            if (!extension_loaded('libsodium')) {
                throw new \DomainException('Please install php ext-libsodium >= 1.0.9 to use sodium pwhash().');
            }

            if (!defined('\Sodium\CRYPTO_PWHASH_SALTBYTES')) {
                throw new \DomainException('Libsodium must higher than 1.0.9 to use Argon2 and Scrypt algo.');
            }
        }

        return $this;
    }