// GenerateHash generates a SHA-1 hash of the input data.
545095
func GenerateHash(data []byte) []byte {
	sha := sha1.New()
	sha.Write(data)
	hashBytes := sha.Sum(nil)
	return hashBytes
}
834064
func (auth *Auth) ValidHash(h hash.Hash) bool {
	h.Write([]byte("\n"))
	return bytes.Equal(h.Sum(nil), auth.Hash)
}
408129
func (context *Context) CreateHash(hash crypto.Hash) (*Hash, error) {
	var hashAlg C.TSS_FLAG
	if hash == crypto.SHA1 {
		hashAlg = C.TSS_HASH_SHA1
	} else {
		hashAlg = C.TSS_HASH_OTHER
	}

	var handle C.TSS_HHASH
	err := tspiError(C.Tspi_Context_CreateObject(context.context, C.TSS_OBJECT_TYPE_HASH, hashAlg, (*C.TSS_HOBJECT)(&handle)))
	if err != nil {
		return nil, err
	}

	return &Hash{
		context: context.context,
		handle:  handle,
		hashAlg: hash,
	}, nil
}
887733
func (csp *impl) GetHash(opts bccsp.HashOpts) (h hash.Hash, err error) {
	return nil, nil
}
455124
func (str String) Hash() int {
	h := xxhash.ChecksumString64S(string(str), hashSeed0)
	return int(h)
}
929075
func hash(body string) string {
	buf := sha256.New()
	fmt.Fprintf(buf, "blob %d", len(body))
	buf.Write([]byte{0})
	buf.Write([]byte(body))
	return "v2:" + hex.EncodeToString(buf.Sum(nil))
}
1371023
func (ch *CredHub) GenerateSSH(name string, gen generate.SSH, overwrite Mode) (credentials.SSH, error) {
	var cred credentials.SSH
	err := ch.generateCredential(name, "ssh", gen, overwrite, &cred)
	return cred, err
}
610244
func (h Hash) Generate(rand *rand.Rand, size int) reflect.Value {
	m := rand.Intn(len(h))
	for i := len(h) - 1; i > m; i-- {
		h[i] = byte(rand.Uint32())
	}
	return reflect.ValueOf(h)
}
439246
func (h *HLL) AddHash(hash uint64) {
	switch h.format {
	case NORMAL:
		h.addNormal(hash)
	case SPARSE:
		h.addSparse(hash)
	}
}
859378
func Hash(password string) (key string, err error) {
	c := sha512crypt.New()
	key, err = c.Generate([]byte(password), []byte(""))

	return
}
40175
func (t *Tx) Hash() *chainhash.Hash {
	// Return the cached hash if it has already been generated.
	if t.txHash != nil {
		return t.txHash
	}

	// Cache the hash and return it.
	hash := t.msgTx.TxHash()
	t.txHash = &hash
	return &hash
}
257757
func Gen(password string) string {
	salt := generateSalt(8)
	hash := generateHash(sha1.New, salt, password, 1)
	return "sha1$" + string(salt) + "$1$" + hash
}
349606
func (p *Provider) Hash(plaintext []byte) []byte {
	pw, _ := gobcrypt.GenerateFromPassword(plaintext, int(p.Cost))
	return pw
}
844522
func Hash(s string) string {
	h := sha1.New()
	h.Write([]byte(s))

	hash := h.Sum(nil)

	return fmt.Sprintf("%x", hash)
}
1206511
func Generate(targetDir, targetSrc string, pool int, dynamic bool) error {
	filterPath := filepath.Join(targetDir, IgnoreFile)
	filter := filter.LoadFilter(filterPath)
	var hashes HashSet
	var err error
	if pool < 2 {
		hashes, err = HashDirectory(targetDir)
	} else {
		if dynamic {
			pool *= runtime.NumCPU()
		}
		hashes, err = HashDirectoryAsync(targetDir, pool)
	}
	if err != nil {
		log.Critical("failed to hash directory:", err)
		return err
	}
	filtered := FilterHashes(hashes, filter)
	return Write(targetDir, targetSrc, filtered)
}
1065166
func (csp *CSP) GetHash(opts bccsp.HashOpts) (h hash.Hash, err error) {
	// Validate arguments
	if opts == nil {
		return nil, errors.New("Invalid opts. It must not be nil.")
	}

	hasher, found := csp.Hashers[reflect.TypeOf(opts)]
	if !found {
		return nil, errors.Errorf("Unsupported 'HashOpt' provided [%v]", opts)
	}

	h, err = hasher.GetHash(opts)
	if err != nil {
		return nil, errors.Wrapf(err, "Failed getting hash function with opts [%v]", opts)
	}

	return
}
1339619
func deriveHash(object *Visitor) uint64 {
	if object == nil {
		return 0
	}
	h := uint64(17)
	h = 31*h + deriveHash_(object.UserName)
	h = 31*h + deriveHash_s(object.RemoteAddr)
	return h
}