Standard library / encoding/base32

encoding/base32.Encoding.EncodedLen()

Return the exact encoded byte count for an input length and the selected padding configuration. Expected stdout: '8 4\n'.

Formal Syntax & Structure

go syntaxgo
func (enc *Encoding) EncodedLen(n int) int

Parameters & Attributes

NameTypeDescription
nintNumber of input bytes.

Return Value

int

Byte count or length bound, as specified by the operation.

Working Example

Example Snippetgo
package main
import (  "encoding/base32"  "fmt")
func must(e error) {  if e != nil {    panic(e)  }}
func main() {  fmt.Println(base32.StdEncoding.EncodedLen(2), base32.StdEncoding.WithPadding(base32.NoPadding).EncodedLen(2))}
Go Reference