Golang
Golang Code Snippet
Hash Email and Phone Number
Dependency:
crypto/sha256
: This package provides the SHA-256 hash function.encoding/hex
: This package is used to encode the hashed byte array to a hexadecimal string.
Encrypt Signed body
Dependency:
crypto/aes
:This package provides the Advanced Encryption Standard (AES) symmetric encryption algorithm. AES is widely used for encrypting and decrypting data securely. It supports various key sizes (AES-128, AES-192, AES-256).
crypto/cipher
:The
cipher
package provides interfaces for symmetric key block ciphers such as AES. It defines common operations and types used in cryptographic implementations, including encryption modes (like CBC, GCM) and padding schemes.
encoding/base64
:The
base64
package provides functions for encoding and decoding data using Base64 encoding. Base64 encoding converts binary data into a text-like format, which is useful for transmitting binary data over text-based protocols or storing binary data as text.
encoding/hex
:The
hex
package provides functions for encoding and decoding hexadecimal strings. It allows converting binary data into a hexadecimal representation and vice versa. Hexadecimal encoding is often used to display binary data in a human-readable format.
encoding/json
:The
json
package provides encoding and decoding functions for JSON data. It allows converting Go data structures (like structs, maps, slices) into JSON format and vice versa. JSON (JavaScript Object Notation) is a popular data interchange format used in web applications and APIs.
Last updated