Chromarotor

An enigma-inspired cipher that uses image pixels as dynamic rotors to encrypt and scramble data.
Hecho en 🇵🇷 por Radamés J. Valentín Reyes
Orgullosamente Boricua

Features

  • Symmetric encryption
  • No encryption overhead (file/data size is kept. not increased/bloated)
  • Easy to use
  • Data obfuscation - Bytes are shuffled.
  • Now uses BigInt as seed instead of int
  • Now uses big_dec for calculations
  • Now uses big_random instead of dart's built in random which is restricted to the size of an int

Learn the about image generation

Check out my book on Amazon.

Import

import 'package:chromarotor/chromarotor.dart';

Generate image

Generates a list of rgb values to be used for encryption

List<int> image = generateImage(
  seed: password,
  imageSize: 200,
);

Encrypt

List<int> cipheredMessage = chromaRotorCipher(
  image: image,
  bytes: message.codeUnits,
);

Decrypt

List<int> decipheredMessage = chromaRotorDecipher(
  image: image, 
  bytes: cipheredMessage,
);

Full Example

BigInt password = BigInt.parse("9684615468496727262");
List<int> image = generateImage(
  seed: password,
  imageSize: 200,
);
String message = "Yo soy boricua pa que tu lo sepas.";
print(message);
List<int> cipheredMessage = chromaRotorCipher(
  image: image,
  bytes: message.codeUnits,
);
print("Ciphered: ${String.fromCharCodes(cipheredMessage)}");
List<int> decipheredMessage = chromaRotorDecipher(
  image: image, 
  bytes: cipheredMessage,
);
print("Deciphered: ${String.fromCharCodes(decipheredMessage)}");

Credits

  • My friend Copilot

Libraries

chromarotor