gobyexample/base64/base64.go
2024-05-03 00:09:42 +05:30

23 lines
397 B
Go

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)
}