Exemple #1
0
        public static Lfsr Create(string key, string loadFilePath, string saveFilePath)
        {
            var initialFile = File.ReadAllBytes(loadFilePath);
            var lfsrKey     = CipherHelpers.GenerateKey(key, initialFile.Length, new[] { 27 });
            var cipherFile  = CipherHelpers.GenerateCipher(initialFile, lfsrKey);
            var lfsr        = new Lfsr(lfsrKey, initialFile, cipherFile);

            File.WriteAllBytes(saveFilePath, lfsr.CipherFile);
            return(lfsr);
        }
Exemple #2
0
        public static Geffe Create(string firstKeyStream, string secondKeyStream, string thirdKeyStream, string loadFilePath, string saveFilePath)
        {
            var initialFile = File.ReadAllBytes(loadFilePath);
            var firstKey    = CipherHelpers.GenerateKey(firstKeyStream, initialFile.Length, new int[] { 27 });
            var secondKey   = CipherHelpers.GenerateKey(secondKeyStream, initialFile.Length, new int[] { 26, 19, 20 });
            var thirdKey    = CipherHelpers.GenerateKey(thirdKeyStream, initialFile.Length, new int[] { 25, 27, 35 });
            var key         = GenerateGeffeKey(firstKey, secondKey, thirdKey);
            var cipherFile  = CipherHelpers.GenerateCipher(initialFile, key);
            var geffe       = new Geffe(firstKey, secondKey, thirdKey, key, initialFile, cipherFile);

            File.WriteAllBytes(saveFilePath, geffe.CipherFile);
            return(geffe);
        }