Calculate AuthKey hash and ID
334807
function createAuthKeyID(context) {
    var authKeyHash = utility.createSHAHash(context.authKeyValue);
    var authKeyAuxHash = authKeyHash.slice(0, 8);
    var authKeyID = authKeyHash.slice(-8);
    if (logger.isDebugEnabled()) {
        logger.debug('authKeyID(%s) = %s', authKeyID.length, authKeyID.toString('hex'));
    }
    context.authKeyID = authKeyID;
    context.authKeyAuxHash = authKeyAuxHash;
    return context;
}
1251045
def _getAuth(self, auth):
        """"""
        if type(auth) is dict:
            return auth
        else:
            # auth is string
            if None != self._clientid:
                return {"cik": auth, "client_id": self._clientid}
            elif None != self._resourceid:
                return {"cik": auth, "resource_id": self._resourceid}
            return {"cik": auth}
170066
def _get_authentication_from_public_key_id(self, key_id):
        """"""
        for authentication in self._authentications:
            if authentication.is_key_id(key_id):
                return authentication
        return None
246348
def _get_passwordkey(self):
        """"""

        sha = SHA256.new()
        sha.update(self.password.encode('utf-8'))
        return sha.digest()
650795
def _compute_key(self, id, nbytes):
        ""
        m = Message()
        m.add_mpint(self.K)
        m.add_bytes(self.H)
        m.add_byte(id)
        m.add_bytes(self.session_id)
        out = sofar = SHA.new(str(m)).digest()
        while len(out) < nbytes:
            m = Message()
            m.add_mpint(self.K)
            m.add_bytes(self.H)
            m.add_bytes(sofar)
            digest = SHA.new(str(m)).digest()
            out += digest
            sofar += digest
        return out[:nbytes]
836623
function parseAuth(auth) {
	if (auth && typeof auth === 'string') {
		var authObject = {
			username: auth.split(':')[0],
			password: auth.split(':')[1]
		};
		return authObject;
	} else {
		return auth;
	}
}
869390
def _authstr(self, auth):
        """"""
        if type(auth) is dict:
            return '{' + ','.join(["{0}:{1}".format(k, auth[k]) for k in sorted(auth.keys())]) + '}'
        return auth
545587
private static int computeKey(Collection array) {
        int intKey = 0;
        for (Object s : array) {
            intKey += s.hashCode();
        }
        return intKey;
    }
732232
def _key(self, username, frozen=False):
        """"""
        if frozen:
            return self.frozen + username
        return self.prefix + username
1333633
static function _hash_hmac($algo, $data, $key, $raw_output=false)
    {
        $algo = strtolower($algo);
        $pack = 'H'.strlen($algo('test'));
        $size = 64;
        $opad = str_repeat(chr(0x5C), $size);
        $ipad = str_repeat(chr(0x36), $size);

        if (strlen($key) > $size) {
            $key = str_pad(pack($pack, $algo($key)), $size, chr(0x00));
        } else {
            $key = str_pad($key, $size, chr(0x00));
        }

        $keyLastPos = strlen($key) - 1;
        for ($i = 0; $i < $keyLastPos; $i++) {
            $opad[$i] = $opad[$i] ^ $key[$i];
            $ipad[$i] = $ipad[$i] ^ $key[$i];
        }

        $output = $algo($opad.pack($pack, $algo($ipad.$data)));

        return ($raw_output) ? pack($pack, $output) : $output;
    }
1314587
def _get_user_hash(self):
        """"""
        if request:
            user_hash = '{ip}-{ua}'.format(ip=request.remote_addr,
                                           ua=self._get_user_agent())
            alg = hashlib.md5()
            alg.update(user_hash.encode('utf8'))
            return alg.hexdigest()
        return None
1342078
def make_hash_id():
    
    today = datetime.datetime.now().strftime(DATETIME_FORMAT)
    return hashlib.sha1(today.encode('utf-8')).hexdigest()
735581
function key() {
	var hashName = _.result( this, 'hashAttribute' ) || _.result( this, 'idAttribute' ),
		rangeNake = _.result( this, 'rangeAttribute' );

	return this.pick( hashName, rangeNake );
}
62400
def process_basic_auth(auth)
      case auth
      when String
        self.login, self.password = auth.split(':', 2)
      when Hash
        self.login    = auth[:login]
        self.password = auth[:password]
      end
    end
527947
def id_hash
      @terms.inject({}) {|sum, t| sum.update(t.id.value => t.name.value)}
    end
151306
def sha(self):
        """"""
        if self._sha is None:
            self._sha = compute_auth_key(self.userid, self.password)
        return self._sha
442616
def _calc_key(auth_key, msg_key, client):
        
        x = 0 if client else 8
        sha256a = sha256(msg_key + auth_key[x: x + 36]).digest()
        sha256b = sha256(auth_key[x + 40:x + 76] + msg_key).digest()

        aes_key = sha256a[:8] + sha256b[8:24] + sha256a[24:32]
        aes_iv = sha256b[:8] + sha256a[8:24] + sha256b[24:32]

        return aes_key, aes_iv