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
+9.4k Golang : Scramble and unscramble text message by randomly replacing words
+19.2k Golang : Delete item from slice based on index/key position
+5.8k Unix/Linux : How to test user agents blocked successfully ?
+19.2k Golang : Execute shell command
+33.6k Golang : How to check if slice or array is empty?
+9k Golang : How to use Gorilla webtoolkit context package properly
+5.8k CodeIgniter/PHP : Remove empty lines above RSS or ATOM xml tag
+20.6k Golang : Secure(TLS) connection between server and client
+11.6k SSL : The certificate is not trusted because no issuer chain was provided
+11.1k Golang : Fix go.exe is not compatible with the version of Windows you're running
+9.7k Golang : Detect number of active displays and the display's resolution
+9.8k Golang : Get current, epoch time and display by year, month and day