library: encoding/hex
This commit is contained in:
@@ -292,6 +292,7 @@ Here are the Go packages that can be imported correctly:
|
|||||||
* [reflect](https://pkg.go.dev/reflect) (partially)
|
* [reflect](https://pkg.go.dev/reflect) (partially)
|
||||||
* [time](https://pkg.go.dev/time) (partially)
|
* [time](https://pkg.go.dev/time) (partially)
|
||||||
* [encoding/binary](https://pkg.go.dev/encoding/binary)
|
* [encoding/binary](https://pkg.go.dev/encoding/binary)
|
||||||
|
* [encoding/hex](https://pkg.go.dev/encoding/hex)
|
||||||
* [encoding/base32](https://pkg.go.dev/encoding/base32)
|
* [encoding/base32](https://pkg.go.dev/encoding/base32)
|
||||||
* [encoding/base64](https://pkg.go.dev/encoding/base64)
|
* [encoding/base64](https://pkg.go.dev/encoding/base64)
|
||||||
* [regexp](https://pkg.go.dev/regexp)
|
* [regexp](https://pkg.go.dev/regexp)
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ package main
|
|||||||
import (
|
import (
|
||||||
"encoding/base32"
|
"encoding/base32"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func base64Demo() {
|
func base64Demo() {
|
||||||
@@ -30,7 +32,17 @@ func base32Demo() {
|
|||||||
fmt.Printf("%q\n", dst)
|
fmt.Printf("%q\n", dst)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func hexDemo() {
|
||||||
|
const s = "48656c6c6f20476f7068657221"
|
||||||
|
decoded, err := hex.DecodeString(s)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
fmt.Printf("%s\n", decoded)
|
||||||
|
|
||||||
|
}
|
||||||
func main() {
|
func main() {
|
||||||
base64Demo()
|
base64Demo()
|
||||||
base32Demo()
|
base32Demo()
|
||||||
|
hexDemo()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user