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
+32.4k Golang : Math pow(the power of x^y) example
+15.9k Golang : Get current time from the Internet time server(ntp) example
+11.8k Golang : GTK Input dialog box examples
+18.1k Golang : Convert IPv4 address to decimal number(base 10) or integer
+14.4k Golang : How to convert a number to words
+6.7k Golang : When to use make or new?
+6.1k Golang : Build new URL for named or registered route with Gorilla webtoolkit example
+10.1k Golang : Edge detection with Sobel method
+14.4k Golang : Recombine chunked files example
+5.2k Golang : The Tao of importing package
+7.1k Javascript : How to get JSON data from another website with JQuery or Ajax ?
+47.8k Golang : Convert int to byte array([]byte)