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
+5.1k Linux : How to set root password in Linux Mint
+11.3k Golang : Byte format example
+27.7k PHP : Count number of JSON items/objects
+13.2k Golang : How to calculate the distance between two coordinates using Haversine formula
+10.7k Golang : Underscore string example
+10.3k Golang : Embed secret text string into binary(executable) file
+9.3k Golang : Temperatures conversion example
+7.6k Golang : Convert(cast) io.Reader type to string
+10.6k Golang : Flip coin example
+17k Golang : Get number of CPU cores
+5.9k Golang : Shuffle array of list
+5.4k Gogland : Datasource explorer