Function
EncodeData
(data []byte, encoding string)
Source from the content-addressed store, hash-verified
| 14 | } |
| 15 | |
| 16 | func EncodeData(data []byte, encoding string) []byte { |
| 17 | enc := encoder{ |
| 18 | input: data, |
| 19 | } |
| 20 | |
| 21 | switch encoding { |
| 22 | case cli.OptEncodingBase32: |
| 23 | enc.base32() |
| 24 | case cli.OptEncodingBase64: |
| 25 | enc.base64() |
| 26 | case cli.OptEncodingIPv4: |
| 27 | enc.ipv4() |
| 28 | case cli.OptEncodingMAC: |
| 29 | enc.mac() |
| 30 | default: |
| 31 | log.Fatal("Unknown encoding") |
| 32 | } |
| 33 | |
| 34 | return enc.output |
| 35 | } |
| 36 | |
| 37 | func (e *encoder) base32() { |
| 38 | /* |
Tested by
no test coverage detected