Changeset 801 for trunk/CrypPlugins/Transposition/Transposition.cs
 Timestamp:
 Oct 29, 2009, 11:00:54 PM (12 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/CrypPlugins/Transposition/Transposition.cs
r796 r801 25 25 private TranspositionSettings settings; 26 26 27 private char[,] read_in_matrix; 28 private char[,] permuted_matrix; 27 29 # endregion 28 30 … … 37 39 set { this.settings = (TranspositionSettings)value; } 38 40 } 41 42 # region getter methods 43 44 public char[,] Read_in_matrix 45 { 46 get 47 { 48 return read_in_matrix; 49 } 50 } 51 52 public char[,] Permuted_matrix 53 { 54 get 55 { 56 return permuted_matrix; 57 } 58 } 59 # endregion 39 60 40 61 # region Properties … … 203 224 { 204 225 String encrypted = ""; 205 char[,] matrix = null;206 226 207 227 if (((TranspositionSettings.PermutationMode)settings.Permutation).Equals(TranspositionSettings.PermutationMode.byRow)) … … 210 230 { 211 231 case TranspositionSettings.ReadInMode.byRow: 212 232 read_in_matrix = enc_read_in_by_row_if_row_perm(input, key.Length); break; 213 233 case TranspositionSettings.ReadInMode.byColumn: 214 matrix = enc_read_in_by_column_if_row_perm(input, key.Length); break;234 read_in_matrix = enc_read_in_by_column_if_row_perm(input, key.Length); break; 215 235 default: 216 236 break; 217 237 } 218 238 219 matrix = enc_permute_by_row(matrix, key);239 permuted_matrix = enc_permute_by_row(read_in_matrix, key); 220 240 221 241 switch ((TranspositionSettings.ReadOutMode)settings.ReadOut) 222 242 { 223 243 case TranspositionSettings.ReadOutMode.byRow: 224 encrypted = read_out_by_row_if_row_perm( matrix, key.Length); break;244 encrypted = read_out_by_row_if_row_perm(permuted_matrix, key.Length); break; 225 245 case TranspositionSettings.ReadOutMode.byColumn: 226 encrypted = read_out_by_column_if_row_perm( matrix, key.Length); break;246 encrypted = read_out_by_column_if_row_perm(permuted_matrix, key.Length); break; 227 247 default: 228 248 break; … … 236 256 { 237 257 case TranspositionSettings.ReadInMode.byRow: 238 matrix = enc_read_in_by_row(input, key.Length); break;258 read_in_matrix = enc_read_in_by_row(input, key.Length); break; 239 259 case TranspositionSettings.ReadInMode.byColumn: 240 matrix = enc_read_in_by_column(input, key.Length); break;260 read_in_matrix = enc_read_in_by_column(input, key.Length); break; 241 261 default: 242 262 break; 243 263 } 244 264 245 matrix = enc_permut_by_column(matrix, key);265 permuted_matrix = enc_permut_by_column(read_in_matrix, key); 246 266 247 267 switch ((TranspositionSettings.ReadOutMode)settings.ReadOut) 248 268 { 249 269 case TranspositionSettings.ReadOutMode.byRow: 250 encrypted = read_out_by_row( matrix, key.Length); break;270 encrypted = read_out_by_row(permuted_matrix, key.Length); break; 251 271 case TranspositionSettings.ReadOutMode.byColumn: 252 encrypted = read_out_by_column( matrix, key.Length); break;272 encrypted = read_out_by_column(permuted_matrix, key.Length); break; 253 273 default: 254 274 break; … … 277 297 if (is_Valid_Keyword(key)) 278 298 { 279 char[,] matrix = null;280 299 String decrypted = ""; 281 300 if (((TranspositionSettings.PermutationMode)settings.Permutation).Equals(TranspositionSettings.PermutationMode.byRow)) … … 284 303 { 285 304 case TranspositionSettings.ReadOutMode.byRow: 286 matrix = dec_read_in_by_row_if_row_perm(input, key); break;305 read_in_matrix = dec_read_in_by_row_if_row_perm(input, key); break; 287 306 case TranspositionSettings.ReadOutMode.byColumn: 288 matrix = dec_read_in_by_column_if_row_perm(input, key); break;307 read_in_matrix = dec_read_in_by_column_if_row_perm(input, key); break; 289 308 default: 290 309 break; 291 310 } 292 311 293 matrix = dec_permut_by_row(matrix, key);312 permuted_matrix = dec_permut_by_row(read_in_matrix, key); 294 313 295 314 switch ((TranspositionSettings.ReadInMode)settings.ReadIn) 296 315 { 297 316 case TranspositionSettings.ReadInMode.byRow: 298 decrypted = read_out_by_row_if_row_perm( matrix, key.Length); break;317 decrypted = read_out_by_row_if_row_perm(permuted_matrix, key.Length); break; 299 318 case TranspositionSettings.ReadInMode.byColumn: 300 decrypted = read_out_by_column_if_row_perm( matrix, key.Length); break;319 decrypted = read_out_by_column_if_row_perm(permuted_matrix, key.Length); break; 301 320 default: 302 321 break; … … 310 329 { 311 330 case TranspositionSettings.ReadOutMode.byRow: 312 matrix = dec_read_in_by_row(input, key); break;331 read_in_matrix = dec_read_in_by_row(input, key); break; 313 332 case TranspositionSettings.ReadOutMode.byColumn: 314 matrix = dec_read_in_by_column(input, key); break;333 read_in_matrix = dec_read_in_by_column(input, key); break; 315 334 default: 316 335 break; 317 336 } 318 319 matrix = dec_permut_by_column(matrix, key);337 338 permuted_matrix = dec_permut_by_column(read_in_matrix, key); 320 339 321 340 switch ((TranspositionSettings.ReadInMode)settings.ReadIn) 322 341 { 323 342 case TranspositionSettings.ReadInMode.byRow: 324 decrypted = read_out_by_row( matrix, key.Length); break;343 decrypted = read_out_by_row(permuted_matrix, key.Length); break; 325 344 case TranspositionSettings.ReadInMode.byColumn: 326 decrypted = read_out_by_column( matrix, key.Length); break;345 decrypted = read_out_by_column(permuted_matrix, key.Length); break; 327 346 default: 328 347 break;
Note: See TracChangeset
for help on using the changeset viewer.