Студопедия
Случайная страница | ТОМ-1 | ТОМ-2 | ТОМ-3
АрхитектураБиологияГеографияДругоеИностранные языки
ИнформатикаИсторияКультураЛитератураМатематика
МедицинаМеханикаОбразованиеОхрана трудаПедагогика
ПолитикаПравоПрограммированиеПсихологияРелигия
СоциологияСпортСтроительствоФизикаФилософия
ФинансыХимияЭкологияЭкономикаЭлектроника

Исходный код

Читайте также:
  1. Исходный смысл проблемы бытия.
  2. Мотивационная характеристика темы, цели, задачи, исходный уровень знаний
  3. Мотивационная характеристика темы, цели, задачи, исходный уровень знаний.
  4. Мотивационная характеристика темы, цели, задачи, исходный уровень знаний.
  5. Мотивационная характеристика темы, цели, задачи, исходный уровень знаний.
  6. Мотивационная характеристика темы, цели, задачи, исходный уровень знаний.

Революционный код

(Шифровка – дешифровка текста)

Алгоритм Шифрования:

1) Записываем исходный текст в матрицы размерностью 8x8

2) Генерируем матрицу размерностью 8x8 состоящую из 16 единиц и 48 нулей. Единицы должны располагаться так, чтобы при 4х поворотах матрицы на 90 градусов по часовой стрелке, вся матрица была заполнена единицами, не накладываясь друг на друга.

3) Полученную матрицу накладываем на матрицу текста, записываем в файл все символы, на которые легли единицы. Поворачиваем матрицу единиц на 90 градусов и снова записываем в файл. Повторить 4 раза. Получаем зашифрованный текст, причем ключом для дешифрации являеться матрица единиц и нулей.

 

Исходный код

namespace lab1_inform

{

partial class Form1

{

/// <summary>

/// Required designer variable.

/// </summary>

private System.ComponentModel.IContainer components = null;

 

/// <summary>

/// Clean up any resources being used.

/// </summary>

/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>

protected override void Dispose(bool disposing)

{

if (disposing && (components!= null))

{

components.Dispose();

}

base.Dispose(disposing);

}

 

#region Windows Form Designer generated code

 

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

this.key0 = new System.Windows.Forms.RichTextBox();

this.key1 = new System.Windows.Forms.RichTextBox();

this.key2 = new System.Windows.Forms.RichTextBox();

this.key4 = new System.Windows.Forms.RichTextBox();

this.key3 = new System.Windows.Forms.RichTextBox();

this.inFileGroup = new System.Windows.Forms.GroupBox();

this.SaveIn = new System.Windows.Forms.Button();

this.clearIn = new System.Windows.Forms.Button();

this.openIn = new System.Windows.Forms.Button();

this.richTextBox1 = new System.Windows.Forms.RichTextBox();

this.label1 = new System.Windows.Forms.Label();

this.textBox1 = new System.Windows.Forms.TextBox();

this.outFileGroup = new System.Windows.Forms.GroupBox();

this.saveOut = new System.Windows.Forms.Button();

this.richTextBox2 = new System.Windows.Forms.RichTextBox();

this.clearOut = new System.Windows.Forms.Button();

this.textBox2 = new System.Windows.Forms.TextBox();

this.openOut = new System.Windows.Forms.Button();

this.label2 = new System.Windows.Forms.Label();

this.codeRadio = new System.Windows.Forms.RadioButton();

this.decodeRadio = new System.Windows.Forms.RadioButton();

this.process = new System.Windows.Forms.Button();

this.progressBar1 = new System.Windows.Forms.ProgressBar();

this.inFileGroup.SuspendLayout();

this.outFileGroup.SuspendLayout();

this.SuspendLayout();

//

// key0

//

this.key0.Location = new System.Drawing.Point(12, 369);

this.key0.Name = "key0";

this.key0.Size = new System.Drawing.Size(136, 133);

this.key0.TabIndex = 0;

this.key0.Text = "";

//

// key1

//

this.key1.Location = new System.Drawing.Point(176, 369);

this.key1.Name = "key1";

this.key1.Size = new System.Drawing.Size(136, 133);

this.key1.TabIndex = 0;

this.key1.Text = "";

//

// key2

//

this.key2.Location = new System.Drawing.Point(340, 369);

this.key2.Name = "key2";

this.key2.Size = new System.Drawing.Size(136, 133);

this.key2.TabIndex = 0;

this.key2.Text = "";

//

// key4

//

this.key4.Location = new System.Drawing.Point(663, 369);

this.key4.Name = "key4";

this.key4.Size = new System.Drawing.Size(136, 133);

this.key4.TabIndex = 0;

this.key4.Text = "";

//

// key3

//

this.key3.Location = new System.Drawing.Point(500, 369);

this.key3.Name = "key3";

this.key3.Size = new System.Drawing.Size(136, 133);

this.key3.TabIndex = 0;

this.key3.Text = "";

//

// inFileGroup

//

this.inFileGroup.Controls.Add(this.SaveIn);

this.inFileGroup.Controls.Add(this.clearIn);

this.inFileGroup.Controls.Add(this.openIn);

this.inFileGroup.Controls.Add(this.richTextBox1);

this.inFileGroup.Controls.Add(this.label1);

this.inFileGroup.Controls.Add(this.textBox1);

this.inFileGroup.Location = new System.Drawing.Point(12, 12);

this.inFileGroup.Name = "inFileGroup";

this.inFileGroup.Size = new System.Drawing.Size(324, 351);

this.inFileGroup.TabIndex = 1;

this.inFileGroup.TabStop = false;

this.inFileGroup.Text = "Исходный файл";

//

// SaveIn

//

this.SaveIn.Location = new System.Drawing.Point(243, 316);

this.SaveIn.Name = "SaveIn";

this.SaveIn.Size = new System.Drawing.Size(75, 23);

this.SaveIn.TabIndex = 3;

this.SaveIn.Text = "Сохранить";

this.SaveIn.UseVisualStyleBackColor = true;

this.SaveIn.Click += new System.EventHandler(this.SaveIn_Click);

//

// clearIn

//

this.clearIn.Location = new System.Drawing.Point(128, 316);

this.clearIn.Name = "clearIn";

this.clearIn.Size = new System.Drawing.Size(75, 23);

this.clearIn.TabIndex = 3;

this.clearIn.Text = "Очистить";

this.clearIn.UseVisualStyleBackColor = true;

this.clearIn.Click += new System.EventHandler(this.clearIn_Click);

//

// openIn

//

this.openIn.Location = new System.Drawing.Point(6, 316);

this.openIn.Name = "openIn";

this.openIn.Size = new System.Drawing.Size(75, 23);

this.openIn.TabIndex = 3;

this.openIn.Text = "открыть";

this.openIn.UseVisualStyleBackColor = true;

this.openIn.Click += new System.EventHandler(this.openIn_Click);

//

// richTextBox1

//

this.richTextBox1.Location = new System.Drawing.Point(6, 78);

this.richTextBox1.Name = "richTextBox1";

this.richTextBox1.Size = new System.Drawing.Size(312, 232);

this.richTextBox1.TabIndex = 2;

this.richTextBox1.Text = "";

//

// label1

//

this.label1.AutoSize = true;

this.label1.Location = new System.Drawing.Point(209, 42);

this.label1.Name = "label1";

this.label1.Size = new System.Drawing.Size(74, 13);

this.label1.TabIndex = 1;

this.label1.Text = "Путь к файлу";

//

// textBox1

//

this.textBox1.Location = new System.Drawing.Point(6, 39);

this.textBox1.Name = "textBox1";

this.textBox1.Size = new System.Drawing.Size(197, 20);

this.textBox1.TabIndex = 0;

this.textBox1.Text = "DEVDinput.txt";

//

// outFileGroup

//

this.outFileGroup.Controls.Add(this.saveOut);

this.outFileGroup.Controls.Add(this.richTextBox2);

this.outFileGroup.Controls.Add(this.clearOut);

this.outFileGroup.Controls.Add(this.textBox2);

this.outFileGroup.Controls.Add(this.openOut);

this.outFileGroup.Controls.Add(this.label2);

this.outFileGroup.Location = new System.Drawing.Point(482, 12);

this.outFileGroup.Name = "outFileGroup";

this.outFileGroup.Size = new System.Drawing.Size(326, 351);

this.outFileGroup.TabIndex = 1;

this.outFileGroup.TabStop = false;

this.outFileGroup.Text = "Полученный файл";

//

// saveOut

//

this.saveOut.Location = new System.Drawing.Point(242, 316);

this.saveOut.Name = "saveOut";

this.saveOut.Size = new System.Drawing.Size(75, 23);

this.saveOut.TabIndex = 3;

this.saveOut.Text = "Сохранить";

this.saveOut.UseVisualStyleBackColor = true;

this.saveOut.Click += new System.EventHandler(this.saveOut_Click);

//

// richTextBox2

//

this.richTextBox2.Location = new System.Drawing.Point(5, 78);

this.richTextBox2.Name = "richTextBox2";

this.richTextBox2.Size = new System.Drawing.Size(312, 232);

this.richTextBox2.TabIndex = 2;

this.richTextBox2.Text = "";

//

// clearOut

//

this.clearOut.Location = new System.Drawing.Point(127, 316);

this.clearOut.Name = "clearOut";

this.clearOut.Size = new System.Drawing.Size(75, 23);

this.clearOut.TabIndex = 3;

this.clearOut.Text = "Очистить";

this.clearOut.UseVisualStyleBackColor = true;

this.clearOut.Click += new System.EventHandler(this.clearOut_Click);

//

// textBox2

//

this.textBox2.Location = new System.Drawing.Point(5, 39);

this.textBox2.Name = "textBox2";

this.textBox2.Size = new System.Drawing.Size(197, 20);

this.textBox2.TabIndex = 0;

this.textBox2.Text = "DEVDCoutput.txt";

//

// openOut

//

this.openOut.Location = new System.Drawing.Point(5, 316);

this.openOut.Name = "openOut";

this.openOut.Size = new System.Drawing.Size(75, 23);

this.openOut.TabIndex = 3;

this.openOut.Text = "открыть";

this.openOut.UseVisualStyleBackColor = true;

this.openOut.Click += new System.EventHandler(this.openOut_Click);

//

// label2

//

this.label2.AutoSize = true;

this.label2.Location = new System.Drawing.Point(208, 42);

this.label2.Name = "label2";

this.label2.Size = new System.Drawing.Size(74, 13);

this.label2.TabIndex = 1;

this.label2.Text = "Путь к файлу";

//

// codeRadio

//

this.codeRadio.AutoSize = true;

this.codeRadio.Location = new System.Drawing.Point(366, 104);

this.codeRadio.Name = "codeRadio";

this.codeRadio.Size = new System.Drawing.Size(83, 17);

this.codeRadio.TabIndex = 2;

this.codeRadio.TabStop = true;

this.codeRadio.Text = "Шифровать";

this.codeRadio.UseVisualStyleBackColor = true;

//

// decodeRadio

//

this.decodeRadio.AutoSize = true;

this.decodeRadio.Location = new System.Drawing.Point(366, 140);

this.decodeRadio.Name = "decodeRadio";

this.decodeRadio.Size = new System.Drawing.Size(97, 17);

this.decodeRadio.TabIndex = 2;

this.decodeRadio.TabStop = true;

this.decodeRadio.Text = "Дешифровать";

this.decodeRadio.UseVisualStyleBackColor = true;

//

// process

//

this.process.Location = new System.Drawing.Point(366, 186);

this.process.Name = "process";

this.process.Size = new System.Drawing.Size(97, 23);

this.process.TabIndex = 3;

this.process.Text = "Выполнить";

this.process.UseVisualStyleBackColor = true;

this.process.Click += new System.EventHandler(this.process_Click);

//

// progressBar1

//

this.progressBar1.Location = new System.Drawing.Point(342, 316);

this.progressBar1.Name = "progressBar1";

this.progressBar1.Size = new System.Drawing.Size(134, 23);

this.progressBar1.TabIndex = 4;

//

// Form1

//

this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

this.ClientSize = new System.Drawing.Size(811, 523);

this.Controls.Add(this.progressBar1);

this.Controls.Add(this.process);

this.Controls.Add(this.decodeRadio);

this.Controls.Add(this.codeRadio);

this.Controls.Add(this.outFileGroup);

this.Controls.Add(this.inFileGroup);

this.Controls.Add(this.key3);

this.Controls.Add(this.key4);

this.Controls.Add(this.key2);

this.Controls.Add(this.key1);

this.Controls.Add(this.key0);

this.Name = "Form1";

this.Text = "Form1";

this.inFileGroup.ResumeLayout(false);

this.inFileGroup.PerformLayout();

this.outFileGroup.ResumeLayout(false);

this.outFileGroup.PerformLayout();

this.ResumeLayout(false);

this.PerformLayout();

 

}

 

#endregion

 

private System.Windows.Forms.RichTextBox key0;

private System.Windows.Forms.RichTextBox key1;

private System.Windows.Forms.RichTextBox key2;

private System.Windows.Forms.RichTextBox key4;

private System.Windows.Forms.RichTextBox key3;

private System.Windows.Forms.GroupBox inFileGroup;

private System.Windows.Forms.GroupBox outFileGroup;

private System.Windows.Forms.RadioButton codeRadio;

private System.Windows.Forms.RadioButton decodeRadio;

private System.Windows.Forms.Button process;

private System.Windows.Forms.ProgressBar progressBar1;

private System.Windows.Forms.TextBox textBox1;

private System.Windows.Forms.Button SaveIn;

private System.Windows.Forms.Button clearIn;

private System.Windows.Forms.Button openIn;

private System.Windows.Forms.RichTextBox richTextBox1;

private System.Windows.Forms.Label label1;

private System.Windows.Forms.Button saveOut;

private System.Windows.Forms.RichTextBox richTextBox2;

private System.Windows.Forms.Button clearOut;

private System.Windows.Forms.TextBox textBox2;

private System.Windows.Forms.Button openOut;

private System.Windows.Forms.Label label2;

}

}


Дата добавления: 2015-07-16; просмотров: 81 | Нарушение авторских прав


<== предыдущая страница | следующая страница ==>
Укажите верный ответ| Начало революции.

mybiblioteka.su - 2015-2024 год. (0.031 сек.)