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
+13.6k Golang : Query string with space symbol %20 in between
+30.5k Golang : Generate random string
+7.9k Golang : Trim everything onward after a word
+5.5k Clean up Visual Studio For Mac installation failed disk full problem
+11k Golang : Generate random elements without repetition or duplicate
+8.1k Golang : Get all countries phone codes
+10.1k Golang : Edge detection with Sobel method
+7.4k Golang : Hue, Saturation and Value(HSV) with OpenCV example
+6k Golang : Experimenting with the Rejang script
+6.1k Golang : Dealing with backquote
+7.5k Golang : Detect sample rate, channels or latency with PortAudio
+23.1k Golang : Randomly pick an item from a slice/array example