From 003c8fd803ee304ab4f0b1cbb90d800399d9ea2b Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Wed, 9 Mar 2011 18:54:55 +0100 Subject: [PATCH] add nsec3 hashnames method --- nsec3.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nsec3.go b/nsec3.go index 1329463a..8880629a 100644 --- a/nsec3.go +++ b/nsec3.go @@ -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) +}