Gocrypt golang library for encryption / decryption with a tag field

During the last decades, data security has become a major issue. Encryption and decryption data have recently been widely investigated and developed because there is a demand for stronger encryption and decryption which very hard to crack. Golang as a popular programming language today, really supports encryption and decryption such as AES, DES, and RC4.

By doing encryption/decryption data in Golang, we very often apply it in many fields in a structure type. Doing these things one by one is very tiring. Come on!! Let’s analyze!

For example, there is JSON data with plain text. The objective is how to encrypt the phone number, ID and license number.

The expected must be done like below

Using Golang struct field to an identifier which fields need to be encrypted and what algorithm that used.


Structure JSON using tag field gocrypt

Using Gocrypt library will be implemented like this:

Sample Encryption & Decryption using gocrypt


Using Gocrypt easy to maintenance which field needs to be encryption/decryption. There is 3 algorithm supported by gocrypt.

The DES ciphers are primarily supported for PBE standard that provides the option of generating an encryption key based on a passphrase.

The AES cipher is the current U.S. government standard for all software and is recognized worldwide.

The RC4 is supplied for situations that call for fast encryption, but not strong encryption. RC4 is ideal for situations that require a minimum of encryption.

If you interested in these projects. Feel free to use it.




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store