@@ -15,7 +15,7 @@ const hextable = "0123456789abcdef"
1515
1616// EncodedLen returns the length of an encoding of n source bytes.
1717// Specifically, it returns n * 2.
18- func EncodedLen (n int )int {return n * 2 }
18+ func EncodedLen (n int )int {return n * 2 }
1919
2020// Encode encodes src into EncodedLen(len(src))
2121// bytes of dst. As a convenience, it returns the number
@@ -44,7 +44,7 @@ func (e InvalidByteError) Error() string {
4444
4545// DecodedLen returns the length of a decoding of x source bytes.
4646// Specifically, it returns x / 2.
47- func DecodedLen (x int )int {return x / 2 }
47+ func DecodedLen (x int )int {return x / 2 }
4848
4949// Decode decodes src into DecodedLen(len(src)) bytes,
5050// returning the actual number of bytes written to dst.
@@ -126,9 +126,9 @@ func Dump(data []byte) string {
126126const bufferSize = 1024
127127
128128type encoder struct {
129- w io.Writer
130- err error
131- out [bufferSize ]byte // output buffer
129+ w io.Writer
130+ err error
131+ out [bufferSize ]byte // output buffer
132132}
133133
134134// NewEncoder returns an io.Writer that writes lowercase hexadecimal characters to w.
@@ -153,10 +153,10 @@ func (e *encoder) Write(p []byte) (n int, err error) {
153153}
154154
155155type decoder struct {
156- r io.Reader
157- err error
158- in []byte // input buffer (encoded form)
159- arr [bufferSize ]byte // backing array for in
156+ r io.Reader
157+ err error
158+ in []byte // input buffer (encoded form)
159+ arr [bufferSize ]byte // backing array for in
160160}
161161
162162// NewDecoder returns an io.Reader that decodes hexadecimal characters from r.
@@ -169,7 +169,7 @@ func (d *decoder) Read(p []byte) (n int, err error) {
169169// Fill internal buffer with sufficient bytes to decode
170170if len (d .in )< 2 && d .err == nil {
171171var numCopy ,numRead int
172- numCopy = copy (d .arr [:],d .in )// Copies either 0 or 1 bytes
172+ numCopy = copy (d .arr [:],d .in )// Copies either 0 or 1 bytes
173173numRead ,d .err = d .r .Read (d .arr [numCopy :])
174174d .in = d .arr [:numCopy + numRead ]
175175if d .err == io .EOF && len (d .in )% 2 != 0 {
@@ -188,11 +188,11 @@ func (d *decoder) Read(p []byte) (n int, err error) {
188188numDec ,err := Decode (p ,d .in [:len (p )* 2 ])
189189d .in = d .in [2 * numDec :]
190190if err != nil {
191- d .in ,d .err = nil ,err // Decode error; discard input remainder
191+ d .in ,d .err = nil ,err // Decode error; discard input remainder
192192}
193193
194194if len (d .in )< 2 {
195- return numDec ,d .err // Only expose errors when buffer fully consumed
195+ return numDec ,d .err // Only expose errors when buffer fully consumed
196196}
197197return numDec ,nil
198198}
@@ -205,12 +205,12 @@ func Dumper(w io.Writer) io.WriteCloser {
205205}
206206
207207type dumper struct {
208- w io.Writer
209- rightChars [18 ]byte
210- buf [14 ]byte
211- used int // number of bytes in the current line
212- n uint // number of bytes, total
213- closed bool
208+ w io.Writer
209+ rightChars [18 ]byte
210+ buf [14 ]byte
211+ used int // number of bytes in the current line
212+ n uint // number of bytes, total
213+ closed bool
214214}
215215
216216func toChar (b byte )byte {