public void Ready_up_encryption()
    {
        message = laundry_data.Get_data();
        Russian();

        cipher_canvas.gameObject.SetActive(true);
        left_main.SetActive(true);
        left_txt.SetActive(false);
        left_img.SetActive(false);

        work_bits            = laundry_data.Get_raw_bits();
        picked_functions     = laundry_data.Get_picked_functions();
        number_of_iterations = laundry_data.Get_iterations();
        current_iteration    = 0;
        end_of_iteration     = false;
        number_of_blocks     = work_bits.Length / Static_Data.Get_double_segment_size();
        current_block        = 0;
        end_of_blocks        = false;
        cipher_state         = Cipher_State.Encryption;
        cipher_type          = laundry_data.Get_cipher_type();
        Set_current(work_bits, full_sqtr_size);

        full_sqtr_size = Calculate_sqrt_floor(work_bits.Length);
        Create_img(work_bits, full_sqtr_size);
        title_text.text = Text_Data.Get_raw_text();
        //current_key = Static_Data.Get_key();

        steps = laundry_data.Get_work_bytes();
    }
Beispiel #2
0
        private async void NavigateButton_OnClicked(object sender, EventArgs e)
        {
            Cipher_Type type   = Cipher_Type.Caesar;
            string      cipher = "";

            if (sender is Button)
            {
                cipher = ((Button)sender).Text;
            }
            else if (sender is Picker)
            {
                var picker        = (Picker)sender;
                int selectedIndex = picker.SelectedIndex;
                cipher = picker.Items[selectedIndex];
            }

            // Determines which cipher to initialize on the tabbed pages.
            switch (cipher)
            {
            case "Caesar Cipher":
                type = Cipher_Type.Caesar;
                break;

            case "Vigenere Cipher":
                type = Cipher_Type.Vigenere;
                break;

            case "Monoalphabetic Cipher":
                type = Cipher_Type.Monoalphabetic;
                break;

            case "Homophonic Cipher":
                type = Cipher_Type.Homophonic;
                break;

            case "Hill Cipher":
                type = Cipher_Type.Hill;
                break;

            case "Vernam Cipher":
                type = Cipher_Type.Vernam;
                break;

            default:
                break;
            }
            await Navigation.PushAsync(new TabbedPage1(type));
        }
Beispiel #3
0
        public TabbedPage1(Cipher_Type cipherType)
        {
            InitializeComponent();

            cipher = new CipherViewModel(cipherType);

            // Bind Cipher ViewModel object to tabbed page
            this.BindingContext = cipher;

            // Set IsBusy to false on inital page load.
            cipher.IsBusy = false;

            // Set page elements based on Cipher type
            switch (cipher.Type)
            {
            case Cipher_Type.Caesar:
                Input_Key.Keyboard  = Keyboard.Numeric;
                Input_Key.MaxLength = 2;
                break;

            case Cipher_Type.Hill:
                Input_Key.MaxLength = 4;
                break;

            case Cipher_Type.Homophonic:
                Input_Key.Text = "21,27,31,40;15;01,33;20,34;22,28,32,36,37;05;17;14;02,29,38,41;19;03;07,39,42;09,43;12,48,97;18,60,85;26,44;25;24,49;10,30,45,99;06,96,55;16,94;23;13;11;08;04;";
                break;

            case Cipher_Type.Monoalphabetic:
                break;

            case Cipher_Type.Vernam:
                Input_Key.IsVisible = false;
                break;

            case Cipher_Type.Vigenere:
                break;
            }
        }
Beispiel #4
0
 public void Set_cipher_type(Cipher_Type type)
 {
     cipher_type = type;
 }
 private void Set_data(BitArray bits, Cipher_Type type)
 {
     laundry_data.Set_raw_bits(bits);
     laundry_data.Set_cipher_type(type);
 }