Golang encoding/base64.Encoding.EncodedLen function examples
package encoding/base64
EncodedLen returns the length in bytes of the base64 encoding of an input buffer of length n.
Golang encoding/base64.Encoding.EncodedLen function usage examples
Example 1 :
digest := hash.Sum(nil)
mac := make([]byte, base64.URLEncoding.EncodedLen(len(digest)))
base64.URLEncoding.Encode(mac, digest)
Example 2 :
msg := []byte("abcd")
encoded := make([]byte, base64.StdEncoding.EncodedLen(len(msg)))
base64.StdEncoding.Encode(encoded, msg)
Reference :
Advertisement
Something interesting
Tutorials
+7.7k Gogland : Where to put source code files in package directory for rookie
+36.5k Golang : Save image to PNG, JPEG or GIF format.
+16.5k Golang : Execute terminal command to remote machine example
+8.2k Golang : Add build version and other information in executables
+9.4k Golang : Create unique title slugs example
+8.9k Golang : Sort lines of text example
+12.1k Golang : Pagination with go-paginator configuration example
+15k Golang : How do I get the local IP (non-loopback) address ?
+29.7k Golang : Record voice(audio) from microphone to .WAV file
+14.8k Golang : Adding XML attributes to xml data or use attribute to differentiate a common tag name
+22.6k Generate checksum for a file in Go