Home / Function/ makeHashAuthFunc() — fiber Function Reference

makeHashAuthFunc() — fiber Function Reference

Architecture documentation for the makeHashAuthFunc() function in cache.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  1cbe65a5_d3fb_f901_591e_d885d0a87b2b["makeHashAuthFunc()"]
  af95e058_7e86_ec88_42f0_cd294e342508["cache.go"]
  1cbe65a5_d3fb_f901_591e_d885d0a87b2b -->|defined in| af95e058_7e86_ec88_42f0_cd294e342508
  96447356_67b9_a364_148e_b703c487e1ba["New()"]
  96447356_67b9_a364_148e_b703c487e1ba -->|calls| 1cbe65a5_d3fb_f901_591e_d885d0a87b2b
  style 1cbe65a5_d3fb_f901_591e_d885d0a87b2b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

middleware/cache/cache.go lines 1357–1382

func makeHashAuthFunc(hexBufPool *sync.Pool) func([]byte) string {
	return func(authHeader []byte) string {
		sum := sha256.Sum256(authHeader)

		v := hexBufPool.Get()
		bufPtr, ok := v.(*[]byte)
		if !ok || bufPtr == nil {
			b := make([]byte, hexLen)
			bufPtr = &b
		}

		buf := *bufPtr
		if cap(buf) < hexLen {
			buf = make([]byte, hexLen)
		} else {
			buf = buf[:hexLen]
		}
		*bufPtr = buf

		hex.Encode(buf, sum[:])
		result := string(buf)

		hexBufPool.Put(bufPtr)
		return result
	}
}

Subdomains

Called By

Frequently Asked Questions

What does makeHashAuthFunc() do?
makeHashAuthFunc() is a function in the fiber codebase, defined in middleware/cache/cache.go.
Where is makeHashAuthFunc() defined?
makeHashAuthFunc() is defined in middleware/cache/cache.go at line 1357.
What calls makeHashAuthFunc()?
makeHashAuthFunc() is called by 1 function(s): New.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free