steel_crypt 0.2.1
steel_crypt: ^0.2.1 copied to clipboard
A collection of high-level API's exposing PointyCastle/encrypt to perform hashing and encrypting in popular/secure algorithms.
Steel Crypt #
General #
A simple library of high-level API's and sugar for crypto/encrypt. This library currently supports hashing, two-way encryption, and key/IV generation:
2-Way
- AES with PKCS7 Padding ('AES') (Default)
- Salsa20 ('Salsa20')
- More coming...
- Note: AES requires 16 bytes of IV, whereas Salsa 20 requires 8
Hashing
- SHA-256 ('sha256') (Default)
- SHA-1 ('sha1')
- MD5 ('md5')
Key/IV (Initialization Vector) Generation
- Generates cryptographically secure keys + IV's
- Keys default to length 32, IV's to length 16
Usage #
A simple usage example:
import 'package:steel_crypt/steel_crypt.dart';
main() {
var key = CryptKey().genKey();
var encrypter = Crypt(key, 'AES');
var hasher = HashCrypt('sha256');
var hasher2 = HashCrypt('sha256');
var iv = CryptKey().genIV(16);
print(key);
print(hasher.hash('word'));
print(hasher.hashHMAC('word', key));
print(encrypter.encrypt('word', iv));
String crypted = encrypter.encrypt('word', iv);
print(encrypter.decrypt(crypted, iv));
}
Notes #
- Use in production AT YOUR OWN RISK.
- This is a work-in-progress, but will be actively maintained.
- Please file feature requests and bugs at the issue tracker.
TODO's #
- ✅ Create Project + add "Starter Set" of algorithms
- ❌ Add more, different 2-way encryption algorithms + packaging options
- ❌ Tackle adding an RSA solution OR expose encrypt's RSA
- ❌ Create a more complete password solution
- ❌ Add more detailed example