https://github.com/rosbit/go-aes
encrypt/decrypt message with AES
https://github.com/rosbit/go-aes
Last synced: over 1 year ago
JSON representation
encrypt/decrypt message with AES
- Host: GitHub
- URL: https://github.com/rosbit/go-aes
- Owner: rosbit
- License: mit
- Created: 2019-04-30T08:37:17.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-06-22T01:53:27.000Z (about 3 years ago)
- Last Synced: 2025-01-16T00:24:45.853Z (over 1 year ago)
- Language: Go
- Size: 7.81 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-aes
encrypt/decrypt message with AES
## Usage
```go
package main
import (
"github.com/rosbit/go-aes"
"fmt"
)
func main() {
key := []byte("you key at least 16 bytes")
oriText := "message to be encrypted"
// encrypt
crypted, err := goaes.AesEncrypt([]byte(oriText), key)
if err != nil {
fmt.Printf("failed to crypt: %v\n", err)
return
}
// decrypt
decrypted, err := goaes.AesDecrypt(crypted, key)
if err != nil {
fmt.Printf("failed to decrypt: %v\n", err)
return
}
if oriText != string(decrypted) {
fmt.Printf("decrypted string is not same as oriText")
return
}
fmt.Printf("test aes ok\n")
}
```
## Status
The package is fully tested.
## Contribution
Pull requests are welcome! Also, if you want to discuss something send a pull request with proposal and changes.