- , , . , {.,:;!? () <> }, 44. 0 43. { a n} A={0,1,2,,43}.
, {cn} , - . 44 an cn:
an + cn º bn (mod 44), 0<=bn<=43
{bn} . , :
an º bn - cn (mod 44), 0<=an<=43
, , . . . , , . , , .
: , , .
Visual C++ CLR Microsoft.
, , . , .
, .
.
: , . .
:
System::String^ cesar(System::String^ input){
System::String^ output;
System::String^ shft;
dialogCatchWord^ dCW = gcnew dialogCatchWord();
dCW->labelCatchWord->Text = Enter shift;
|
|
dCW->Text = Shift;
dCW->textBoxCatchWord->MaxLength = 2;
shft = dCW->ShowDlg();
System::Int32 shift;
shift = System::Int32::Parse(shft);
if (shift > 25) {
output = Error 103! Shift must be < 26!!!;
return output;
}
for (int I = 0; I < input->Length; i++){
System::Char ch;
if (input[i] >= A && input[i] <= Z) {
ch = input[i] + shift;
if (input[i] + shift > 90) ch -= 26;
}
else if (input[i] >= a && input[i] <= z) {
ch = input[i] + shift;
if (input[i] + shift > 122) ch -=26;
}
else ch = input[i];
output = System::String::Concat(output, ch.ToString());
}
return output;
}
: veni vidi vici
yhql ylgl ylfl 3
zirm zmhm zmgm 4
: , . , . , , .
:
System::String^ cardano(System::String^ input){
System::String^ output;
int* code;
code = new int[input->Length];
Random rnd;
for (int i = 0; i < input->Length; i++) code[i] = rnd.Next(2);
for (int i = 0; i < input->Length; i++) if (code[i] && (String::Compare(input[i].ToString(), " ")!= 0)) output = String::Concat(output, input[i].ToString());
else if (String::Compare(input[i].ToString(), " ") == 0) output = String::Concat(output, " ");
return output;
}
: mother washed a window-frame
010001 011011 0 011001011010
o r as ed in w fr m
: ABCDEFGHIJKLMNOPQRSTUVWXYZ!"(),-.?:; . () 0 36 , . 36 . .
:
int getIntexLetter(System::Char letter, System::String^ aplphabeth){
int ret;
for (int i = 0; i < aplphabeth->Length; i++) if (letter == aplphabeth[i]) ret = i;
return ret;
}
System::String^ notepad(System::String^ input){
System::String^ output;
System::String^ alphabeth;
System::Char ch;
input = input->ToUpper();
for (int i = 0; i < 37; i++){
if (i < 26) ch = i + 65;
if (i == 26) ch = '!';
if (i == 27) ch = '"';
if (i == 28) ch = '(';
if (i == 29) ch = ')';
if (i == 30) ch = ',';
if (i == 31) ch = '-';
if (i == 32) ch = '.';
if (i == 33) ch = '?';
if (i == 34) ch = ':';
if (i == 35) ch = ';';
if (i == 36) ch = ' ';
alphabeth = System::String::Concat(alphabeth, ch.ToString());
}
int* code;
code = new int[input->Length];
Random rnd;
for (int i = 0; i < input->Length; i++) code[i] = rnd.Next(37);
for (int i = 0; i < input->Length; i++){
|
|
int index = getIntexLetter(input[i], alphabeth);
index += code[i];
if (index > 36) index -= 36;
output = System::String::Concat(output, alphabeth[index].ToString());
}
return output;
}
: , .
- .
: mother washed a window-frame
father father f atherf ather
ROMOII BALOIU F WBUHFB-FKHQV
( father)
comput ercomp u tercom puter
OCFWYK ARUVQS U PMEFCI-ULTQV
( computer)
ABCDEFGHIJKLMNOPQRSTUVWXYZ
BCDEFGHIJKLMNOPQRSTUVWXYZA
CDEFGHIJKLMNOPQRSTUVWXYZAB
DEFGHIJKLMNOPQRSTUVWXYZABC
EFGHIJKLMNOPQRSTUVWXYZABCD
FGHIJKLMNOPQRSTUVWXYZABCDE
GHIJKLMNOPQRSTUVWXYZABCDEF
HIJKLMNOPQRSTUVWXYZABCDEFG
IJKLMNOPQRSTUVWXYZABCDEFGH
JKLMNOPQRSTUVWXYZABCDEFGHI
KLMNOPQRSTUVWXYZABCDEFGHIJ
LMNOPQRSTUVWXYZABCDEFGHIJK
MNOPQRSTUVWXYZABCDEFGHIJKL
NOPQRSTUVWXYZABCDEFGHIJKLM
OPQRSTUVWXYZABCDEFGHIJKLMN
PQRSTUVWXYZABCDEFGHIJKLMNO
QRSTUVWXYZABCDEFGHIJKLMNOP
RSTUVWXYZABCDEFGHIJKLMNOPQ
STUVWXYZABCDEFGHIJKLMNOPQR
TUVWXYZABCDEFGHIJKLMNOPQRS
UVWXYZABCDEFGHIJKLMNOPQRST
VWXYZABCDEFGHIJKLMNOPQRSTU
WXYZABCDEFGHIJKLMNOPQRSTUV
XYZABCDEFGHIJKLMNOPQRSTUVW
YZABCDEFGHIJKLMNOPQRSTUVWX
ZABCDEFGHIJKLMNOPQRSTUVWXY
, : , , .
1. C: :
C:\ Kript_#
# 1_ .doc
2. labWork1, 2.
labWork1 (, , Crypto_2)
3. .
*.txt .
4. , .
5. , .
6. , 1.
7. , :
,
( ),
( ),
,
,
,
.
.
8. , . 1.
9. Windows.
1
1,5,7, 3,9,18 | ? ? |
2,4,6,8, 20,22,24 | ? ? |
11,13,15, 10,17,19 | ? . |
12,14,16 21,23,25 | , . |
|
|
[1] (200-120 ..)
2 (1501-1576) - , . .
3 (1523-1596) - , . 400 .