Golang, encrypting a string with AES and Base64

前端 未结 5 2042
青春惊慌失措
青春惊慌失措 2021-01-30 05:26

I\'m trying to encrypt some text inside a database to be loaded and decrypted during program startup.

I have tried a few methods, including a third party library https:/

5条回答
  •  没有蜡笔的小新
    2021-01-30 06:11

    Here is the working demo i just finished writing, it mostly uses code samples from the go document but it is tailored to do what most apps including my use case expects out of encryption methods.

    It use AES encryption. encrypt from string to base64 string. Easy to use on URL and dbs. decrypt from base64 string created above to original text.

    Simple text conversions everywhere.

    GIST: Here is the gist, please let me know if there are any need for the improvements.

    It's a simple go file, ready to be run.

提交回复
热议问题