Formatting

This commit is contained in:
Miek Gieben 2011-03-24 09:24:49 +01:00
parent f44bf2d656
commit 87845a9cb1
2 changed files with 14 additions and 14 deletions

6
msg.go
View File

@ -771,7 +771,7 @@ func unpackBase64(b []byte) string {
// Helper function for packing, mostly used in dnssec.go
func packUint16(i uint16) (byte, byte) {
return byte(i >> 8), byte(i)
return byte(i >> 8), byte(i)
}
func packBase64(s []byte) ([]byte, os.Error) {
@ -1026,8 +1026,8 @@ func (dns *Msg) String() string {
if len(dns.Question) > 0 {
s += "\n;; QUESTION SECTION:\n"
for i := 0; i < len(dns.Question); i++ {
// Need check if it exists? TODO(mg)
s += dns.Question[i].String() + "\n"
// Need check if it exists? TODO(mg)
s += dns.Question[i].String() + "\n"
}
}
if len(dns.Answer) > 0 {

View File

@ -31,27 +31,27 @@ func HashName(label string, ha int, iterations int, salt string) string {
switch ha {
case HashSHA1:
s = sha1.New()
default:
return ""
default:
return ""
}
// k = 0
name = append(name, wire...)
io.WriteString(s, string(name))
nsec3 := s.Sum()
// k > 0
for k := 0; k < iterations; k++ {
s.Reset()
nsec3 = append(nsec3, wire...)
io.WriteString(s, string(nsec3))
nsec3 = s.Sum()
}
// k > 0
for k := 0; k < iterations; k++ {
s.Reset()
nsec3 = append(nsec3, wire...)
io.WriteString(s, string(nsec3))
nsec3 = s.Sum()
}
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 = HashName(nsec3.Header().Name, int(nsec3.Hash), int(nsec3.Iterations), nsec3.Salt)
nsec3.NextDomain = HashName(nsec3.NextDomain, int(nsec3.Hash), int(nsec3.Iterations), nsec3.Salt)
nsec3.Header().Name = HashName(nsec3.Header().Name, int(nsec3.Hash), int(nsec3.Iterations), nsec3.Salt)
nsec3.NextDomain = HashName(nsec3.NextDomain, int(nsec3.Hash), int(nsec3.Iterations), nsec3.Salt)
}