Skip to content

Commit

Permalink
Base64 decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
joohoi committed Jun 25, 2020
1 parent 4616ab6 commit 808a934
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkg/pencode/base64decode.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package pencode

import (
"encoding/base64"
)

type Base64Decoder struct{}

func (b Base64Decoder) Encode(input []byte) ([]byte, error) {
output, err := base64.StdEncoding.DecodeString(string(input))
return output, err
}

func (b Base64Decoder) HelpText() string {
return "Base64 decoder"
}
1 change: 1 addition & 0 deletions pkg/pencode/encoders.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

var availableEncoders = map[string]Encoder{
"b64encode": Base64Encoder{},
"b64decode": Base64Decoder{},
}

type Chain struct {
Expand Down

0 comments on commit 808a934

Please sign in to comment.