"bytes"
"crypto/sha256"
"encoding/hex"
- "errors"
"flag"
"fmt"
"io"
http.ServeFile(w, r, path)
}
-func strToAuther(verifier string) (string, Auther, error) {
- st := strings.SplitN(verifier, "$", 3)
- if len(st) != 3 || st[0] != "" {
- return "", nil, errors.New("invalid verifier structure")
- }
- algorithm := st[1]
- var auther Auther
- var err error
- switch algorithm {
- case "argon2i":
- auther, err = parseArgon2i(st[2])
- case "sha256":
- auther, err = parseSHA256(st[2])
- default:
- err = errors.New("unknown hashing algorithm")
- }
- return algorithm, auther, err
-}
-
func serveUpload(w http.ResponseWriter, r *http.Request) {
username, password, ok := r.BasicAuth()
if !ok {