Created
October 7, 2018 12:37
-
-
Save donvito/5eaad0a785d80290916ace016c99b557 to your computer and use it in GitHub Desktop.
base64 encoder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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