From b4b364df5f5e656617dcff51a85222d04d361d05 Mon Sep 17 00:00:00 2001 From: Diogo Monica Date: Thu, 23 Jul 2015 03:45:05 -0700 Subject: [PATCH] Removing unused hex_bytes.go Signed-off-by: Diogo Monica --- signer/keys/hex_bytes.go | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 signer/keys/hex_bytes.go diff --git a/signer/keys/hex_bytes.go b/signer/keys/hex_bytes.go deleted file mode 100644 index 00ec6086f8..0000000000 --- a/signer/keys/hex_bytes.go +++ /dev/null @@ -1,36 +0,0 @@ -package keys - -import ( - "encoding/hex" - "errors" -) - -// HexBytes represents hexadecimal bytes -type HexBytes []byte - -// UnmarshalJSON allows the representation in JSON of hexbytes -func (b *HexBytes) UnmarshalJSON(data []byte) error { - if len(data) < 2 || len(data)%2 != 0 || data[0] != '"' || data[len(data)-1] != '"' { - return errors.New("tuf: invalid JSON hex bytes") - } - res := make([]byte, hex.DecodedLen(len(data)-2)) - _, err := hex.Decode(res, data[1:len(data)-1]) - if err != nil { - return err - } - *b = res - return nil -} - -// MarshalJSON allows the representation in JSON of hexbytes -func (b HexBytes) MarshalJSON() ([]byte, error) { - res := make([]byte, hex.EncodedLen(len(b))+2) - res[0] = '"' - res[len(res)-1] = '"' - hex.Encode(res[1:], b) - return res, nil -} - -func (b HexBytes) String() string { - return hex.EncodeToString(b) -}