source: trunk/CrypPlugins/Trivium/TriviumSettings.cs @ 1778

Last change on this file since 1778 was 1042, checked in by Sören Rinne, 12 years ago
  • bugfixing
  • replaced all licenses with the short version
File size: 4.5 KB
Line 
1/*
2   Copyright 2009 Sören Rinne, Ruhr-Universität Bochum, Germany
3
4   Licensed under the Apache License, Version 2.0 (the "License");
5   you may not use this file except in compliance with the License.
6   You may obtain a copy of the License at
7
8       http://www.apache.org/licenses/LICENSE-2.0
9
10   Unless required by applicable law or agreed to in writing, software
11   distributed under the License is distributed on an "AS IS" BASIS,
12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   See the License for the specific language governing permissions and
14   limitations under the License.
15*/
16
17using System;
18using System.Collections.Generic;
19using System.Linq;
20using System.Text;
21
22using System.IO;
23using System.Security.Cryptography;
24using Cryptool.PluginBase;
25using System.ComponentModel;
26using Cryptool.PluginBase.Cryptography;
27using Cryptool.PluginBase.IO;
28using System.Runtime.CompilerServices;
29using Cryptool.PluginBase.Miscellaneous;
30using System.Runtime.Remoting.Contexts;
31
32namespace Cryptool.Trivium
33{
34    public class TriviumSettings : ISettings
35    {
36        #region ISettings Members
37
38        private bool hasChanges = false;
39
40        private int keystreamLength = 32;
41        [TaskPane("Length of keystream", "How many bits of keystream in bits should be generated? Must be a multiple of 32.", null, 0, false, DisplayLevel.Beginner, ControlType.NumericUpDown, ValidationType.RangeInteger, 0, int.MaxValue)]
42        public int KeystreamLength
43        {
44            get { return this.keystreamLength; }
45            set
46            {
47                this.keystreamLength = value;
48                //OnPropertyChanged("KeystreamLength");
49                HasChanges = true;
50            }
51        }
52
53        private int initRounds = 1152;
54        [TaskPane("Initialization rounds", "How many init rounds should be done? Default is 1152.", null, 1, false, DisplayLevel.Beginner, ControlType.NumericUpDown, ValidationType.RangeInteger, 0, int.MaxValue)]
55        public int InitRounds
56        {
57            get { return this.initRounds; }
58            set
59            {
60                this.initRounds = value;
61                //OnPropertyChanged("InitRounds");
62                HasChanges = true;
63            }
64        }
65
66        private bool useByteSwapping = false;
67        [ContextMenu("Use byte swapping", "With this checkbox enabled, output bytes will be swapped.", 1, DisplayLevel.Experienced, ContextMenuControlType.CheckBox, null, new string[] { "Use byte swapping?" })]
68        [TaskPane("Use byte swapping", "With this checkbox enabled, output bytes will be swapped.", null, 2, false, DisplayLevel.Beginner, ControlType.CheckBox, "", null)]
69        public bool UseByteSwapping
70        {
71            get { return this.useByteSwapping; }
72            set
73            {
74                this.useByteSwapping = (bool)value;
75                //OnPropertyChanged("UseByteSwapping");
76                HasChanges = true;
77            }
78        }
79
80        private bool hexOutput = false;
81        [ContextMenu("Generate Hex output", "With this checkbox enabled, output bytes will be displayed in hex.", 2, DisplayLevel.Experienced, ContextMenuControlType.CheckBox, null, new string[] { "Display as hex?" })]
82        [TaskPane("Generate Hex output", "With this checkbox enabled, output bytes will be displayed in hex.", null, 3, false, DisplayLevel.Beginner, ControlType.CheckBox, "", null)]
83        public bool HexOutput
84        {
85            get { return this.hexOutput; }
86            set
87            {
88                this.hexOutput = (bool)value;
89                //OnPropertyChanged("HexOutput");
90                HasChanges = true;
91            }
92        }
93
94        private string inputKey = string.Empty;
95        [TaskPane("Key (Input for Cube Attack)", "Must be 10 bytes (80 bit) in Hex", null, 4, false, DisplayLevel.Beginner, ControlType.TextBox, null)]
96        public string InputKey
97        {
98            get { return inputKey; }
99            set
100            {
101                this.inputKey = value;
102                //OnPropertyChanged("InputKey");
103                HasChanges = true;
104            }
105        }
106
107        public bool HasChanges
108        {
109            get { return hasChanges; }
110            set { hasChanges = value; }
111        }
112
113        #endregion
114
115        #region INotifyPropertyChanged Members
116
117        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
118
119        #endregion
120    }
121}
Note: See TracBrowser for help on using the repository browser.