code: func (h *HTTPBin) DigestAuth(w http.ResponseWriter, r *http.Request) {
  	parts := strings.Split(r.URL.Path, "/")
  	count := len(parts)
  
  	if count != 5 && count != 6 {
  		http.Error(w, "Not Found", http.StatusNotFound)
  		return
  	}
  
  	qop := strings.ToLower(parts[2])
  	user := parts[3]
  	password := parts[4]
  
  	algoName := "MD5"
  	if count == 6 {
  		algoName = strings.ToUpper(parts[5])
  	}
  
  	if qop != "auth" {
  		http.Error(w, "Invalid QOP directive", http.StatusBadRequest)
  		return
  	}
  	if algoName != "MD5" && algoName != "SHA-256" {
  		http.Error(w, "Invalid algorithm", http.StatusBadRequest)
  		return
  	}
  
  	algorithm := digest.MD5
  	if algoName == "SHA-256" {
  		algorithm = digest.SHA256
  	}
  
  	if !digest.Check(r, user, password) {
  		w.Header().Set("WWW-Authenticate", digest.Challenge("go-httpbin", algorithm))
  		w.WriteHeader(http.StatusUnauthorized)
  		return
  	}
  
  	resp, _ := json.Marshal(&authResponse{
  		Authorized: true,
  		User:       user,
  	})
  	writeJSON(w, resp, http.StatusOK)
  }
docs: // DigestAuth handles a simple implementation of HTTP Digest Authentication,
  // which supports the "auth" QOP and the MD5 and SHA-256 crypto algorithms.
  //
  // /digest-auth/<qop>/<user>/<passwd>
  // /digest-auth/<qop>/<user>/<passwd>/<algorithm>