Skip to content

Instantly share code, notes, and snippets.

@matiasinsaurralde
Created July 6, 2018 09:20
Show Gist options
  • Save matiasinsaurralde/b7bfc255f3e32cb29accc7328a7fd820 to your computer and use it in GitHub Desktop.
Save matiasinsaurralde/b7bfc255f3e32cb29accc7328a7fd820 to your computer and use it in GitHub Desktop.
b64 issue
package main
import (
"encoding/base64"
"fmt"
)
func main() {
payload := "eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ"
// This is what we're currently using for JSVM:
output, err := base64.StdEncoding.DecodeString(payload)
if err == nil {
fmt.Println("base64.StdEncoding returned", string(output))
} else {
fmt.Println("base64.StdEncoding failed :(")
}
output, err = base64.RawStdEncoding.DecodeString(payload)
if err == nil {
fmt.Println("base64.RawStdEncoding returned", string(output))
} else {
fmt.Println("base64.RawStdEncoding failed :(")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment