Add base64

This commit is contained in:
Sangeeth Sudheer 2024-05-03 00:09:42 +05:30
parent 8d8b00ba83
commit 89d977af8f
Signed by: x
GPG Key ID: F6D06ECE734C57D1
2 changed files with 26 additions and 2 deletions

22
base64/base64.go Normal file
View File

@ -0,0 +1,22 @@
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)
}

View File

@ -32,7 +32,8 @@ package main
// import "git.sangeeth.dev/gobyexample/rand" // import "git.sangeeth.dev/gobyexample/rand"
// import "git.sangeeth.dev/gobyexample/numberparsing" // import "git.sangeeth.dev/gobyexample/numberparsing"
// import "git.sangeeth.dev/gobyexample/url" // import "git.sangeeth.dev/gobyexample/url"
import "git.sangeeth.dev/gobyexample/sha" // import "git.sangeeth.dev/gobyexample/sha"
import "git.sangeeth.dev/gobyexample/base64"
func main() { func main() {
// runes.Runes() // runes.Runes()
@ -67,5 +68,6 @@ func main() {
// rand.Rand() // rand.Rand()
// numberparsing.NumberParsing() // numberparsing.NumberParsing()
// url.Url() // url.Url()
sha.Sha() // sha.Sha()
base64.Base64()
} }