Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/umayr/crypto
A proof of concept to replace golang's standard crypto with openssl wrapped library.
https://github.com/umayr/crypto
Last synced: 9 days ago
JSON representation
A proof of concept to replace golang's standard crypto with openssl wrapped library.
- Host: GitHub
- URL: https://github.com/umayr/crypto
- Owner: umayr
- Created: 2016-11-23T15:27:59.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-11-24T09:25:47.000Z (about 8 years ago)
- Last Synced: 2024-11-07T03:48:25.616Z (about 2 months ago)
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
A proof of concept to replace golang's standard crypto with openssl wrapped library.
### Usage
Consider the following snippet:```go
package mainimport (
"crypto/aes"
"fmt"
)func main() {
key := make([]byte, 32)
c, err := aes.NewCipher(key)
if err != nil {
panic(err)
}plaintext := make([]byte, 32)
out := make([]byte, len(plaintext))
c.Encrypt(out, plaintext)fmt.Println(out)
fmt.Println(plaintext)
}
```Run it with `go`:
```
λ go run ./examples/aes.go[220 149 192 120 162 64 137 137 173 72 162 20 146 132 32 135 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
```Now run with the shell script in the `build` directory:
```
λ ./build/go.sh run ./examples/aes.go2016/11/24 07:34:58 crypto/aes: encrypt with openssl
[220 149 192 120 162 64 137 137 173 72 162 20 146 132 32 135 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]```