https://github.com/xyproto/sharedsecret
:skateboard: Have a shared secret. Encrypt and decrypt messages. Uses AES from the Go standard library.
https://github.com/xyproto/sharedsecret
aes decryption encryption go
Last synced: 7 months ago
JSON representation
:skateboard: Have a shared secret. Encrypt and decrypt messages. Uses AES from the Go standard library.
- Host: GitHub
- URL: https://github.com/xyproto/sharedsecret
- Owner: xyproto
- License: mit
- Created: 2020-12-02T19:39:13.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2020-12-02T20:25:47.000Z (almost 5 years ago)
- Last Synced: 2025-02-02T01:46:27.508Z (8 months ago)
- Topics: aes, decryption, encryption, go
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sharedsecret [](https://travis-ci.com/xyproto/sharedsecret) [](http://godoc.org/github.com/xyproto/sharedsecret) [](https://goreportcard.com/report/github.com/xyproto/sharedsecret)
Have a shared secret. Encrypt and decrypt messages. Uses AES from the Go standard library.
## Example
```go
package mainimport (
"fmt"
"log""github.com/xyproto/ask"
"github.com/xyproto/sharedsecret"
)func main() {
const password = "hunter1"
message := ask.Ask("Type in a short message: ")
encryptedMessage, err := sharedsecret.Encrypt(message, password)
if err != nil {
log.Fatalln(err)
}
fmt.Printf("The encrypted message is: % x\n", encryptedMessage)
decryptedMessage, err := sharedsecret.Decrypt(encryptedMessage, password)
if err != nil {
log.Fatalln(err)
}
fmt.Printf("The decrypted message is: %s\n", decryptedMessage)
}
```Interaction with the example program, where the message that is encrypted and then decrypted is `hi`.
```
Type in a short message: hi
The encrypted message is: bf 18 25 16 d8 c1 de f0 70 4e 02 bd ec 20 6c 8b d6 8c f3 00 65 b5 fd d9 d6 06 f1 f9 ac 26
The decrypted message is: hi
```## General info
* Version: 1.0.0
* License: MIT
* Author: Alexander F. Rødseth <xyproto@archlinux.org>