Skip to content

Instantly share code, notes, and snippets.

@donvito
Created October 7, 2018 12:37
Show Gist options
  • Save donvito/5eaad0a785d80290916ace016c99b557 to your computer and use it in GitHub Desktop.
Save donvito/5eaad0a785d80290916ace016c99b557 to your computer and use it in GitHub Desktop.
base64 encoder
package main
import (
"encoding/base64"
"fmt"
)
func main() {
msg := "melvin:melvin"
encoded := base64.StdEncoding.EncodeToString([]byte(msg))
fmt.Println(encoded)
decoded, err := base64.StdEncoding.DecodeString(encoded)
if err != nil {
fmt.Println("decode error:", err)
return
}
fmt.Println(string(decoded))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment