All Go Rust Python PHP JavaScript
Chrome Dev Summit to secure your spot in workshops, office hours and learning lounges!

How to Encrypt and Decrypt a String Using AES CBC in Go

In Golang, using the crypto/aes package is the easiest way to encrypt a string using AES CBC. Ehrsam, Meyer, Smith and Tuchman invented the cipher block chaining (CBC) mode of operation in 1976. In CBC mode, each block of plaintext is XORed with the ...
Tomoki

How to Encrypt and Decrypt a String Using AES GCM 256 in Go

In Golang, using the crypto/aes package is the easiest way to encrypt a string using AES GCM 256. In cryptography, Galois/Counter Mode (GCM) is a mode of operation for symmetric-key cryptographic block ciphers which is widely adopted for its performa...
Tomoki

How to Get a SHA256 Hash from a String in Go

In Golang, using the Sum256 function is the easiest way to get a SHA256 hash from a string.Go implements several hash functions in various crypto/* packages. Using Sum256 Function The sha256.Sum256() function returns the SHA256 checksum of the data...
ada

How to Get a MD5 Hash from a String in Go

In Golang, using the Sum function is the easiest way to get a MD5 hash from a string. Using Sum Function The md5.Sum() function returns the MD5 checksum of the data. The following example should cover whatever you are trying to do: package mai...
aweis

How to Copy a File in Go

In Golang, there are 2 ways to copy a file. Using io.Copy Function You can copy a file using the io.Copy() function. For example, package main import ( "io" "os" ) // Copy the src file to dst. func Copy(src, dst string) error { in, err...
Unused

How to Download a Large File in Go

In Golang, using the io.copy function is the easiest way to download a large file Using io.Copy Function The io.Copy() function copies from src to dst until either EOF is reached on src or an error occurs. It returns the number of bytes copied and ...
ada

How to Generate a UUID in Go

In Golang, there are 4 ways to generate a uuid. Using uuid Package install Use the following command to download the repository to the local file system. install go mod tidy go get github.com/google/uuid go install github.com...
Sambhav Khandelwal

How to Read a Whole File into a String Variable in Go

In Golang, there are 3 ways to read a whole file into a string variable. Using ioutil.ReadFile Function ReadFile reads the file named by filename and returns the contents. A successful call returns err == nil, not err == EOF. Because ReadFile reads...
aweis

How to format a date or time in Go

In Golang, there are two ways to format the time.The layout string Go doesn’t use yyyy-mm-dd layout to format a time. Instead, you format a special layout parameter. 2006-01-02 15:04:05.999999999 -0700 MST package main import ( "fmt" "tim...
aweis

How to use hash function in Python

Secure hashes and message digests.Hash algorithms The hashlib module implements a common interface to many different secure hash and message digest algorithms. Included are the FIPS secure hash algorithms SHA1, SHA224, SHA256, SHA384, and SHA512 (def...
Unused

How to use of hash functions in PHP

How Hashing Function Works and its Syntax. MD5 Function The md5() calculates the md5 hash of a string. Returns the hash as a 32-character hexadecimal number. $str = "Google"; // 8b36e9207c24c76e6719268e49201d94 echo md5($str); // bool(true) md...
Tomoki

How to use the telnet command in Linux

user interface to the TELNET protocol. Telnet is an application protocol used on the Internet or local area network to provide a bidirectional interactive text-oriented communication facility using a virtual terminal connection. User data is interspe...

How to use the df command in Linux

Show information about the file system on which each FILE resides, or all file systems by default. df (abbreviation for disk free) is a standard Unix command used to display the amount of available disk space for file systems on which the invoking us...

How to use the curl command in Linux

command line tool and library for transferring data with URLs. cURL (pronounced 'curl') is a computer software project providing a library (libcurl) and command-line tool (curl) for transferring data using various network protocols. The name ...

How to use the go build command line

compile packages and dependencies. Build compiles the packages named by the import paths, along with their dependencies, but it does not install the results. Build go build go build hello.go ls -lh 1.9M Jun 29 17:38 hello ...