// getAlgo decides which algorithm to use with this key type for the given hash.
169147
func (i *macIdentity) getAlgo(hash crypto.Hash) (algo C.SecKeyAlgorithm, err error) {
	var crt *x509.Certificate
	if crt, err = i.Certificate(); err != nil {
		return
	}

	switch crt.PublicKey.(type) {
	case *ecdsa.PublicKey:
		switch hash {
		case crypto.SHA1:
			algo = C.kSecKeyAlgorithmECDSASignatureDigestX962SHA1
		case crypto.SHA256:
			algo = C.kSecKeyAlgorithmECDSASignatureDigestX962SHA256
		case crypto.SHA384:
			algo = C.kSecKeyAlgorithmECDSASignatureDigestX962SHA384
		case crypto.SHA512:
			algo = C.kSecKeyAlgorithmECDSASignatureDigestX962SHA512
		default:
			err = ErrUnsupportedHash
		}
	case *rsa.PublicKey:
		switch hash {
		case crypto.SHA1:
			algo = C.kSecKeyAlgorithmRSASignatureDigestPKCS1v15SHA1
		case crypto.SHA256:
			algo = C.kSecKeyAlgorithmRSASignatureDigestPKCS1v15SHA256
		case crypto.SHA384:
			algo = C.kSecKeyAlgorithmRSASignatureDigestPKCS1v15SHA384
		case crypto.SHA512:
			algo = C.kSecKeyAlgorithmRSASignatureDigestPKCS1v15SHA512
		default:
			err = ErrUnsupportedHash
		}
	default:
		err = errors.New("unsupported key type")
	}

	return
}
1249140
func (c *CryptoSuite) GetKey(ski []byte) (k core.Key, err error) {
	key, err := c.BCCSP.GetKey(ski)
	return GetKey(key), err
}
251984
func (g *GitObject) GetSHA() string {
	if g == nil || g.SHA == nil {
		return ""
	}
	return *g.SHA
}
1253553
func (a TokenAlgo) hash(secret []byte) hash.Hash {
	switch a {
	case TokenAlgoHmacSHA256:
		return hmac.New(sha256.New, secret)
	}
	return nil
}
386537
func (s *KeyGen) GetByKey(key string) (hash string, val interface{}, err error) {
	var r interface{}
	search := fmt.Sprintf("*:%s", key)

	if r, err = s.store().Do("KEYS", search); r != nil && err == nil {

		if _, _, hash, err = parseKeysResponse(r); err == nil {
			val, err = s.getHashMap(hash)
		}
	}
	return
}
120312
func GetType(err error, v interface{}) error {
	es := GetAllType(err, v)
	if len(es) > 0 {
		return es[len(es)-1]
	}

	return nil
}
442901
func (h *HashMap) Get(k T) (T, bool) {
	hash := h.hash(k)
	for entry := h.table[hash]; entry != nil; entry = entry.next {
		if h.eq(entry.k, k) {
			return entry.v, true
		}
	}
	return nil, false
}
998072
func (s *CommonStorageDB) GetValueHash(namespace, collection string, keyHash []byte) (*statedb.VersionedValue, error) {
	keyHashStr := string(keyHash)
	if !s.BytesKeySupported() {
		keyHashStr = base64.StdEncoding.EncodeToString(keyHash)
	}
	return s.GetState(deriveHashedDataNs(namespace, collection), keyHashStr)
}
1181442
func (m *Map) Get(k ident.ID) (MapValue, bool) {
	hash := m.hash(k)
	for entry, ok := m.lookup[hash]; ok; entry, ok = m.lookup[hash] {
		if m.equals(entry.key.key, k) {
			return entry.value, true
		}
		// Linear probe to "next" to this entry (really a rehash)
		hash++
	}
	var empty MapValue
	return empty, false
}
330068
func (bc *BlockChain) GetTdByHash(hash common.Hash) *big.Int {
	return bc.hc.GetTdByHash(hash)
}
1343786
func (a *Client) GetLookups(params *GetLookupsParams, authInfo runtime.ClientAuthInfoWriter) (*GetLookupsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetLookupsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "GetLookups",
		Method:             "GET",
		PathPattern:        "/lookups",
		ProducesMediaTypes: []string{"application/json", "application/x-gzip"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GetLookupsReader{formats: a.formats},
		AuthInfo:           authInfo,
	})
	if err != nil {
		return nil, err
	}
	return result.(*GetLookupsOK), nil
}
759578
func (b *LRUCache) Get(key string) (v interface{}, ok bool) {
	b.lock.Lock()
	defer b.lock.Unlock()

	e := b.table[key]
	if e == nil {
		return nil, false
	}

	b.touchEntry(e)
	return e.value, true
}
1068285
func LookupHash(algo string) (func() hash.Hash, error) {
	switch strings.ToLower(algo) {
	case "md5":
		return crypto.MD5.New, nil
	case "sha1":
		return crypto.SHA1.New, nil
	case "sha256":
		return crypto.SHA256.New, nil
	case "sha512":
		return crypto.SHA512.New, nil
	case "sha224":
		return crypto.SHA224.New, nil
	case "sha384":
		return crypto.SHA384.New, nil
	}
	return nil, fmt.Errorf("Invalid hash name %s: " +
		"Must be one of md5, sha1, sha256, sha512, sha224, sha284. " +
		"Do you have a manifest-%s.txt file somewhere in your bag?",
		algo, algo)
}
514400
func GetTypeHash(t reflect.Type) TypeHash {
	if t.Kind() == reflect.Ptr {
		t = t.Elem()
	}

	return TypeHash(fmt.Sprintf("%s.%s", t.PkgPath(), t.Name()))
}
755496
func (s Session) Get(key string) (newValue interface{}, err error) {
	// First check to see if it is in the session
	if v, found := s[key]; found {
		return v, nil
	}
	return s.GetInto(key, nil, false)
}
1139013
func (ts *Store) GetImageHash(id string) (string, error) {
	treepath := ts.GetPath(id)

	imgHash, err := ioutil.ReadFile(filepath.Join(treepath, imagefilename))
	if err != nil {
		return "", errwrap.Wrap(errors.New("cannot read image file"), err)
	}

	return string(imgHash), nil
}
1239137
func GetFilterHash(filter *gcs.Filter) (chainhash.Hash, error) {
	filterData, err := filter.NBytes()
	if err != nil {
		return chainhash.Hash{}, err
	}

	return chainhash.DoubleHashH(filterData), nil
}