mirror of
https://github.com/miekg/dns.git
synced 2025-11-04 20:51:02 +01:00
Reduce wireSalt allocation in HashName
This commit is contained in:
parent
2f8cf50b32
commit
c2889aea81
3
nsecx.go
3
nsecx.go
@ -2,13 +2,14 @@ package dns
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/sha1"
|
"crypto/sha1"
|
||||||
|
"encoding/hex"
|
||||||
"hash"
|
"hash"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HashName hashes a string (label) according to RFC 5155. It returns the hashed string in uppercase.
|
// HashName hashes a string (label) according to RFC 5155. It returns the hashed string in uppercase.
|
||||||
func HashName(label string, ha uint8, iter uint16, salt string) string {
|
func HashName(label string, ha uint8, iter uint16, salt string) string {
|
||||||
wireSalt := make([]byte, DefaultMsgSize)
|
wireSalt := make([]byte, hex.DecodedLen(len(salt)))
|
||||||
n, err := packStringHex(salt, wireSalt, 0)
|
n, err := packStringHex(salt, wireSalt, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ""
|
return ""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user