Attribute VB_Name = "mdlModule" Public FlSv As Boolean 'Объявление переменной для учёта сохранения файлов\окон Public m As Integer 'Переменная для счётчика открытых форм\окон Public text As String 'Объявление переменной для присвоения ей значения всего текста, помещённого в текстовое окно Public code As String 'Объявление переменной для присвоения ей значения Public v As String 'Объявление переменной для временного присвоения значений символьных переменных при объединении элементов массива в текст/строку Public s As Integer 'Объявление переменной как счётчика замен символов исходного текста в 16-ричный код Public n As Integer 'Объявление переменной для выражения длины исходного текста Dim i As Integer 'Объявление переменной для счёта шагов в массиве Dim Strfile As String, Fl As String Dim k() As Integer 'Объявление переменного массива для присвоения 16-ричного кода исходного текста Dim c() As Integer 'Объявление переменного массива для присвоения 16-ричного кода закодированного текста Public Function ReadingOfTheInitialText() As Boolean 'Функция определения начальных значений переменных при чтении всех символов в активном текстовом окне s = 1 'Присвоение начального значения счётчику замен символов исходного текста в 16-ричный код v = "" code = "" If text = "" Then MsgBox "Это значение недопустимо!" & Chr(13) & Chr(10) & " Введите текст!", vbOKOnly + vbExclamation, "Недопустимое значение" ReadingOfTheInitialText = False Exit Function End If n = Len(text) 'Присвоение переменной n найденного значения длинны исходного текста ReDim k(1 To n) As Integer 'Перепривоение массива исходного текста ReDim c(1 To n) As Integer 'Перепривоение массива закодированного текста ReadingOfTheInitialText = True End Function Public Function PresenceOfTheReceivedCode() As String 'Вычисление символов из 16-ричного кода шифра (т. е. вывод полученного шифра) For i = 1 To n v = Chr(c(i)) 'Преобразование 16-ричного кода закодированного текста в знаки закодированного текста code = code & v 'Объединение всех символов закодированного текста в закодированный текст Next End Function Public Function PrintOfTheReceivedCode() As String For i = 1 To n code = code & c(i) & " " 'Объединение всех символов закодированного текста в закодированный текст Next End Function Public Function PresenceСodeOfTheInitialText() As String 'Вычисление 16-ричного кода исходного текста For i = 1 To n k(i) = Asc(Mid(text, s, 1)) 'преобразование всех знаков исходного текста в 16-ричный код исходного текста 'Функция Mid(String, Start As Long, [Length]) вырезает из строковой переменной text один символ, начиная с позиции s (s=1 - начальное значение) 'Функция Asc(String As String) определяет 16-ричный код первого символа в строке If s = n Then s = s Else s = s + 1 Next End Function Public Function PrintСodeOfTheInitialText() As String 'Вычисление 16-ричного кода исходного текста For i = 1 To n k(i) = Asc(Mid(text, s, 1)) 'преобразование всех знаков исходного текста в 16-ричный код исходного текста 'Функция Mid(String, Start As Long, [Length]) вырезает из строковой переменной text один символ, начиная с позиции s (s=1 - начальное значение) 'Функция Asc(String As String) определяет 16-ричный код первого символа в строке If s = n Then s = s Else s = s + 1 code = code & k(i) & " " Next End Function Public Function TranslitEn() As String 'Вычисление 16-ричного кода латинского транслита For i = 1 To n 'замена 16-ричного кода исходного текста в 16-ричный код латинского транслита Select Case k(i) Case Is = 192 c(i) = 65 Case Is = 193 c(i) = 66 Case Is = 194 c(i) = 86 Case Is = 195 c(i) = 71 Case Is = 196 c(i) = 68 Case Is = 197 c(i) = 69 Case Is = 168 c(i) = 168 Case Is = 198 c(i) = 198 Case Is = 199 c(i) = 90 Case Is = 200 c(i) = 73 Case Is = 201 c(i) = 74 Case Is = 202 c(i) = 75 Case Is = 203 c(i) = 76 Case Is = 204 c(i) = 77 Case Is = 205 c(i) = 78 Case Is = 206 c(i) = 79 Case Is = 207 c(i) = 80 Case Is = 208 c(i) = 82 Case Is = 209 c(i) = 83 Case Is = 210 c(i) = 84 Case Is = 211 c(i) = 85 Case Is = 212 c(i) = 70 Case Is = 213 c(i) = 72 Case Is = 214 c(i) = 214 Case Is = 215 c(i) = 215 Case Is = 216 c(i) = 216 Case Is = 217 c(i) = 217 Case Is = 218 c(i) = 34 Case Is = 219 c(i) = 89 Case Is = 220 c(i) = 39 Case Is = 221 c(i) = 69 Case Is = 222 c(i) = 222 Case Is = 223 c(i) = 223 Case Is = 224 c(i) = 97 Case Is = 225 c(i) = 98 Case Is = 226 c(i) = 118 Case Is = 227 c(i) = 103 Case Is = 228 c(i) = 100 Case Is = 229 c(i) = 101 Case Is = 184 c(i) = 184 Case Is = 230 c(i) = 230 Case Is = 231 c(i) = 122 Case Is = 232 c(i) = 105 Case Is = 233 c(i) = 106 Case Is = 234 c(i) = 107 Case Is = 235 c(i) = 108 Case Is = 236 c(i) = 109 Case Is = 237 c(i) = 110 Case Is = 238 c(i) = 111 Case Is = 239 c(i) = 112 Case Is = 240 c(i) = 114 Case Is = 241 c(i) = 115 Case Is = 242 c(i) = 116 Case Is = 243 c(i) = 117 Case Is = 244 c(i) = 102 Case Is = 245 c(i) = 104 Case Is = 246 c(i) = 246 Case Is = 247 c(i) = 247 Case Is = 248 c(i) = 248 Case Is = 249 c(i) = 249 Case Is = 250 c(i) = 34 Case Is = 251 c(i) = 121 Case Is = 252 c(i) = 39 Case Is = 253 c(i) = 101 Case Is = 254 c(i) = 254 Case Is = 255 c(i) = 255 Case Else c(i) = k(i) End Select Next 'Вычисление символов из 16-ричного кода шифра (т. е. вывод полученного шифра) For i = 1 To n Select Case c(i) Case Is = 168 v = "YO" Case Is = 198 v = "ZH" Case Is = 214 v = "TS" Case Is = 215 v = "CH" Case Is = 216 v = "SH" Case Is = 217 v = "SCH" Case Is = 222 v = "YU" Case Is = 223 v = "YA" Case Is = 184 v = "yo" Case Is = 230 v = "zh" Case Is = 246 v = "ts" Case Is = 247 v = "ch" Case Is = 248 v = "sh" Case Is = 249 v = "sch" Case Is = 254 v = "yu" Case Is = 255 v = "ya" Case Else v = Chr(c(i)) 'Преобразование 16-ричного кода закодированного текста в знаки латинского транслита End Select code = code & v 'Объединение всех символов латинского транслита в закодированный текст Next End Function Public Function TranslitRu() As String 'Вычисление 16-ричного кода русского транслита For i = 1 To n 'замена 16-ричного кода исходного текста в 16-ричный код русского транслита Select Case k(i) Case Is = 65 c(i) = 192 Case Is = 66 c(i) = 193 Case Is = 67 c(i) = 202 Case Is = 68 c(i) = 196 Case Is = 69 c(i) = 197 Case Is = 70 c(i) = 212 Case Is = 71 c(i) = 195 Case Is = 72 c(i) = 213 Case Is = 73 c(i) = 200 Case Is = 74 c(i) = 74 Case Is = 75 c(i) = 202 Case Is = 76 c(i) = 203 Case Is = 77 c(i) = 204 Case Is = 78 c(i) = 205 Case Is = 79 c(i) = 206 Case Is = 80 c(i) = 207 Case Is = 81 c(i) = 81 Case Is = 82 c(i) = 208 Case Is = 83 c(i) = 209 Case Is = 84 c(i) = 210 Case Is = 85 c(i) = 211 Case Is = 86 c(i) = 194 Case Is = 87 c(i) = 87 Case Is = 88 c(i) = 88 Case Is = 89 c(i) = 201 Case Is = 90 c(i) = 199 Case Is = 97 c(i) = 224 Case Is = 98 c(i) = 225 Case Is = 99 c(i) = 234 Case Is = 100 c(i) = 228 Case Is = 101 c(i) = 229 Case Is = 102 c(i) = 244 Case Is = 103 c(i) = 227 Case Is = 104 c(i) = 245 Case Is = 105 c(i) = 232 Case Is = 106 c(i) = 106 Case Is = 107 c(i) = 234 Case Is = 108 c(i) = 235 Case Is = 109 c(i) = 236 Case Is = 110 c(i) = 237 Case Is = 111 c(i) = 238 Case Is = 112 c(i) = 239 Case Is = 113 c(i) = 113 Case Is = 114 c(i) = 240 Case Is = 115 c(i) = 241 Case Is = 116 c(i) = 242 Case Is = 117 c(i) = 243 Case Is = 118 c(i) = 226 Case Is = 119 c(i) = 119 Case Is = 120 c(i) = 120 Case Is = 121 c(i) = 233 Case Is = 122 c(i) = 231 Case Else c(i) = k(i) End Select 'If k(i) = 67 And k(i + 1) = 72 Then i = i + 1 And c(i) = 214 'If k(i) = 80 And k(i + 1) = 72 Then i = i + 1 And c(i) = 212 'If k(i) = 83 And k(i + 1) = 72 Then i = i + 1 And c(i) = 216 'If k(i) = 84 And k(i + 1) = 72 Then i = i + 1 And c(i) = 199 'If k(i) = 99 And k(i + 1) = 104 Then i = i + 1 And c(i) = 247 'If k(i) = 112 And k(i + 1) = 104 Then i = i + 1 And c(i) = 244 'If k(i) = 115 And k(i + 1) = 104 Then i = i + 1 And c(i) = 248 'If k(i) = 116 And k(i + 1) = 104 Then i = i + 1 And c(i) = 231 Next 'Вычисление символов из 16-ричного кода шифра (т. е. вывод полученного шифра) For i = 1 To n Select Case c(i) Case Is = 74 v = "ДЖ" Case Is = 81 v = "КУ" Case Is = 87 v = "УА" Case Is = 88 v = "КС" Case Is = 106 v = "дж" Case Is = 113 v = "ку" Case Is = 119 v = "уа" Case Is = 120 v = "кс" Case Else v = Chr(c(i)) 'Преобразование 16-ричного кода закодированного текста в знаки закодированного текста End Select code = code & v 'Объединение всех символов закодированного текста в закодированный текст Next End Function Public Function Сipher() As String 'Вычисление 16-ричного кода шифра или шифрование For i = 1 To n 'замена 16-ричного кода исходного текста в 16-ричный код закодириванного текста Select Case k(i) Case Is = 48 c(i) = 231 Case Is = 49 c(i) = 232 Case Is = 50 c(i) = 233 Case Is = 51 c(i) = 234 Case Is = 52 c(i) = 235 Case Is = 53 c(i) = 236 Case Is = 54 c(i) = 237 Case Is = 55 c(i) = 238 Case Is = 56 c(i) = 239 Case Is = 57 c(i) = 174 Case Is = 32 c(i) = 175 Case Is = 58 c(i) = 224 Case Is = 59 c(i) = 225 Case Is = 60 c(i) = 226 Case Is = 61 c(i) = 227 Case Is = 62 c(i) = 228 Case Is = 63 c(i) = 229 Case Is = 64 c(i) = 230 Case Is = 65 c(i) = 241 Case Is = 66 c(i) = 166 Case Is = 67 c(i) = 167 Case Is = 68 c(i) = 168 Case Is = 69 c(i) = 169 Case Is = 70 c(i) = 170 Case Is = 71 c(i) = 171 Case Is = 72 c(i) = 172 Case Is = 73 c(i) = 173 Case Is = 74 c(i) = 157 Case Is = 75 c(i) = 158 Case Is = 76 c(i) = 159 Case Is = 77 c(i) = 160 Case Is = 78 c(i) = 161 Case Is = 79 c(i) = 162 Case Is = 80 c(i) = 163 Case Is = 81 c(i) = 164 Case Is = 82 c(i) = 165 Case Is = 83 c(i) = 148 Case Is = 84 c(i) = 149 Case Is = 85 c(i) = 150 Case Is = 86 c(i) = 151 Case Is = 87 c(i) = 152 Case Is = 88 c(i) = 153 Case Is = 89 c(i) = 154 Case Is = 90 c(i) = 155 Case Is = 91 c(i) = 156 Case Is = 92 c(i) = 139 Case Is = 93 c(i) = 140 Case Is = 94 c(i) = 141 Case Is = 95 c(i) = 142 Case Is = 96 c(i) = 143 Case Is = 97 c(i) = 144 Case Is = 98 c(i) = 145 Case Is = 99 c(i) = 146 Case Is = 100 c(i) = 147 Case Is = 101 c(i) = 131 Case Is = 102 c(i) = 132 Case Is = 103 c(i) = 133 Case Is = 104 c(i) = 240 Case Is = 105 c(i) = 134 Case Is = 106 c(i) = 135 Case Is = 107 c(i) = 136 Case Is = 108 c(i) = 137 Case Is = 109 c(i) = 138 Case Is = 110 c(i) = 42 Case Is = 111 c(i) = 43 Case Is = 112 c(i) = 44 Case Is = 113 c(i) = 45 Case Is = 114 c(i) = 46 Case Is = 115 c(i) = 47 Case Is = 116 c(i) = 128 Case Is = 117 c(i) = 129 Case Is = 118 c(i) = 130 Case Is = 119 c(i) = 33 Case Is = 120 c(i) = 34 Case Is = 121 c(i) = 35 Case Is = 122 c(i) = 36 Case Is = 123 c(i) = 37 Case Is = 124 c(i) = 38 Case Is = 125 c(i) = 39 Case Is = 126 c(i) = 40 Case Is = 127 c(i) = 41 '------------- Case Is = 33 c(i) = 119 Case Is = 34 c(i) = 120 Case Is = 35 c(i) = 121 Case Is = 36 c(i) = 122 Case Is = 37 c(i) = 123 Case Is = 38 c(i) = 124 Case Is = 39 c(i) = 125 Case Is = 40 c(i) = 126 Case Is = 41 c(i) = 127 Case Is = 42 c(i) = 110 Case Is = 43 c(i) = 111 Case Is = 44 c(i) = 112 Case Is = 45 c(i) = 113 Case Is = 46 c(i) = 114 Case Is = 47 c(i) = 115 Case Is = 128 c(i) = 116 Case Is = 129 c(i) = 117 Case Is = 130 c(i) = 118 Case Is = 131 c(i) = 101 Case Is = 132 c(i) = 102 Case Is = 133 c(i) = 103 Case Is = 240 c(i) = 104 Case Is = 134 c(i) = 105 Case Is = 135 c(i) = 106 Case Is = 136 c(i) = 107 Case Is = 137 c(i) = 108 Case Is = 138 c(i) = 109 Case Is = 139 c(i) = 92 Case Is = 140 c(i) = 93 Case Is = 141 c(i) = 94 Case Is = 142 c(i) = 95 Case Is = 143 c(i) = 96 Case Is = 144 c(i) = 97 Case Is = 145 c(i) = 98 Case Is = 146 c(i) = 99 Case Is = 147 c(i) = 100 Case Is = 148 c(i) = 83 Case Is = 149 c(i) = 84 Case Is = 150 c(i) = 85 Case Is = 151 c(i) = 86 Case Is = 152 c(i) = 87 Case Is = 153 c(i) = 88 Case Is = 154 c(i) = 89 Case Is = 155 c(i) = 90 Case Is = 156 c(i) = 91 Case Is = 157 c(i) = 74 Case Is = 158 c(i) = 75 Case Is = 159 c(i) = 76 Case Is = 160 c(i) = 77 Case Is = 161 c(i) = 78 Case Is = 162 c(i) = 79 Case Is = 163 c(i) = 80 Case Is = 164 c(i) = 81 Case Is = 165 c(i) = 82 Case Is = 241 c(i) = 65 Case Is = 166 c(i) = 66 Case Is = 167 c(i) = 67 Case Is = 168 c(i) = 68 Case Is = 169 c(i) = 69 Case Is = 170 c(i) = 70 Case Is = 171 c(i) = 71 Case Is = 172 c(i) = 72 Case Is = 173 c(i) = 73 Case Is = 174 c(i) = 57 Case Is = 175 c(i) = 32 Case Is = 224 c(i) = 58 Case Is = 225 c(i) = 59 Case Is = 226 c(i) = 60 Case Is = 227 c(i) = 61 Case Is = 228 c(i) = 62 Case Is = 229 c(i) = 63 Case Is = 230 c(i) = 64 Case Is = 231 c(i) = 48 Case Is = 232 c(i) = 49 Case Is = 233 c(i) = 50 Case Is = 234 c(i) = 51 Case Is = 235 c(i) = 52 Case Is = 236 c(i) = 53 Case Is = 237 c(i) = 54 Case Is = 238 c(i) = 55 Case Is = 239 c(i) = 56 '------------ Case Is = 1 c(i) = 255 Case Is = 2 c(i) = 31 Case Is = 3 c(i) = 30 Case Is = 4 c(i) = 29 Case Is = 5 c(i) = 28 Case Is = 6 c(i) = 27 Case Is = 7 c(i) = 26 Case Is = 8 c(i) = 25 Case Is = 9 c(i) = 24 Case Is = 10 c(i) = 23 Case Is = 11 c(i) = 22 Case Is = 12 c(i) = 21 Case Is = 13 c(i) = 20 Case Is = 14 c(i) = 19 Case Is = 15 c(i) = 18 Case Is = 16 c(i) = 17 Case Is = 17 c(i) = 16 Case Is = 18 c(i) = 15 Case Is = 19 c(i) = 14 Case Is = 20 c(i) = 13 Case Is = 21 c(i) = 12 Case Is = 22 c(i) = 11 Case Is = 23 c(i) = 10 Case Is = 24 c(i) = 9 Case Is = 25 c(i) = 8 Case Is = 26 c(i) = 7 Case Is = 27 c(i) = 6 Case Is = 28 c(i) = 5 Case Is = 29 c(i) = 4 Case Is = 30 c(i) = 3 Case Is = 31 c(i) = 2 Case Is = 255 c(i) = 1 Case Else c(i) = k(i) End Select Next End Function