source: trunk/CrypPluginBase/Control/KeyTranslator.cs @ 2143

Last change on this file since 2143 was 2143, checked in by Sven Rech, 11 years ago

recomitted the keysearcher OpenCL optimization changes (hopefully this will work now...)

File size: 3.3 KB
Line 
1/*                             
2   Copyright 2010 Sven Rech (svenrech at googlemail dot com), Uni Duisburg-Essen
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
22namespace Cryptool.PluginBase.Control
23{
24    public interface IKeyTranslator
25    {
26        /// <summary>
27        /// This method returns the byte array key which is represented by the given parameter string.
28        /// This method is completely stateless.
29        /// </summary>
30        /// <param name="representation"></param>
31        /// <returns></returns>
32        byte[] GetKeyFromRepresentation(string representation);
33
34        /// <summary>
35        /// The parameter "keys" determines the keys this KeyTranslator should iterate over.
36        /// The parameter is almost always a KeyPattern.
37        /// </summary>
38        /// <param name="keys">The keys</param>
39        void SetKeys(object keys);
40
41        /// <summary>
42        /// Returns the current key as an array.
43        /// </summary>
44        /// <returns>current key</returns>
45        byte[] GetKey();
46
47        /// <summary>
48        ///  This is used for iterating over the keys.
49        /// </summary>
50        /// <returns>if there are keys left</returns>
51        bool NextKey();
52
53        /// <summary>
54        /// Returns the string representation of the current key.
55        /// </summary>
56        /// <returns>string representation of the current key</returns>
57        string GetKeyRepresentation();
58
59        string GetKeyRepresentation(int add);
60
61        /// <summary>
62        /// Returns the amount of keys that where given by the "nextKey()" method after "getProgress()" was called last time.
63        /// This method should have the side-effect, that the progress is synchronized with the underlying keypattern.
64        /// This is important, because the synchronization is necessary for splitting the keypattern.
65        /// </summary>
66        /// <returns>The progress</returns>
67        int GetProgress();
68
69        /// <summary>
70        /// This method modifies the given OpenCL code, so that the returning code includes
71        /// the key movement stuff.
72        /// </summary>
73        /// <param name="code"></param>
74        /// <param name="approximateNumberOfKeys"></param>
75        /// <returns></returns>
76        string ModifyOpenCLCode(string code, int approximateNumberOfKeys);
77
78        /// <summary>
79        /// Like "NextKey()", but jumps over a whole key batch that can be processed by the generated OpenCL code
80        /// in one step.
81        /// </summary>
82        /// <returns></returns>
83        bool NextOpenCLBatch();
84
85        /// <summary>
86        /// Gets the opencl batch size.
87        /// </summary>
88        /// <returns></returns>
89        int GetOpenCLBatchSize();
90    }
91}
Note: See TracBrowser for help on using the repository browser.