mirror of
https://github.com/aler9/gortsplib
synced 2025-10-06 07:37:07 +08:00
support hashed credentials
This commit is contained in:
@@ -2,6 +2,8 @@ package auth
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"crypto/sha256"
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
@@ -10,3 +12,9 @@ func md5Hex(in string) string {
|
||||
h.Write([]byte(in))
|
||||
return hex.EncodeToString(h.Sum(nil))
|
||||
}
|
||||
|
||||
func sha256Base64(in string) string {
|
||||
h := sha256.New()
|
||||
h.Write([]byte(in))
|
||||
return base64.StdEncoding.EncodeToString(h.Sum(nil))
|
||||
}
|
||||
|
Reference in New Issue
Block a user