kaalka 4.0.0
kaalka: ^4.0.0 copied to clipboard
Kaalka encryption algorithm for Dart. Robust, lossless time-based encryption for text and files/media using clock hand angles, trigonometric functions, and integer arithmetic. Cross-language compatibl [...]
Kaalka Encryption Algorithm for Dart #
Robust, timestamp-based encryption for Dart, compatible with Python and JavaScript implementations. Uses angles and trigonometric functions for text, and integer arithmetic for file/media encryption, ensuring lossless, reversible results for all file types (images, binary, etc.).
Features #
- Robust encryption using timestamp-based keys (angles, trigonometric functions for text; integer arithmetic for files/media)
- Cross-platform: Compatible with Python and Node.js Kaalka implementations
- Flexible API: Use system time, NTP, or custom timestamp for encryption/decryption
- File/media support: Encrypt/decrypt any file or media type (text, binary, images, etc.) with lossless, reversible results
- Extension handling: Encrypted files use
.kaalka, decrypted files restore original extension - Packet support: Example wrapper for secure message packets
Installation #
Add to your pubspec.yaml:
dependencies:
kaalka:
git:
url: https://github.com/PIYUSH-MISHRA-00/Kaalka-Encryption-Algorithm.git
path: lib
Usage #
Text Encryption/Decryption #
import 'package:kaalka/kaalka.dart';
void main() async {
final kaalka = Kaalka(); // Uses current system time
final message = 'Hello, Kaalka!';
final encrypted = await kaalka.encrypt(message); // Encrypt with current time
final decrypted = await kaalka.decrypt(encrypted); // Decrypt with same time
// Explicit time
final encrypted2 = await kaalka.encrypt(message, timeKey: '14:35:22');
final decrypted2 = await kaalka.decrypt(encrypted2, timeKey: '14:35:22');
}
File/Media Encryption/Decryption #
import 'package:kaalka/kaalka.dart';
void main() async {
final kaalka = Kaalka();
// Encrypt a file (any type)
final encryptedFile = await kaalka.encrypt('photo.jpg'); // Produces photo.kaalka
// Decrypt the file
final decryptedFile = await kaalka.decrypt(encryptedFile); // Produces photo.jpg
}
NTP Time Support #
import 'package:kaalka/kaalka_ntp.dart';
void main() async {
final encrypted = await KaalkaNTP.encryptWithNtp('NTP message');
final decrypted = await KaalkaNTP.decryptWithNtp(encrypted);
}
Packet Wrapper #
import 'package:kaalka/packet.dart';
void main() {
final packet = Packet('Packet payload', timeKey: '03:21:09');
packet.encrypt();
final decrypted = packet.decrypt();
}
- Encrypted files use only the
.kaalkaextension (e.g.,photo.kaalka) - Decrypted files restore the original name and extension (e.g.,
photo.jpg) - Encryption and decryption must use the same timestamp
- Supports any file/media type (text, binary, images, etc.)
- Lossless, reversible encryption for all file/media types (images, video, music, text, CSV, JSON, XML, etc.)
License #
See LICENSE file for details.
Contributing #
Contributions, bug reports, and feature requests are welcome! Please open an issue or submit a pull request on GitHub.