gobyexample/base64/base64.go

23 lines
397 B
Go
Raw Normal View History

2024-05-02 18:39:42 +00:00
package base64
import (
"encoding/base64"
"fmt"
)
func Base64() {
target := "abc123!?$*&()'-=@~"
out := base64.StdEncoding.EncodeToString([]byte(target))
fmt.Println(target)
fmt.Println(out)
decoded, _ := base64.StdEncoding.DecodeString(out)
fmt.Println(string(decoded))
fmt.Println()
out = base64.URLEncoding.EncodeToString([]byte(target))
fmt.Println(target)
fmt.Println(out)
}