Add base64
This commit is contained in:
parent
8d8b00ba83
commit
89d977af8f
22
base64/base64.go
Normal file
22
base64/base64.go
Normal 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)
|
||||||
|
}
|
6
main.go
6
main.go
@ -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()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user