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
+11.7k Golang : Secure file deletion with wipe example
+5.9k Golang : Extract unicode string from another unicode string example
+16k Golang : Generate universally unique identifier(UUID) example
+8.8k Golang : HTTP Routing with Goji example
+8.3k Golang : Configure Apache and NGINX to access your Go service example
+40.1k Golang : UDP client server read write example
+9.3k Golang : Temperatures conversion example
+10k Golang : Convert octal value to string to deal with leading zero problem
+11.9k Golang : Setup API server or gateway with Caddy and http.ListenAndServe() function example
+8.3k Golang : Number guessing game with user input verification example
+28k Golang : Move file to another directory
+7.1k Golang : Transform lisp or spinal case to Pascal case example