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
+10k CodeIgniter : Load different view for mobile devices
+7.4k Linux : How to fix Brother HL-1110 printing blank page problem
+10.8k Golang : Command line file upload program to server example
+15.9k Golang : Update database with GORM example
+11.2k Golang : Proper way to test CIDR membership of an IP 4 or 6 address example
+19.2k Golang : Execute shell command
+5.6k PHP : Convert CSV to JSON with YQL example
+19.9k Golang : Measure http.Get() execution time
+41k Golang : How to check if a string contains another sub-string?
+21.8k SSL : How to check if current certificate is sha1 or sha2
+30.4k Golang : How to verify uploaded file is image or allowed file types