Created
July 6, 2018 09:20
-
-
Save matiasinsaurralde/b7bfc255f3e32cb29accc7328a7fd820 to your computer and use it in GitHub Desktop.
b64 issue
This file contains hidden or 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() { | |
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