MCPcopy Create free account
hub / github.com/SenseUnit/dumbproxy / formatSerial

Function formatSerial

auth/cert.go:181–193  ·  view source on GitHub ↗

formatSerial from https://codereview.stackexchange.com/a/165708

(serial *big.Int)

Source from the content-addressed store, hash-verified

179
180// formatSerial from https://codereview.stackexchange.com/a/165708
181func formatSerial(serial *big.Int) string {
182 b := serial.Bytes()
183 buf := make([]byte, 0, 3*len(b))
184 x := buf[1*len(b) : 3*len(b)]
185 hex.Encode(x, b)
186 for i := 0; i < len(x); i += 2 {
187 buf = append(buf, x[i], x[i+1], ':')
188 }
189 if serial.Sign() == -1 {
190 return "(Negative)" + string(buf[:len(buf)-1])
191 }
192 return string(buf[:len(buf)-1])
193}
194
195type serialNumberKey = us.Handle[[]byte, byte]
196type serialNumberSet struct {

Callers 1

ValidateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected