https://github.com/lamnguyen17/flutter_crypto_algorithm
Method Channel using Kotlin & Swift for Flutter
https://github.com/lamnguyen17/flutter_crypto_algorithm
coroutines-flow cryptoswift flutter kotlin-android kotlin-coroutines method-channel reactive-programming rxswift swift-ios
Last synced: 3 months ago
JSON representation
Method Channel using Kotlin & Swift for Flutter
- Host: GitHub
- URL: https://github.com/lamnguyen17/flutter_crypto_algorithm
- Owner: LamNguyen17
- License: mit
- Created: 2024-10-10T09:28:13.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2024-10-13T05:16:40.000Z (7 months ago)
- Last Synced: 2025-01-07T21:35:08.763Z (5 months ago)
- Topics: coroutines-flow, cryptoswift, flutter, kotlin-android, kotlin-coroutines, method-channel, reactive-programming, rxswift, swift-ios
- Language: Dart
- Homepage:
- Size: 122 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# flutter_crypto_algorithm
[](https://pub.dev/packages/flutter_crypto_algorithm)
[](https://app.codecov.io/github/LamNguyen17/flutter_crypto_algorithm/blob/master/lib)
[](https://github.com/LamNguyen17/flutter_crypto_algorithm/blob/master/LICENSE)
[](https://github.com/LamNguyen17)A Flutter package for secure encryption algorithms, providing efficient tools for data protection and encryption operations
## Installation
Run this command with Flutter:
```sh
flutter pub add encryption_algorithm
```## Usage
### Methods
#### 🚀 AES
```dart
import 'package:flutter_crypto_algorithm/flutter_crypto_algorithm.dart';
```
```dart
void main() {
runApp(const MyApp());
}class MyApp extends StatefulWidget {
const MyApp({super.key});@override
State createState() => _MyAppState();
}class _MyAppState extends State {
String _encrypt = '';
String _decrypt = '';
final _crypto = Crypto();@override
void initState() {
super.initState();
crypto();
}// Platform messages are asynchronous, so we initialize in an async method.
Future crypto() async {
String encrypt;
String decrypt;
try {
encrypt =
await _crypto.encrypt('Hello123', 'Hello') ??
'Unknown encrypt';
decrypt = await _crypto.decrypt(encrypt, 'Hello') ??
'Unknown decrypt';
} on PlatformException {
encrypt = 'Failed encrypt.';
decrypt = 'Failed decrypt.';
}
if (!mounted) return;
setState(() {
_encrypt = encrypt;
_decrypt = decrypt;
});
}@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Flutter Crypto Algorithm'),
),
body: SingleChildScrollView(
child: Column(
children: [
Section(title: 'AES', children: [
_buildText('Encrypt: ', _encrypt),
_buildText('Decrypt: ', _decrypt),
]),
],
),
),
),
);
}Widget _buildText(String label, String value) {
return Text.rich(
overflow: TextOverflow.ellipsis,
maxLines: 2,
TextSpan(
text: label,
style: const TextStyle(
fontSize: 16, fontWeight: FontWeight.bold, color: Colors.red),
children: [
TextSpan(
text: value,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.normal,
color: Colors.black),
),
],
),
);
}
}class Section extends StatelessWidget {
final String title;
final List children;const Section({super.key, required this.title, required this.children});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
...children,
],
),
);
}
}
```---
## API
### List of Algorithms
- [x] ```AES(Advanced Encryption Standard)```
- [ ] ```SHA-256 (Secure Hash Algorithm)```
- [ ] ```RSA (Rivest-Shamir-Adleman)```
- [ ] ```ChaCha20```
- [ ] ```Blowfish```
- [ ] ```HMAC (Hash-based Message Authentication Code)```
- [ ] ```PBKDF2 (Password-Based Key Derivation Function 2)```
- [ ] ```ECC (Elliptic Curve Cryptography)```
- [ ] ```Scrypt```
- [ ] ```XChaCha20-Poly1305```
---
## Author
Forest Nguyen
Email: [email protected]
---
## License
MIT License
Copyright (c) 2024 Forest Nguyen
---