Standard library / encoding/base32
encoding/base32.Encoding.Encode()
Encode the complete input into a preallocated destination of EncodedLen bytes. Do not encode arbitrary stream chunks independently with padding. Expected stdout: 'I5XQ====\n'.
Formal Syntax & Structure
go syntaxgo
func (enc *Encoding) Encode(dst, src []byte)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| dst | []byte | Destination byte slice; provide enough capacity for the operation or use an append API. |
| src | []byte | Input bytes in the format expected by the operation. |
Working Example
Example Snippetgo
package main
import ( "encoding/base32" "fmt")
func must(e error) { if e != nil { panic(e) }}
func main() { e := base32.StdEncoding src := []byte("Go") dst := make([]byte, e.EncodedLen(len(src))) e.Encode(dst, src) fmt.Println(string(dst))}