Abstract:
A method and apparatus for authentication of data includes inputting of data into a first layer of a hashing function for rotation based hashing, then inputting results from the first layer to a second layer of the hashing function for substitution based hashing. Feedback is provided from the second layer to the first layer and digests are output from the first and second layers.

Description:
BACKGROUND OF THE INVENTION  
         [0001]    1. Field of the Invention  
           [0002]    The present invention relates to data security, and more particularly to authentication of data. Data may need to be authenticated, for example, for securing it against attacks during transmission or transportation over a data network. Authentication may also be required when data is stored in a database that is accessible by users who may not be authorized to access the data.  
           [0003]    2. Description of the Related Art  
           [0004]    Data security can be provided by means of encryption and ciphering. The purpose of these functions is to shield data so that unauthorized users cannot read the content of the data. Another security feature is known as authentication. The authentication functions are for verifying that the data is authentic, for example, that the data is correct and has not been altered by unauthorized parties.  
           [0005]    Authentication can be provided, for example, by means of hashing. The hashing may sometimes be referred to by the term signing. A hash function generates an output known as the digests. The results, i.e. the digests, can then be used to authenticate data. In a possible operation, a sender of data uses a hash function to generate data-related digests. The digests are then sent along with the data. Before using the data, a receiver may then first authenticate it based on the digest. That is, the receiver ensures that the received data is correct. In order to do so, the receiver may use the same hash function as the sender to hash the data and to get the data-related digests. The receiver may then compare the hashed digests with the received digests. If they are the same, then data is correct.  
           [0006]    Hash functions are used in various applications. For example, hashing can be used to authenticate data in communication and to generate session keys. Another example is the use of hashing to hash a password. The digests may be used such that in the login the system, for example a computer or a network, hashes the password and compares the digests with the digests stored in the system. Even if an attacker could catch the digests, the attacker would still need to find a way to break the digests.  
           [0007]    Examples of conventional hashing algorithms include various versions of algorithms known by the names SHA and MD5. Both MD5 and SHA hash messages to produce message related digests. The conventional hash functions only support a fixed length of digest. For example, SHA-1 can only generate a 160-bit digest. One SHA-2 implementation can only generate a 256-bit digest, a 384-bit digest or a 512-bit digest. That is, an SHA-2 implementation can still generate only a fixed length digest.  
           [0008]    A number of data processing applications use SHA-1 as the authentication function. Should the SHA-1 be broken into by an attacker, then all of those applications would need to be updated or even re-implemented. This may cause a lot of trouble. An entirely new authentication implementation may be needed, including a lot of coding and debugging. The hash functions are typically categorised as security issues, and thus new codes cannot usually be downloaded from open networks or from free areas, as there is a risk, for example, that the code contains “Backdoors”. Furthermore, a variety of platforms exists and the coding has to be platform-specific. Finally, the new hash implementation has to be installed. The installation may need to be done in a number of locations. User may need to be trained for the new hash functions, and so on.  
           [0009]    This extensive amount of extra work might be avoided were it possible to extend the digest. Extendable digests might be useful since it might enable addressing the situation where the initial short digest is broken by extending the initial digests rather than updating or replacing the entire algorithm.  
         SUMMARY OF THE INVENTION  
         [0010]    According to one aspect of the present invention, there is provided a method for authentication of data, the method comprises inputting data into a first layer of a hashing function for rotation based hashing, then inputting results from the first layer to a second layer of the hashing function for substitution based hashing. This embodiment of the invention then includes providing feedback from the second layer to the first layer, and outputting digests from the first and second layers.  
           [0011]    According to another aspect of the present invention there is provided a data processing device configured to execute a data authentication procedure. The data processing device comprises data processing means configured to provide a hashing function, the hashing function being divided into hashing layers such that a first layer is for rotation based hashing and a second layer is for substitution based hashing. The first layer comprises first input for receiving data to be processed, a second input for receiving data from the second layer, a first output for outputting digests and a second output for communication of data to the second layer. The second layer comprises a third input for receiving data from the first layer, a third output for outputting digests and a fourth output for communication of data to the first layer.  
           [0012]    In more detailed embodiments, Fast Fourier Transform may be applied on the data at the first layer. Substitution may be applied at the second layer on data received from the first layer.  
           [0013]    The length of the digest produced by the hashing function may be changed by reconfiguring the hashing function. The reconfiguration may comprise changing the number of digests.  
           [0014]    The embodiments of the invention may provide a feasible manner to extend the length of a digest. The extension may not require substantially more processing capacity. The embodiments may enable stream like hashing of individual words instead of hashing entire messages. 
       
    
    
     BRIEF DESCRIPTION OF DRAWINGS  
       [0015]    For better understanding of the present invention, reference will now be made by way of example to the accompanying drawings, in which:  
         [0016]    [0016]FIG. 1 shows one embodiment of the present invention;  
         [0017]    [0017]FIGS. 2 a  and  2   b  show a cyclical hashing arrangement in accordance with an embodiment; and  
         [0018]    [0018]FIG. 3 is a flowchart illustrating the operation of one embodiment of the present invention. 
     
    
     DESCRIPTION OF PREFERRED EMBODIMENTS  
       [0019]    One example of a preferred data authentication algorithm will be referenced to in the following as the Cyclically Closed Chain Hash Algorithm (CCCHA). The algorithm is denominated ‘Cyclically Closed Chain Hash Algorithm’ since the basic structure of the hashing algorithm is cyclically closed, i.e. looped. FIG. 1 shows a possible layered design for implementation of such cyclically closed algorithm in accordance with the present invention.  
         [0020]    Unlike conventional block-based hash functions, the CCCHA can be described as being a word or stream-based hash function. That is, each word of a message may be signed individually. Each word of the message may also be sequentially processed. Thus, unlike the block-based hashes, the input may be treated as a sequence of words.  
         [0021]    The hashing is cyclically closed, i.e. looped. The loop starts from a group of constant numbers and also ends at the same constant numbers. Thus, the hash is closed from a predictable start to a predictable end. A purpose of this is to enhance the predictability. This is believed to be advantageous since the attackers cannot change the beginning and the end of the cycle.  
         [0022]    [0022]FIG. 1 shows in more detail how hashing can be divided into two layers  1  and  2  and how digests may be collected from layers  1  and  2 . FIGS. 2 a  and  2   b  show the three-dimensional architecture of the closed cycles.  
         [0023]    As shown in FIGS. 1 and 2 a , the hashing may be provided on two layers  1  and  2  to hash each word in the stream of words. The words may be input sequentially into the hashing function. The input  10  is first be processed at layer  1 . The hashing on layer  1  may be based on any rotational hash, such as rotational FFT-like (Fast Fourier Transform) hash. Use of FFT-like methods on layer  1  makes it difficult for an attacker to predict the output from the input of layer  1 .  
         [0024]    However, FFT alone is weak against attacks that are based on retransformation, i.e. predicting input from the output. A retransformation exists for each transformation, and therefore the FFT is vulnerable for attacks as a collision is possible to be predicted from the digests. For example, this may be done by finding a collision in f-domain and inverting back through retransformation.  
         [0025]    The output of layer  1  is then taken as input at layer  2 , at step  104 . Layer  2  uses a substitution based hash which makes it difficult for an attacker to predict the input from the output of layer  2 . Therefore the substitution can be used to close the possibility of retransformation. However, substitution alone is weak against attacks that are based on differential cryptanalysis, i.e. predicting the output from the input.  
         [0026]    In the shown embodiment layers  1  and  2  provide a mutual i.e. integrated protection against these weaknesses by means of the input of results from layer  1  to layer  22  and the subsequent feedback arrangement from layer  2  to layer  1 . The purpose of using the layers is to hide the weaknesses of the hashing methods in the middle of the model. This means that the attackers face the strong points of these two methods.  
         [0027]    However, use of layers alone may not be enough. Even when hidden in the middle of the model, the weaknesses may still settle at a fixed point. An attacker may try to indirectly attack those weaknesses. The purpose of the cyclical design is to move the weaknesses from the fixed points and to distribute them evenly. These cycles will be called in the following as rings. In this regards an analogy can be drawn to a rotating log which is much more difficult to attack than a static log.  
         [0028]    The rotational closed rings can be used to spread any of deviations caused by some distorted words to all parts of the digests through the closed rings. A further purpose of the rings is to hash each word in a distributed manner so that the input can always be a single word in each time while the final output is block-like.  
         [0029]    The distribution of the points around the word may be accomplished by calculating two closed rings. Two such rotating rings  3  and  4  are shown in FIG. 2 b . One of the rings may be from the beginning to the end of a message or any other string of words. The other ring may then be for each word itself. The two closed rings can be used to generate integrated digests. Digests may then be obtained from the points on the two closed rings.  
         [0030]    A larger diameter of the rings provides more points and hence may generate a longer digest. The calculations may become more straightforward since the messages may be treated as word streams.  
         [0031]    In the example of FIG. 2 b , the ring  3  is shown to be horizontal. The other ring  4  is shown to be vertical. As shown in FIG. 2 a , the vertical ring  4  rotates such that it provides input  5  for layer  2  by from layer  1  to layer  2  and then feeds back results  6  of layer  2  hashing to layer  1 . The horizontal ring associates with layer  1 , i.e. may only be applied to data at layer  1 . The horizontal ring  3  may be designed to mainly perform a rotation-based addition.  
         [0032]    More particularly, and as shown in FIG. 3, user data  10 , w i−1 , is input into layer  1  at step  100  for hashing at step  102 . At least some of the hashed results  5  of layer  1  are then input into layer  2  at step  104 . The hashed results  6  of layer  2  are oppositely feedback to layer  1  at step  106 . This forms the vertically closed ring  4  between the two layers  1  and  2 . Meanwhile, the horizontally closed ring  3  is constructed by calculating X i  with Y i−1 , calculating Y i  with Z i−1  and calculating Z i  with X i−1 . Since the horizontal ring  3  offsets its bit order, the whole space is rotating. A more detailed example of possible calculations is given later.  
         [0033]    As shown in FIGS. 1 and 2 a , both layers provide digests  7  and  8  at the output  30 , see also steps  108  and  110  of FIG. 3.  
         [0034]    Layer  1  may be configured to mainly take rotation and summation operations, such as an FFT-like (Fast Fourier Transformation) hash. For example, Fast Fourier Transformation, X(m)=Σx(n)R mn  could be used and compared with ΣRotation (A) (X(n)). It shall be appreciated that the rotation functions applied in layer  1  can be much more complicated than a simple rotation used in the FFT.  
         [0035]    Layer  2 , in turn, may use a substitution-based hash. The purpose of layer  2  is preferably to cut off the possibility that a collision is predictable from the retransformation.  
         [0036]    Functions Rotation (A)  and Rotation (B)  are shown in layer  1  and a mapping function (M) is shown on layer  2 . Because of inconsistent rotations, finding differential relations among X, Y and Z becomes very difficult. This is because the different functions belong to different layers.  
         [0037]    The following is a more detailed example of the possible computations. As mentioned above, the message to be processed is treated as a word stream. Thus, a message can be seen as w 0 , . . . , w n−1 . Each word has a fixed length of w bits. In 32/64-bit system, this would mean w=32/64 bits, respectively. The length of messages can be the multiple of w. Hence message padding maximally adds w/8-1 bytes. Like in conventional hash functions, the first bit of padding may be set to ‘1’and the rest can be set to ‘0’. Some additional padding may be required. Two words may be used to record the bit length of messages. This implies that the maximal length of messages is 2 2w  bits. For example, if the message is “123” then the bit length of the message would be 24 bits. After this two words of pre-defined constant numbers may be padded.  
         [0038]    The hash starts from a group of pre-defined constant numbers. H t  is assigned to the constant numbers in the initial time. The above mentioned last two words of padded messages are pre-defined constant numbers. The hash will then also end by hashing two constant numbers. Thus, a closed chain along the direction of the word stream is constructed as the chain is closed at these constant/static numbers. Two closed rings is then used to hash each word.  
         [0039]    Two basic functions are used for the hashing, rotation-based addition and mapping. The addition utilizes cycle-offset functions, which can be defined as  
           ROTL   n ( x )=( x&lt;&lt;n )         ( x&gt;&gt; ( w−n ))  
         [0040]    Or  
           ROTR   n ( x )=( x&gt;&gt;n )         ( x&lt;&lt; ( w−n )),  
         [0041]    where 0≦n≦w, and  
         [0042]    [0042]          denotes bitwise OR.  
         [0043]    These two cycle-offset functions are used to construct two rotation-based addition functions, namely  
         [0044]    Rotation (A) (x), and  
         [0045]    Rotation (B) (x).  
         [0046]    When w=32 bits, Rotation (A) (x) and Rotation (B) (x) can respectively be defined as  
           Rotation   (A) ( x )= x+ROTL   9 ( x )+ ROTL   21 ( x )+ ROTL   31 ( x           0 x 030  ROTR   9 ( x )+ ROTR   21 ( x )+ ROTR   30 ( x           0 x 30303030).  
           Rotation   (B) ( x )= x+ROTL   10 ( x )+ ROTL   19 ( x )+ ROTL   29 ( x           0 x 07  ROTR   10 ( x )+ ROTR   19 ( x )+ ROTR   29 ( x           0 x 70707070).  
         [0047]    In the above equitation           denotes bitwise AND.  
         [0048]    When w=64 bits, Rotation (A) (x) and Rotation (B) (x) can be defined as  
           Rotation   (A) ( x )= x+ROTL   9 ( x )+ ROTL   21 ( x )+ ROTL   30 ( x )+ ROTL   36 ( x )+ ROTL   41 ( x )+ ROTL   48 ( x )+ ROTL   60 ( x           0 x 0 f 0 f 0 f 0 f 0 f 0 f 0 f 0 f 0 f )+ ROTR   9 ( x )&#39; ROTR   21 ( x )+ ROTR   30 ( x )+ROTR 36 ( x )+ ROTR   41 ( x )+ ROTR   48 ( x )+ ROTR   60 ( x           0 xf 0 f 0 f 0 f 0 f 0 f 0 f 0 f 0)  
           Rotation   (B) ( x )= x+ROTL   10 ( x )+ ROTL   19 ( x )+ ROTL   29 ( x )+ ROTL   35 ( x )+ ROTL   40 ( x )+ ROTL   47 ( x )+ ROTL   59 ( x           0 x 1 f 1 f 1 f 1 f 1 f 1 f 1 f 1 f )+ROTR 10 ( x )+ ROTR   19 ( x )+ ROTR   29 ( x )+ ROTR   35 ( x )+ ROTR   40 ( x )+ ROTR   47 ( x )+ ROTR   59 ( x           0 xf 1 f 1 f 1 f 1 f 1 f 1 f 1 f 1)  
         [0049]    The mapping functions are defined in such a way that an 8-bit value or two 8-bit (i.e., a 16-bit value but used as two 8-bit values) values is substituted by an entry value of either S 1  or S 2 , respectively. For example, if one considers an 8-bit value v 8  and two of 8-bit values v 8(0)  and v 8(1) , then substitution value s 8 =S 1 [v 8 ] and s 16 =S 2 [v 8(0) +v 8(1) ]. A w-size variable may firstly be converted into 8-bit stream and then substituted by S 1  or S 2  with the above logic. For example, s 8  may be used when w=32 bits and s 16  when w=64 bits. in other words, a 64-bit word may be substituted by 4 of s 16  values and a 32-bit word may be substituted by 4 of s 8  values.  
         [0050]    The hashing algorithm hashes each word of a message. The results are then directly put into the digest. In the other words, instead of block-based hash, a stream-based hash is performed. In hashing each word, operations are divided into two parts i.e. the layers explained above. Layer  1  forms a rotation-based hash and layer  2  forms a substitution-based hash.  
         [0051]    The basic logic of the layers  1  and  2  of this example is as follows. Set three variables X, Y and Z. Also, set two loop variables i and j that respectively range from 1 to n and from 1 to w−1. Three or four working variables A, B, C and D and a temporary variable T are also needed. X, Y and Z are assigned to the constant numbers in the initial time.  
         [0052]    Layer  1 :  
         T=X  
           X=Y+ROTL   j ( w   i−1 )  
         
       Y=Z+w 
       i−1  
     
         
       Z=T+w 
       i−1  
     
           A=Rotation   (A) ( X )  
           B=Rotation   (B) ( Y )  
         [0053]    Layer  2  (for Digest Lengths of 160 to 224 and 384 to 448):  
           A=Map ( A )  
           B=Map ( B )  
           C=Map ( w   i−1 ⊕( A+B ))  
           D=Map ( w   i−1   ⊕B )  
         [0054]    Layer  2  for digest lengths of 256 to 352 would be otherwise the same except that  
           C=Map ( w   i−1   ⊕A ), and  
         [0055]    D is not calculated.  
         [0056]    The calculations for generation of the digest may take a bit different logic, depending on the length of the digest. Four different exemplifying logics are described below.  
         [0057]    Digest length 160-to-224 (in the following CCCHA 160-to-224) may be processed based on the 32-bit system. 160-bit, 192-bit, 224-bit digests may be generated. The generation of digests is shown below.  
         
       H 
       0 
       =H 
       0 
       +A  
     
         
       H 
       1 
       =H 
       1 
       +B  
     
         
       H 
       2 
       =H 
       2 
       +C  
     
           H   3   =H   3 +(           A )⊕(           B )⊕(           C )  
         [0058]    Note: substituted results are feed back at this stage  
           X=H   4   =X⊕ROTL   12 ( A+B )  
           Y=H   5   =Y⊕ROTL   12 ( B+C )  
           Z=H   6   =Z⊕ROTL   12 ( C+A )  
         [0059]    After hashing all the words in stream w 0 , . . . , w n−1 , the final outputs of digest follow the list below.  
         [0060]    CCCHA-160: H 0 , H 1 , H 2 , H 4 , H 5    
         [0061]    CCCHA-192: H 0 , H 1 , H 2 , H 4 , H 5 , H 6    
         [0062]    CCCHA-224: H 0 , H 1 , H 2 , H 3 , H 4 , H 5 , H 6    
         [0063]    Raw ciphertext corresponding to w i  (notice the next one to w i−1 , which is being hashed) can be generated by  
           ciphertext   i   =ciphertext   i−1 +(( A+B+C )⊕ w   i )+ H   3    
         [0064]    Note that the ciphertext −1  may be assigned to a constant number in the initial time. The generation and use of the ciphertext will be described in more detail later in this specification.  
         [0065]    CCCHA-256-to-352 can generate 256-bit, 288-bit, 320-bit and 352-bit digests. The generation of the digests is shown below.  
         
       H 
       0 
       =H 
       0 
       +A  
     
         
       H 
       1 
       =H 
       1 
       +B  
     
         
       H 
       2 
       =H 
       2 
       +C  
     
         
       H 
       3 
       =H 
       3 
       +D  
     
           H   4   =H   4 +( A⊕D )  
           H   5   =H   5 +( B⊕C )  
           H   6   =H   6 +( A ⊕(           C ))+( B⊕ (           D ))  
           X=H   7   =X⊕ROTL   12 ( A+B+C )  
           Y=H   8   =Y⊕ROTL   12 ( B+C+D )  
           Z=H   9   =Z⊕ROTL   12 ( C+D+A )  
         
       H 
       10 
       =X+Y+Z  
     
         [0066]    After hashing, outputs of the digests follow the list below.  
         [0067]    CCCHA-256: H 0 , H 1 , H 2 , H 3 , H 6 , H 7 , H 8 , H 9    
         [0068]    CCCHA-288: H 0 , H 1 , H 2 , H 3 , H 4 , H 6 , H 7 , H 8 , H 9    
         [0069]    CCCHA-320: H 0 , H 1 , H 2 , H 3 , H 4 , H 5 , H 6 , H 7 , H 8 , H 9    
         [0070]    CCCHA-352: H 0 , H 1 , H 2 , H 3 , H 4 , H 5 , H 6 , H 7 , H 8 , H 9 , H 10    
         [0071]    Raw ciphertext corresponding to w i  can be generated by  
           ciphertext   i   =ciphertext   i−1 +(( A+B+C+D )⊕ w   i )+ H   6    
         [0072]    CCCHA-384-to-448 takes similar logic as CCCHA-160-to-224. The difference is that the former is based on 64-bit system and that  
           X=H   4   =X⊕ROTL   20 ( A+B )  
           Y=H   5   =Y⊕ROTL   20 ( B+C )  
           Z=H   6   =Z⊕ROTL   20 ( C+A ).  
         [0073]    Output orders are listed below.  
         [0074]    CCCHA-384: H 0 , H 1 , H 2 , H 4 , H 5 , H 6 .  
         [0075]    CCCHA-448: H 0 , H 1 , H 2 , H 3 , H 4 , H 5 , H 6 .  
         [0076]    Raw ciphertext corresponding to w i  can be generated by  
           ciphertext   i   =ciphertext   i−1 +(( A+B+C )⊕w i )+ H   3    
         [0077]    CCCHA-512-to-640 takes similar logic as CCCHA-256-to-352. The difference is that the former is based on 64-bit system and unlike CCCHA-250-to-352, it does not need to calculate H 10 =X+Y+Z. Also,  
           X=H   7   =X⊕ROTL   20 ( A+B+C )  
           Y=H   8   =Y⊕ROTL   20 ( B+C+D )  
           Z=H   9   =Z⊕ROTL   20 ( C+D+A ).  
         [0078]    The output orders are listed below.  
         [0079]    CCCHA-512: H 0 , H 1 , H 2 , H 3 , H 6 , H 7 , H 8 , H 9 .  
         [0080]    CCCHA-576: H 0 , H 1 , H 2 , H 3 , H 4 , H 6 , H 7 , H 8 , H 9 .  
         [0081]    CCCHA-640: H 0 , H 1 , H 2 , H 3 , H 4 , H 5 , H 6 , H 7 , H 8 , H 9 .  
         [0082]    Raw ciphertext corresponding to w i  can be generated by  
           ciphertext   i   =ciphertext   i−1 +(( A+B+C+D )⊕ w   i )+ H   6    
         [0083]    As the inputs are mixed, the hashed results on each word are evenly distributed on the closed rings. Therefore, all points on the closed rings can be output as a part of the digests. If we use the CCCHA-160-to-224 above as an example, six independent points X, Y, Z, A, B and C would result. In addition, intersections of A, B and C can be used as extensions. The other applications, such as CCCHA-256-to-352 and so on provide even more intersections that can be used as extensions.  
         [0084]    Even when intersections of A, B and C are used as extensions, some potential extension capacity is still available because more intersections can be used as extension. For example, in CCCHA-160-to-224, the intersections of A, B and C are only used. It is possible to utilize the intersections of AB, BC and CA as well as the intersections among X, Y and Z as extensions.  
         [0085]    Use of closed rings makes extension of the digest possible by simply changing the configuration of the rings. That is, different lengths of digests may be produced. In order to generate a longer digest, the only thing needed is to enlarge the diameter of the closed rings. That can be done by adding some new points into the closed rings. Such extension may be provided by simply changing settings of the configuration. Thus it is possible to easily generate a longer digest if the shorter one was broken and still use the basic signing implementation.  
         [0086]    Changing the configuration of rings may be done by switch-case operations. For example, in the above examples the operations could be:  
                                                   switch (configuration) {           case 160:           then calculating H 0 , H 1 , H 2 , H 4  and H 5 ;           case 192:           then calculating H 0 , H 1 , H 2 , H 4 , H 5  and H 6 ;           . . .           }                      
 
         [0087]    Enlarging the diameter of closed ring does not add any substantial overhead for the processing. Thus the embodiments can be used to generate different digest lengths and the overhead is not clearly increased. This is because some middle information generated during hashing can be directly used as digests, see FIG. 1.  
         [0088]    An advantage provided by the embodiments is the integrity of the hash algorithm. This can be illustrated by the following example. Lets assume hashing of a 1-word variable ‘x’ to generate a 5-word digests A, B, C, D, E at the ith step of the algorithm of FIG. 1. If the relationship among the digests A, B, C, D, E were loose then attackers might be able to break A at the ith step, break B at the jth step and so forth. This can be avoided by generating one n-word digest is generated instead of n word-sized digests. By means of this it is possible to improve the strength of the hash function. The two closed rings may be used in hashing each word in thus manner. As shown in FIG. 2 b , one ring may be vertical, going along the direction of input down to output and then feeding back up to the input. The other ring may then be horizontal, circularly rotating among some of the working variables.  
         [0089]    The embodiments may combine different hashes, for example an FFT-like hash and a S-box-like hash. The conventional hash functions have been block-based which has made it difficult to share common operations between hash and encryption stages. The common operations might, however, be advantageous in ciphersuit applications, such as in session-based secrecy.  
         [0090]    The above described cyclically closed hash algorithm also supports integration of hash and encryption, thus providing a stream-based hash function with a built-in a cipher. That is, when a message is input into the hash algorithm, it is possible to obtain ciphertexts in addition to the digests. The hash function may also be used for key derivation and then use a fairly simple model to encrypt messages. Thus, integration of hash and encryption basically adds a very limited amount of operations. It is also possible to use the hash algorithm as a pure encryption function. Namely, the hash logic can only be used for key derivation. The encryption also offers support of variable length of key. The stream like hashing is advantageous since it enables the dual functionality of hash and encryption. The combined hash and encryption is preferably applied in symmetric systems.  
         [0091]    An additional randomizing logic may be provided which extends the hashing space so that from the resulting digest point of view there is no difference between word-based and block-based treatment. The advantage of the word-based treatment is that the hashed results in each word can be directly used as half-finished products for encrypting. Ciphersuit applications can seamlessly integrate hash and encryption phases, thus avoiding duplicate calculation. This combination may be substantially faster than, for example, the corresponding SHA+AES combination.  
         [0092]    The above describes the core elements of the hash function. The described additional features can then be extended based on the hashing.  
         [0093]    In an embodiment the task of hash functions is to hash an entire message rather than individual words of the message. Even if the aim is to hash message the detailed operations may still be on each word. The two closed rings used in word hashing can be used to guarantee the integrity of the hashing of the message.  
         [0094]    It is noted that although the above disclosed solution wherein two closed rings are provided, only one ring may be enough in certain applications. if only one ring is used, it is still possible to spread any possible deviations from a point to others. However, the spreading speed is believed to be slower than in applications with two rings. Although workable, use of spreading deviation only might not be enough for all applications. Even distribution of the deviations might be required so that the deviations are difficult to be rejected later. Addition of the horizontal ring can speed up spreading and make the even distribution of deviations faster.  
         [0095]    The following describes yet another embodiment which might be used in certain applications together with the above described hash function. Conventional hashing algorithms can be seen as static operations since the digests will always be the same as long as the inputs are identical. That may cause problems in security if the inputs remain the same or if the changes are not substantial. This may become an even more acute problem since the hacking applications are getting more sophisticated and “stronger”. For example, the conventional hashing algorithms may be vulnerable if so called Birthday attacks and other brute-force attacks are combined to apply on the signing algorithms. A further embodiment may provide further protection against the risks caused by the static nature of the conventional algorithms. In this further embodiment a group of changeable initial values may be used to prevent the risk of successful attacks. More particularly, the hash algorithm may utilize changeable initial values to enhance the dynamics of the data signing so that the risk of successful Birthday attacks or similar brute-force attacks can be reduced. The changeable initial values can be used to enhance the strength of the hashing by enlarging the space with an environmental variable. The changeable initial values may have a certain period. For example, the changeable initial values may have a period of 232. The digests may be distributed with the changeable initial values. Thus, even though attackers might find some repetitions through some integrated attack, they would fail to subdue the algorithm. This is so since the attackers would only have a chance when a combination of identical initial values and a message reappear again. This requirement is believed to be extremely difficult to meet.  
         [0096]    In data security applications, each level of protection makes it more difficult to attack the data. The changeable initial values are based on a difficulty that attackers might try to solve making a collision for purpose. However, the attackers cannot duplicate a collision if the environment is changed. For example, a message may be sent to a receiver which then verifies the message. If there is a concern regarding the reliability of the hash function, for example if the message is very important or the used digest is not very long. If changeable initial values is also applied in the hash function, then the receiver may ask the sender to confirm the message with a different group of initial values. If confirmed for n times, then the difficulty exponentially increases with n.  
         [0097]    It is also noted herein that while the above describes exemplifying embodiments of the invention, there are several variations and modifications which may be made to the disclosed solution without departing from the scope of the present invention as defined in the appended claims.