encryption_helper 1.0.0 copy "encryption_helper: ^1.0.0" to clipboard
encryption_helper: ^1.0.0 copied to clipboard

A simple Dart library providing basic string encryption and decryption using XOR and Caesar cipher techniques. Ideal for lightweight data obfuscation.

Encryption Helper #

A simple Dart library that provides basic string encryption and decryption using XOR and Caesar cipher techniques.

Features #

  • XOR cipher encryption and decryption using a single-byte key.
  • Caesar cipher encryption and decryption with a customizable shift.
  • Handles both uppercase and lowercase letters in Caesar cipher.
  • Ignores non-alphabet characters during Caesar operations.

Getting started #

To use this package:

  1. Add it to your pubspec.yaml:
dependencies:
  basic_encryption_helper: ^0.0.1

Example #

Here's how to use the EncryptionHelper for XOR and Caesar cipher encryption and decryption:

import 'package:encryption_helper/encryption_helper.dart';

void main() {
  // XOR cipher example
  const key = 42;
  final originalText = 'Hello, XOR Cipher!';
  final encryptedXOR = EncryptionHelper.xorEncrypt(originalText, key);
  final decryptedXOR = EncryptionHelper.xorEncrypt(encryptedXOR, key);

  print('Original: $originalText');
  print('Encrypted (XOR): $encryptedXOR');
  print('Decrypted (XOR): $decryptedXOR');

  // Caesar cipher example
  const shift = 3;
  final caesarPlain = 'Hello, Caesar Cipher!';
  final encryptedCaesar = EncryptionHelper.caesarEncrypt(caesarPlain, shift);
  final decryptedCaesar = EncryptionHelper.caesarDecrypt(encryptedCaesar, shift);

  print('Original: $caesarPlain');
  print('Encrypted (Caesar): $encryptedCaesar');
  print('Decrypted (Caesar): $decryptedCaesar');
}

Output #

When you run the example, you will see the original text, encrypted text, and decrypted text printed to the console.

Original: Hello, XOR Cipher! Encrypted (XOR): (some encrypted string) Decrypted (XOR): Hello, XOR Cipher! Original: Hello, Caesar Cipher! Encrypted (Caesar): Khoor, Fdhvdu Flskhu! Decrypted (Caesar): Hello, Caesar Cipher!

5
likes
150
points
13
downloads

Publisher

verified publisherba-systems.com

Weekly Downloads

A simple Dart library providing basic string encryption and decryption using XOR and Caesar cipher techniques. Ideal for lightweight data obfuscation.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on encryption_helper