Golang encoding/base64.Encoding.Encode function example
package encoding/base64
Encode encodes src(2nd parameter) using the encoding enc, writing EncodedLen(len(src)) bytes to dst(1st parameter) The encoding pads the output to a multiple of 4 bytes, so Encode is not appropriate for use on individual blocks of a large data stream. Use NewEncoder() instead.
Golang encoding/base64.Encoding.Encode function usage example
digest := hash.Sum(nil)
mac := make([]byte, base64.URLEncoding.EncodedLen(len(digest)))
base64.URLEncoding.Encode(mac, digest)
Reference :
Advertisement
Something interesting
Tutorials
+8.7k Golang : How to check if input string is a word?
+36.4k Golang : Get file last modified date and time
+10.2k Golang : Function wrapper that takes arguments and return result example
+18.9k Golang : Send email with attachment
+7.9k Golang : get the current working directory of a running program
+22.1k SSL : How to check if current certificate is sha1 or sha2
+35.6k Golang : Strip slashes from string example
+9.7k Golang : How to get username from email address
+12.6k Golang : Get remaining text such as id or filename after last segment in URL path
+23.7k Golang : Check if element exist in map
+9.9k Golang : How to generate Code 39 barcode?
+8.2k Golang : How to feed or take banana with Gorilla Web Toolkit Session package