Determines if a given GlobalID is correct, i.e. if it is derived by the specified $key and $salt.

@param $key the publicKey
@param $salt the salt
@param $gid the GlobalID to check

@return true if the $gid is correct, else false
8395
public static function verifyGID($key, $salt, $gid)
	{
		if(self::createGID($key, $salt) == $gid)
			return true;
		else
			return false;
	}
557055
public function requestHasToken($key)
    {
        $token = $this->request->input($key, null);
        
        if($token && $token === $this->getToken($key))
        {
            return true;
        }

        return false;
    }
283466
public function verifySalt($input)
    {
        $regex = '/^\$' . $this->_identifier . '\$(?:rounds=(\d{4,9})\$)?([\.\/0-9A-Za-z]{0,16})\$?$/';
        $matches = array ();

        $appearsValid = (1 === preg_match($regex, $input, $matches));
        if ($appearsValid) {
            $rounds = (int) $matches[1];
            $salt = $matches[2];

            // If rounds parameter is in the salt position, the configuration
            // is probably not what the user intends. We could let it pass and
            // it'll "work", but we'll fail it for now.
            if (strpos($salt, 'rounds=') === 0) {
                $appearsValid = false;
            }

            if (!empty ($matches[1]) && ($rounds < 1000 || $rounds > 999999999)) {
                $appearsValid = false;
            }
        }

        return $appearsValid;
    }
1347059
protected function isKeyAllowed($key)
    {
        /*
         * Let the core columns through
         */
        if ($key == 'id' || $key == 'value' || $key == 'item') {
            return true;
        }

        /*
         * Let relations through
         */
        if ($this->model->hasRelation($key)) {
            return true;
        }

        return false;
    }
375052
public static function getByID($gID)
    {
        $db = Database::connection();
        $g = CacheLocal::getEntry('group', $gID);
        if (is_object($g)) {
            return $g;
        }

        $row = $db->fetchAssoc('select * from ' . $db->getDatabasePlatform()->quoteSingleIdentifier('Groups') . ' where gID = ?', [$gID]);
        if ($row) {
            $g = \Core::make('\Concrete\Core\User\Group\Group');
            $g->setPropertiesFromArray($row);
            CacheLocal::set('group', $gID, $g);

            return $g;
        }
    }
87320
public function comparePasswords($password)
    {
        $passwordSalted = $this->saltPassword($password);
        if (password_verify($passwordSalted, $this->privateKey)) {
            return true;
        }
        
        return false;
    }
1310873
public function verifySign($data, $key)
    {
        $prestr = $data['prestr'];
        $sign = $data['sign'];
        $prestr = $prestr . $key;
        $mysgin = md5($prestr);

        if($mysgin == $sign) {
            return true;
        }

        return false;
    }
1212782
public function __isset($key) {
        switch (true) {
            case isset($this->_params[$key]):
                return true;
            case isset($this->GET[$key]):
                return true;
            case isset($this->POST[$key]):
                return true;
            case isset($_COOKIE[$key]):
                return true;
            case isset($this->SERVER[$key]):
                return true;
            case isset($this->ENV[$key]):
                return true;
            default:
                return false;
        }
    }
1230308
def gid_exists(gid):
    """"""
    try:
        grp.getgrgid(gid)
        gid_exists = True
    except KeyError:
        gid_exists = False
    return gid_exists
382093
public function sodiumCryptoAuthVerify($mac, $message, $key)
    {
        if (in_array($this->libsodiumVersion, ['2', '7'], true)) {
            return sodium_crypto_auth_verify($mac, $message, $key);
        }

        throw new CryptoException(self::ERR_NEED_MORE_SALT);
    }
294038
def kdf_salt(self):
        

        encryption_algo = self['algorithm'].native

        if encryption_algo == 'pbes2':
            salt = self['parameters']['key_derivation_func']['parameters']['salt']

            if salt.name == 'other_source':
                raise ValueError(unwrap(
                    '''
                    Can not determine key derivation salt - the
                    reserved-for-future-use other source salt choice was
                    specified in the PBKDF2 params structure
                    '''
                ))

            return salt.native

        if encryption_algo.find('.') == -1:
            if encryption_algo.find('_') != -1:
                return self['parameters']['salt'].native

            raise ValueError(unwrap(
                '''
                Encryption algorithm "%s" does not have a registered key
                derivation function
                ''',
                encryption_algo
            ))

        raise ValueError(unwrap(
            '''
            Unrecognized encryption algorithm "%s", can not determine key
            derivation salt
            ''',
            encryption_algo
        ))
449269
function setupUGID(uid, gid) {
    if (uid) {
        if (!gid) {
            gid = uid;
        }

        try {
            process.setgid(gid);
            util.log('changed gid to ' + gid);
            process.setuid(uid);
            util.log('changed uid to ' + uid);
        } catch (e) {
            util.log('Failed to set uid/gid to ' + [uid, gid].join('/') +
                ' Error: ' + e.message);
        }
    }
}
81922
public function hash($password, $salt = null)
    {
        $hash_format = sprintf("$2y$%02d$", $this->cost);

        !$salt && $salt = $this->generateSalt();
        if (strlen($salt) < 22) {
            throw new \InvalidArgumentException(sprintf("Provided salt is too short: %d expecting %d", strlen($salt), 22));
        }

        $hash = $hash_format . $salt;
        $ret = crypt($password, $hash);

        if (!is_string($ret) || strlen($ret) <= 13) {
            return false;
        }

        return $ret;
    }
1198222
protected function isPk($key)
    {
        $pk = $this->getPk();
        if (is_string($pk) && $pk == $key) {
            return true;
        } elseif (is_array($pk) && in_array($key, $pk)) {
            return true;
        }

        return false;
    }
1292317
function useNonce($server_url, $timestamp, $salt)
    {
        global $Auth_OpenID_SKEW;

        if (!$this->active) {
            trigger_error("FileStore no longer active", E_USER_ERROR);
            return null;
        }

        if ( abs($timestamp - time()) > $Auth_OpenID_SKEW ) {
            return false;
        }

        if ($server_url) {
            list($proto, $rest) = explode('://', $server_url, 2);
        } else {
            $proto = '';
            $rest = '';
        }

        $parts = explode('/', $rest, 2);
        $domain = $this->_filenameEscape($parts[0]);
        $url_hash = $this->_safe64($server_url);
        $salt_hash = $this->_safe64($salt);

        $filename = sprintf('%08x-%s-%s-%s-%s', $timestamp, $proto,
                            $domain, $url_hash, $salt_hash);
        $filename = $this->nonce_dir . DIRECTORY_SEPARATOR . $filename;

        $result = @fopen($filename, 'x');

        if ($result === false) {
            return false;
        } else {
            fclose($result);
            return true;
        }
    }
680695
def chgid(name, gid):
    '''
    
    '''
    pre_gid = __salt__['file.group_to_gid'](name)
    if gid == pre_gid:
        return True
    cmd = 'groupmod -g {0} {1}'.format(gid, name)
    __salt__['cmd.run'](cmd, python_shell=False)
    post_gid = __salt__['file.group_to_gid'](name)
    if post_gid != pre_gid:
        return post_gid == gid
    return False
863765
def salt(self):
        
        cursor = connections[PGCRYPTOAUTH_DATABASE].cursor()
        cursor.execute("SELECT gen_salt('%s')" % PGCRYPTOAUTH_ALGORITHM)
        return cursor.fetchall()[0][0]