// GetTextHash generate MD5 hash of message's text
970622
func (m *Message) GetTextHash() string {
	if m.Text != "" {
		return fmt.Sprintf("%x", md5.Sum([]byte(m.Text)))
	}
	return ""
}
1259493
func (bc *BlockChain) GetHeaderByHash(hash common.Hash) *types.Header {
	return bc.hc.GetHeaderByHash(hash)
}
492190
func computeHash(msg []byte) ([]byte, error) {
	h, err := cryptosuite.GetDefault().Hash(msg, cryptosuite.GetSHA256Opts())
	if err != nil {
		return nil, errors.WithMessage(err, "failed to compute tls cert hash")
	}
	return h, err
}
1174411
func (c *CodeResult) GetSHA() string {
	if c == nil || c.SHA == nil {
		return ""
	}
	return *c.SHA
}
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
}
403858
func GetText(imgPath string, args ...string) (string, error) {
	var lang = "eng"

	if len(args) > 0 {
		lang = args[0]
		if lang == "zh" {
			lang = "chi_sim"
		}
	}

	client := gosseract.NewClient()
	defer client.Close()

	client.SetImage(imgPath)
	client.SetLanguage(lang)
	return client.Text()
}
1032429
func (self *Context) GetText() string {
	if self.text == nil {
		self.initText()
	}
	return util.Bytes2String(self.text)
}
212019
func PasswordHash(username, password string) string {
	hash := md5.Sum([]byte(strings.ToLower(username) + password))
	return fmt.Sprintf("%x", hash)
}
251984
func (g *GitObject) GetSHA() string {
	if g == nil || g.SHA == nil {
		return ""
	}
	return *g.SHA
}
1050181
func (state *UserState) PasswordHash(username string) (string, error) {
	return state.users.Get(username, "password")
}
691437
func GetBlockHashCtx(r *http.Request) (string, error) {
	hash, ok := r.Context().Value(ctxBlockHash).(string)
	if !ok {
		apiLog.Trace("block hash not set")
		return "", fmt.Errorf("block hash not set")
	}
	if _, err := chainhash.NewHashFromStr(hash); err != nil {
		apiLog.Trace("invalid hash '%s': %v", hash, err)
		return "", fmt.Errorf("invalid hash '%s': %v", hash, err)
	}

	return hash, nil
}
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)
}
509819
func MD5(text []byte) string {
	result := md5.Sum(text)
	return hex.EncodeToString(result[:])
}
1253044
func (msg *Message) Hash() uint64 {
	data, _ := msg.Marshal()
	return murmur3.Sum64(data)
}
656601
func (m *MockCryptoSuite) GetHash(opts core.HashOpts) (hash.Hash, error) {
	return sha256.New(), nil
}
228147
func NewHash(s string) Hash {
	b, _ := hex.DecodeString(s)

	var h Hash
	copy(h[:], b)

	return h
}
235569
func (txRwSet *TxRwSet) GetPvtDataHash(ns, coll string) []byte {
	// we could build and use a map to reduce the number of lookup
	// in the future call. However, we decided to defer such optimization
	// due to the following assumptions (mainly to avoid additioan LOC).
	// we assume that the number of namespaces and collections in a txRWSet
	// to be very minimal (in a single digit),
	for _, nsRwSet := range txRwSet.NsRwSets {
		if nsRwSet.NameSpace != ns {
			continue
		}
		return nsRwSet.getPvtDataHash(coll)
	}
	return nil
}