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
+21.2k Golang : How to get time zone and load different time zone?
+12.3k Golang : Get month name from date example
+21.1k Golang : Get password from console input without echo or masked
+10.9k Golang : Sieve of Eratosthenes algorithm
+9.7k Golang : List available AWS regions
+14.4k Golang : Find network of an IP address
+16.8k Golang : Get own process identifier
+18.7k Golang : convert int to string
+8.7k Golang : Find duplicate files with filepath.Walk
+5.6k PHP : Fix Call to undefined function curl_init() error
+7.7k Golang : get the current working directory of a running program
+17.9k Golang : How to make a file read only and set it to writable again?