23 lines
397 B
Go
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)
|
|
}
|