// GetSHA returns the SHA field if it's non-nil, zero value otherwise.
489544
func (d *Deployment) GetSHA() string {
	if d == nil || d.SHA == nil {
		return ""
	}
	return *d.SHA
}
391231
func (cr *Context) GetDash(dashes, offset *float64) {
	C.cairo_get_dash(cr.Ptr, (*C.double)(unsafe.Pointer(dashes)), (*C.double)(unsafe.Pointer(offset)))
	if err := cr.status(); err != nil {
		panic(err)
	}
}
736787
func GetSha256() string {
	data := make([]byte, 10)
	_, _ = rand.Read(data)
	uintdata := fmt.Sprintf("%x", sha256.Sum256(data))
	return string(uintdata)[0:32]
}
1097818
func (s *Sensu) GetStash(path string) (map[string]interface{}, error) {
	return s.get(fmt.Sprintf("stashes/%s", path))
}
887733
func (csp *impl) GetHash(opts bccsp.HashOpts) (h hash.Hash, err error) {
	return nil, nil
}
1134177
func getInputSHA(input []byte) (hash []byte) {
	hasher := sha256.New()
	hasher.Write(input)
	return hasher.Sum(nil)
}
643007
func getKeyHash(key interface{}) uintptr {
	switch x := key.(type) {
	case string:
		return getStringHash(x)
	case []byte:
		return uintptr(siphash.Hash(sipHashKey1, sipHashKey2, x))
	case int:
		return getUintptrHash(uintptr(x))
	case int8:
		return getUintptrHash(uintptr(x))
	case int16:
		return getUintptrHash(uintptr(x))
	case int32:
		return getUintptrHash(uintptr(x))
	case int64:
		return getUintptrHash(uintptr(x))
	case uint:
		return getUintptrHash(uintptr(x))
	case uint8:
		return getUintptrHash(uintptr(x))
	case uint16:
		return getUintptrHash(uintptr(x))
	case uint32:
		return getUintptrHash(uintptr(x))
	case uint64:
		return getUintptrHash(uintptr(x))
	case uintptr:
		return getUintptrHash(x)
	}
	panic(fmt.Errorf("unsupported key type %T", key))
}
1255628
func (c *CombinedStatus) GetSHA() string {
	if c == nil || c.SHA == nil {
		return ""
	}
	return *c.SHA
}
155337
func (b *Blob) GetSHA() string {
	if b == nil || b.SHA == nil {
		return ""
	}
	return *b.SHA
}
1292552
func (r *RepositoryLicense) GetSHA() string {
	if r == nil || r.SHA == nil {
		return ""
	}
	return *r.SHA
}
1058173
func (a *AuthServerStatic) ValidateHash(salt []byte, user string, authResponse []byte, remoteAddr net.Addr) (Getter, error) {
	a.mu.Lock()
	entries, ok := a.Entries[user]
	a.mu.Unlock()

	if !ok {
		return &StaticUserData{}, NewSQLError(ERAccessDeniedError, SSAccessDeniedError, "Access denied for user '%v'", user)
	}

	for _, entry := range entries {
		if entry.MysqlNativePassword != "" {
			isPass := isPassScrambleMysqlNativePassword(authResponse, salt, entry.MysqlNativePassword)
			if matchSourceHost(remoteAddr, entry.SourceHost) && isPass {
				return &StaticUserData{entry.UserData, entry.Groups}, nil
			}
		} else {
			computedAuthResponse := ScramblePassword(salt, []byte(entry.Password))
			// Validate the password.
			if matchSourceHost(remoteAddr, entry.SourceHost) && bytes.Equal(authResponse, computedAuthResponse) {
				return &StaticUserData{entry.UserData, entry.Groups}, nil
			}
		}
	}
	return &StaticUserData{}, NewSQLError(ERAccessDeniedError, SSAccessDeniedError, "Access denied for user '%v'", user)
}
1120903
func GetHash(namespace string) crypto.Hash {
	if strings.HasPrefix(namespace, "sha256-") {
		return crypto.SHA256
	}
	if strings.HasPrefix(namespace, "sha512-") {
		return crypto.SHA512
	}
	return crypto.SHA1
}
43045
func sha1Hash(slices [][]byte) []byte {
	hsha1 := sha1.New()
	for _, slice := range slices {
		hsha1.Write(slice)
	}
	return hsha1.Sum(nil)
}
291144
func GetHashOpt(hashFunction string) (HashOpts, error) {
	switch hashFunction {
	case SHA256:
		return &SHA256Opts{}, nil
	case SHA384:
		return &SHA384Opts{}, nil
	case SHA3_256:
		return &SHA3_256Opts{}, nil
	case SHA3_384:
		return &SHA3_384Opts{}, nil
	}
	return nil, fmt.Errorf("hash function not recognized [%s]", hashFunction)
}
1311139
func (c *CheckRun) GetHeadSHA() string {
	if c == nil || c.HeadSHA == nil {
		return ""
	}
	return *c.HeadSHA
}
1112998
func (p *PushEventCommit) GetSHA() string {
	if p == nil || p.SHA == nil {
		return ""
	}
	return *p.SHA
}
899684
func GetServiceHash(name string, config *ServiceConfig) string {
	hash := sha1.New()

	io.WriteString(hash, name)

	//Get values of Service through reflection
	val := reflect.ValueOf(config).Elem()

	//Create slice to sort the keys in Service Config, which allow constant hash ordering
	serviceKeys := []string{}

	//Create a data structure of map of values keyed by a string
	unsortedKeyValue := make(map[string]interface{})

	//Get all keys and values in Service Configuration
	for i := 0; i < val.NumField(); i++ {
		valueField := val.Field(i)
		keyField := val.Type().Field(i)

		serviceKeys = append(serviceKeys, keyField.Name)
		unsortedKeyValue[keyField.Name] = valueField.Interface()
	}

	//Sort serviceKeys alphabetically
	sort.Strings(serviceKeys)

	//Go through keys and write hash
	for _, serviceKey := range serviceKeys {
		serviceValue := unsortedKeyValue[serviceKey]

		io.WriteString(hash, fmt.Sprintf("\n  %v: ", serviceKey))

		switch s := serviceValue.(type) {
		case yaml.SliceorMap:
			sliceKeys := []string{}
			for lkey := range s {
				sliceKeys = append(sliceKeys, lkey)
			}
			sort.Strings(sliceKeys)

			for _, sliceKey := range sliceKeys {
				io.WriteString(hash, fmt.Sprintf("%s=%v, ", sliceKey, s[sliceKey]))
			}
		case yaml.MaporEqualSlice:
			for _, sliceKey := range s {
				io.WriteString(hash, fmt.Sprintf("%s, ", sliceKey))
			}
		case yaml.MaporColonSlice:
			for _, sliceKey := range s {
				io.WriteString(hash, fmt.Sprintf("%s, ", sliceKey))
			}
		case yaml.MaporSpaceSlice:
			for _, sliceKey := range s {
				io.WriteString(hash, fmt.Sprintf("%s, ", sliceKey))
			}
		case yaml.Command:
			for _, sliceKey := range s {
				io.WriteString(hash, fmt.Sprintf("%s, ", sliceKey))
			}
		case yaml.Stringorslice:
			sort.Strings(s)

			for _, sliceKey := range s {
				io.WriteString(hash, fmt.Sprintf("%s, ", sliceKey))
			}
		case []string:
			sliceKeys := s
			sort.Strings(sliceKeys)

			for _, sliceKey := range sliceKeys {
				io.WriteString(hash, fmt.Sprintf("%s, ", sliceKey))
			}
		case *yaml.Networks:
			io.WriteString(hash, fmt.Sprintf("%s, ", s.HashString()))
		case *yaml.Volumes:
			io.WriteString(hash, fmt.Sprintf("%s, ", s.HashString()))
		default:
			io.WriteString(hash, fmt.Sprintf("%v, ", serviceValue))
		}
	}

	return hex.EncodeToString(hash.Sum(nil))
}