Skip to content

proposal: encoding/hex: add an encoder and decoder #21590

@Hamcha

Description

@Hamcha

Introduction

I use Go for writing net applications so I often find myself using readers and writers to sockets to un/serialize data. While most of the packages inside encoding do support that via Encoders/Decoders (base64, csv, json, xml..) I was pretty surprised to find that the encoding/hex package doesn't. (Except for hex.Dumper which isn't a viable alternative).

Proposal

My proposal is to add structs hex.Decoder and hex.Encoder (which respectively implement io.Reader and io.Writer) to make the encoding/hex package more consistent with the rest of its siblings.

I don't think it would be hard to implement (it could be a nice way for me to contribute something back, but I'm fine if someone else wants to do it) and I understand that it's not anything vital or required (you can definitely achieve it right now with an external package like this one) but I still think it would be a nice thing to have.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions