add nsec3 hashnames method

This commit is contained in:
Miek Gieben 2011-03-09 18:54:55 +01:00
parent e628d15902
commit 003c8fd803
1 changed files with 8 additions and 1 deletions

View File

@ -12,7 +12,7 @@ type saltWireFmt struct {
}
// Hash a string/label according to RFC5155
func Nsec3Hash(label string, ha int, iterations int, salt string) string {
func HashNames(label string, ha int, iterations int, salt string) string {
saltwire := new(saltWireFmt)
saltwire.Salt = salt
wire := make([]byte, DefaultMsgSize)
@ -48,3 +48,10 @@ func Nsec3Hash(label string, ha int, iterations int, salt string) string {
}
return unpackBase32(nsec3)
}
// Hash the ownername and the next owner name in
// an NSEC3 record, use the parameters from the NSEC3 itself.
func (nsec3 *RR_NSEC3) HashNames() {
nsec3.Header().Name = HashNames(nsec3.Header().Name, int(nsec3.Hash), int(nsec3.Iterations), nsec3.Salt)
nsec3.NextDomain = HashNames(nsec3.NextDomain, int(nsec3.Hash), int(nsec3.Iterations), nsec3.Salt)
}