Simply make sure to add the following to your pubspec.yaml
:
dependencies:
crypt:
git:
url: https://github.com/Marc-R2/encrypt_dart.git
and run pub get
or pub upgrade
in the same directory as your pubspec.yaml
.
import 'package:crypt/encrypt.dart';
final hashed = Hash.sha256('Hello, World!').hashString; // or hashBytes or hashDig
final instance = AESHandler(); // or RSAHandler or ECCHandler
final encrypted = instance.encrypt(key: '<key>', data: 'Hello, World!');
final decrypted = instance.decrypt(encrypted);
final sign = ECCHandler.signData(privateKey: '<private key>', data: 'Hello, World!');
final verify = ECCHandler.verifyData(publicKey: '<public key>', data: 'Hello, World!', signature: sign);