Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/risto-stevcev/haskell-crypto-simple
A simple high level encryption interface based on cryptonite
https://github.com/risto-stevcev/haskell-crypto-simple
crypto cryptonite haskell simple
Last synced: 2 months ago
JSON representation
A simple high level encryption interface based on cryptonite
- Host: GitHub
- URL: https://github.com/risto-stevcev/haskell-crypto-simple
- Owner: Risto-Stevcev
- License: mit
- Created: 2016-09-15T19:45:15.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-25T10:22:50.000Z (over 6 years ago)
- Last Synced: 2024-04-24T08:27:19.614Z (9 months ago)
- Topics: crypto, cryptonite, haskell, simple
- Language: Haskell
- Homepage: https://hackage.haskell.org/package/crypto-simple
- Size: 5.86 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# haskell-crypto-simple
A simple high level encryption interface based on cryptonite
## Usage
```haskell
> import Crypto.Simple.CBC (encrypt, decrypt)
> import Data.ByteString.Char8 (pack)
> let key = pack "my secret key"
> let msg = pack "this is a message"
> encrypt key msg >>= \secretMsg -> decrypt key secretMsg
"this is a message"
```## Implementation
The implementation is based on some good defaults
- The cipher that's used is AES 256
- You can choose between CBC or CTR cipher modes (modules Crypto.Simple.CBC and Crypto.Simple.CTR)
- If you use CBC, it will pad/unpad the message using the PKCS7 padding scheme
- The entropy method used for the initialization vector is the default system-level CSPRNG (ie. /dev/random). It is based on Crypto.Random.Entropy.getEntropy
- The maximum size for the encryption key is 32 bytes