Dart CI

cypher_encrypt

A simple, flexible Dart package for encrypting and decrypting strings using a customizable substitution cipher.

You can shift characters by a number of steps, define your own sequence, and safely encrypt/decrypt any UTF-8 text.
Characters not included in the sequence remain unchanged.


✨ Features

  • πŸ” Encryption & decryption with a substitution cipher
  • πŸ”„ Customizable steps (shift forward/backward by N)
  • πŸ“ Default sequence provided, but you can override with your own
  • 🌍 Works with any UTF-8 string (letters, numbers, symbols, emojis)
  • πŸ›‘οΈ Safe by design: no FormatException because we don’t rely on Base64

πŸ“¦ Installation

Add this line to your pubspec.yaml under dependencies:

dependencies:
  cypher_encrypt: ^0.0.1

Then run: dart pub get


πŸš€ Usage Example

import 'package:cypher_encrypt/cypher_encrypt.dart';

void main() {
final text = "Cypher the like button!";

// Encrypt with steps = 3
final encrypted = cypherEncrypt(text, steps: 3);
print("Encrypted: $encrypted");

// Decrypt with the same steps
final decrypted = cypherDecrypt(encrypted, steps: 3);
print("Decrypted: $decrypted");

// Wrong steps β†’ produces gibberish
final wrong = cypherDecrypt(encrypted, steps: 2);
print("Wrong decryption: $wrong");
}

πŸ‘€ Example Output

Encrypted: FBskhubwkhbolnhbexwwrq%
Decrypted: Cypher the like button!
Wrong decryption: Dzqifs-uif-mjlf-cvuupo@

πŸ”‘ Default Sequence

By default, cypher_encrypt uses this sequence: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=+!@#%&*()_ -

  • βœ… Works for letters, numbers, and common symbols
  • βœ… You can override with your own sequence
  • βœ… Characters not in the sequence remain unchanged

πŸ’πŸΌ Custom Sequence Example

final encrypted = cypherEncrypt(
"Hello World!",
sequence: "zyxwvutsrqponmlkjihgfedcba", // reversed alphabet
steps: 5,
);

final decrypted = cypherDecrypt(
encrypted,
sequence: "zyxwvutsrqponmlkjihgfedcba",
steps: 5,
);

πŸ“œ License

MIT License Β© 2025 Muhammad Rameez


Libraries

cypher_encrypt
main