/// <summary> /// Generates a new CellularAutomataKey object. /// </summary> /// <param name="seed"> /// A desired seed value passed to <see cref="System.Random" /> to /// use for generating key schedules . /// </param> /// <returns> /// A new CellularAutomataKey object with random values /// determined from the specified seed. /// </returns> public static CellularAutomataKey Generate(int seed) { Random rand = new Random(seed); CellularAutomataKey newKey = new CellularAutomataKey(rand.Next(0, 255), // rule rand.Next(0, 255), // initialState seed); // seed return(newKey); }
/// <summary> /// Basic initialization constructor with a predefined plaintext image. /// </summary> /// <param name="plaintextImage"> /// The image that will be encrypted once a key is defined. /// </param> public CellularAutomataEncryptor(Bitmap plaintextImage) : this(plaintextImage, CellularAutomataKey.Generate()) { }
/// <summary> /// Full initialization constructor. /// </summary> /// <param name="plaintextImage"> /// The image that is to be encrypted. /// </param> /// <param name="key"> /// The BioInspiredKey object that is used to encrypt the image. /// </param> public CellularAutomataEncryptor( Bitmap plaintextImage, CellularAutomataKey key) { PlaintextImage = (Bitmap)plaintextImage.Clone(); Key = key.Clone(); }
/// <summary> /// Basic constructor with a predefined key. /// </summary> /// <param name="key"> /// The BioInspiredKey object that will be used by the cryptosystem. /// </param> public CellularAutomataEncryptor(CellularAutomataKey key) : this(null, key) { }