smart_encrypt 1.0.8
smart_encrypt: ^1.0.8 copied to clipboard
library for easy use encrypt & decrypt features, generate bytes & string
example/smart_encrypt_example.dart
import 'dart:io';
import 'dart:typed_data';
import 'package:smart_encrypt/smart_encrypt.dart';
void main() async {
print(SmartEncrypt.getRandomNumbers(24));
print(SmartEncrypt.getRandomString(30));
print(SmartEncrypt.createDataHash256('Hello world'));
String str = 'Hello world';
Uint8List key = SmartEncrypt.createKey();
Uint8List iv = SmartEncrypt.createIV();
str = SmartEncrypt.encrypt(str, key, iv);
print(str);
print(SmartEncrypt.decrypt(str, key, iv));
List<int> yourFileBites = await File('your file path').readAsBytes();
print('encrypt start');
List<int> encryptedFileBites =
await SmartEncrypt.fastEncryptFile(yourFileBites, 250);
print('encrypt end');
await SmartEncrypt.fastDecryptFile(encryptedFileBites, 250)
.then((value) => print('decrypted'));
String dupli = 'Wow, hello';
dupli = SmartEncrypt.duplicatedEncrypt(dupli, key, iv);
print(dupli);
dupli = SmartEncrypt.duplicatedDecrypt(dupli, key, iv);
print(dupli);
String easy = 'Hello Easy';
easy = SmartEncrypt.easyEncrypt(easy);
print(easy);
easy = SmartEncrypt.easyDecrypt(easy);
print(easy);
}