diff --git a/modhex.go b/modhex.go index 74e15e6..198ceba 100644 --- a/modhex.go +++ b/modhex.go @@ -30,23 +30,23 @@ func EncodedLen(n int) int { // EncodedLen(len(src)). func Encode(dst, src []byte) int { // keep track of the number of bytes written to dst - len := 0 + n := 0 // convert each byte of src and store in dst for _, v := range src { // convert the upper nibble to modhex // and store it into dst - dst[len] = modhexTable[v>>4] - len++ + dst[n] = modhexTable[v>>4] + n++ // convert the lower nibble to modhex // and store it into dst - dst[len] = modhexTable[v&0x0f] - len++ + dst[n] = modhexTable[v&0x0f] + n++ } // return the number of bytes written - return len + return n } // EncodeToString returns the modhex encoding of src as a string.