src/java.base/share/classes/sun/security/provider/MD4.java
author coffeys
Thu, 23 Aug 2018 11:37:14 +0100
changeset 51504 c9a3e3cac9c7
parent 47216 71c04702a3d5
child 57950 4612a3cfb927
permissions -rw-r--r--
8209129: Further improvements to cipher buffer management Reviewed-by: weijun, igerasim
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
40416
5d91b2fd668c 8130181: Deprecate java.security.Provider(String, double, String), add Provider(Strin
valeriep
parents: 34006
diff changeset
     2
 * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.security.provider;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.security.*;
51504
c9a3e3cac9c7 8209129: Further improvements to cipher buffer management
coffeys
parents: 47216
diff changeset
    29
import java.util.Arrays;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import static sun.security.provider.ByteArrayAccess.*;
40416
5d91b2fd668c 8130181: Deprecate java.security.Provider(String, double, String), add Provider(Strin
valeriep
parents: 34006
diff changeset
    32
import static sun.security.util.SecurityConstants.PROVIDER_VER;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * The MD4 class is used to compute an MD4 message digest over a given
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * buffer of bytes. It is an implementation of the RSA Data Security Inc
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * MD4 algorithim as described in internet RFC 1320.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * <p>The MD4 algorithm is very weak and should not be used unless it is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * unavoidable. Therefore, it is not registered in our standard providers. To
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * obtain an implementation, call the static getInstance() method in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * @author      Andreas Sterbenz
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
public final class MD4 extends DigestBase {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    // state of this object
12685
8a448b5b9006 4963723: Implement SHA-224
valeriep
parents: 10336
diff changeset
    49
    private int[] state;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    // temporary buffer, used by implCompress()
12685
8a448b5b9006 4963723: Implement SHA-224
valeriep
parents: 10336
diff changeset
    51
    private int[] x;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    // rotation constants
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    private static final int S11 = 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    private static final int S12 = 7;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    private static final int S13 = 11;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    private static final int S14 = 19;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    private static final int S21 = 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    private static final int S22 = 5;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    private static final int S23 = 9;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    private static final int S24 = 13;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    private static final int S31 = 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    private static final int S32 = 9;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    private static final int S33 = 11;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    private static final int S34 = 15;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
32649
2ee9017c7597 8136583: Core libraries should use blessed modifier order
martin
parents: 25859
diff changeset
    67
    private static final Provider md4Provider;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    static {
40416
5d91b2fd668c 8130181: Deprecate java.security.Provider(String, double, String), add Provider(Strin
valeriep
parents: 34006
diff changeset
    70
        md4Provider = new Provider("MD4Provider", PROVIDER_VER,
5d91b2fd668c 8130181: Deprecate java.security.Provider(String, double, String), add Provider(Strin
valeriep
parents: 34006
diff changeset
    71
            "MD4 MessageDigest") {
10336
0bb1999251f8 7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents: 5506
diff changeset
    72
            private static final long serialVersionUID = -8850464997518327965L;
0bb1999251f8 7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents: 5506
diff changeset
    73
        };
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        AccessController.doPrivileged(new PrivilegedAction<Void>() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
            public Void run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
                md4Provider.put("MessageDigest.MD4", "sun.security.provider.MD4");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
                return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        });
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    public static MessageDigest getInstance() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
            return MessageDigest.getInstance("MD4", md4Provider);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        } catch (NoSuchAlgorithmException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
            // should never occur
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
            throw new ProviderException(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    // Standard constructor, creates a new MD4 instance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    public MD4() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        super("MD4", 16, 64);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        state = new int[4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        x = new int[16];
51504
c9a3e3cac9c7 8209129: Further improvements to cipher buffer management
coffeys
parents: 47216
diff changeset
    96
        resetHashes();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    // clone this object
12685
8a448b5b9006 4963723: Implement SHA-224
valeriep
parents: 10336
diff changeset
   100
    public Object clone() throws CloneNotSupportedException {
8a448b5b9006 4963723: Implement SHA-224
valeriep
parents: 10336
diff changeset
   101
        MD4 copy = (MD4) super.clone();
8a448b5b9006 4963723: Implement SHA-224
valeriep
parents: 10336
diff changeset
   102
        copy.state = copy.state.clone();
8a448b5b9006 4963723: Implement SHA-224
valeriep
parents: 10336
diff changeset
   103
        copy.x = new int[16];
8a448b5b9006 4963723: Implement SHA-224
valeriep
parents: 10336
diff changeset
   104
        return copy;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * Reset the state of this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    void implReset() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        // Load magic initialization constants.
51504
c9a3e3cac9c7 8209129: Further improvements to cipher buffer management
coffeys
parents: 47216
diff changeset
   112
        resetHashes();
c9a3e3cac9c7 8209129: Further improvements to cipher buffer management
coffeys
parents: 47216
diff changeset
   113
        // clear out old data
c9a3e3cac9c7 8209129: Further improvements to cipher buffer management
coffeys
parents: 47216
diff changeset
   114
        Arrays.fill(x, 0);
c9a3e3cac9c7 8209129: Further improvements to cipher buffer management
coffeys
parents: 47216
diff changeset
   115
    }
c9a3e3cac9c7 8209129: Further improvements to cipher buffer management
coffeys
parents: 47216
diff changeset
   116
c9a3e3cac9c7 8209129: Further improvements to cipher buffer management
coffeys
parents: 47216
diff changeset
   117
    private void resetHashes() {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        state[0] = 0x67452301;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        state[1] = 0xefcdab89;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        state[2] = 0x98badcfe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        state[3] = 0x10325476;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * Perform the final computations, any buffered bytes are added
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * to the digest, the count is added to the digest, and the resulting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * digest is stored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    void implDigest(byte[] out, int ofs) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        long bitsProcessed = bytesProcessed << 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        int index = (int)bytesProcessed & 0x3f;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        int padLen = (index < 56) ? (56 - index) : (120 - index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        engineUpdate(padding, 0, padLen);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        i2bLittle4((int)bitsProcessed, buffer, 56);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        i2bLittle4((int)(bitsProcessed >>> 32), buffer, 60);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        implCompress(buffer, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        i2bLittle(state, 0, out, ofs, 16);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    private static int FF(int a, int b, int c, int d, int x, int s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        a += ((b & c) | ((~b) & d)) + x;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        return ((a << s) | (a >>> (32 - s)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    private static int GG(int a, int b, int c, int d, int x, int s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        a += ((b & c) | (b & d) | (c & d)) + x + 0x5a827999;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        return ((a << s) | (a >>> (32 - s)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    private static int HH(int a, int b, int c, int d, int x, int s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        a += ((b ^ c) ^ d) + x + 0x6ed9eba1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        return ((a << s) | (a >>> (32 - s)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * This is where the functions come together as the generic MD4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * transformation operation. It consumes sixteen
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * bytes from the buffer, beginning at the specified offset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    void implCompress(byte[] buf, int ofs) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        b2iLittle64(buf, ofs, x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        int a = state[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        int b = state[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        int c = state[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        int d = state[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        /* Round 1 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        a = FF (a, b, c, d, x[ 0], S11); /* 1 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        d = FF (d, a, b, c, x[ 1], S12); /* 2 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        c = FF (c, d, a, b, x[ 2], S13); /* 3 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        b = FF (b, c, d, a, x[ 3], S14); /* 4 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        a = FF (a, b, c, d, x[ 4], S11); /* 5 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        d = FF (d, a, b, c, x[ 5], S12); /* 6 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        c = FF (c, d, a, b, x[ 6], S13); /* 7 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        b = FF (b, c, d, a, x[ 7], S14); /* 8 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        a = FF (a, b, c, d, x[ 8], S11); /* 9 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        d = FF (d, a, b, c, x[ 9], S12); /* 10 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        c = FF (c, d, a, b, x[10], S13); /* 11 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        b = FF (b, c, d, a, x[11], S14); /* 12 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        a = FF (a, b, c, d, x[12], S11); /* 13 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        d = FF (d, a, b, c, x[13], S12); /* 14 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        c = FF (c, d, a, b, x[14], S13); /* 15 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        b = FF (b, c, d, a, x[15], S14); /* 16 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        /* Round 2 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        a = GG (a, b, c, d, x[ 0], S21); /* 17 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        d = GG (d, a, b, c, x[ 4], S22); /* 18 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        c = GG (c, d, a, b, x[ 8], S23); /* 19 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        b = GG (b, c, d, a, x[12], S24); /* 20 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        a = GG (a, b, c, d, x[ 1], S21); /* 21 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        d = GG (d, a, b, c, x[ 5], S22); /* 22 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        c = GG (c, d, a, b, x[ 9], S23); /* 23 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        b = GG (b, c, d, a, x[13], S24); /* 24 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        a = GG (a, b, c, d, x[ 2], S21); /* 25 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        d = GG (d, a, b, c, x[ 6], S22); /* 26 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        c = GG (c, d, a, b, x[10], S23); /* 27 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        b = GG (b, c, d, a, x[14], S24); /* 28 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        a = GG (a, b, c, d, x[ 3], S21); /* 29 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        d = GG (d, a, b, c, x[ 7], S22); /* 30 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        c = GG (c, d, a, b, x[11], S23); /* 31 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        b = GG (b, c, d, a, x[15], S24); /* 32 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        /* Round 3 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        a = HH (a, b, c, d, x[ 0], S31); /* 33 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        d = HH (d, a, b, c, x[ 8], S32); /* 34 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        c = HH (c, d, a, b, x[ 4], S33); /* 35 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        b = HH (b, c, d, a, x[12], S34); /* 36 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        a = HH (a, b, c, d, x[ 2], S31); /* 37 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        d = HH (d, a, b, c, x[10], S32); /* 38 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        c = HH (c, d, a, b, x[ 6], S33); /* 39 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        b = HH (b, c, d, a, x[14], S34); /* 40 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        a = HH (a, b, c, d, x[ 1], S31); /* 41 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        d = HH (d, a, b, c, x[ 9], S32); /* 42 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        c = HH (c, d, a, b, x[ 5], S33); /* 43 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        b = HH (b, c, d, a, x[13], S34); /* 44 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        a = HH (a, b, c, d, x[ 3], S31); /* 45 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        d = HH (d, a, b, c, x[11], S32); /* 46 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        c = HH (c, d, a, b, x[ 7], S33); /* 47 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        b = HH (b, c, d, a, x[15], S34); /* 48 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        state[0] += a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        state[1] += b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        state[2] += c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        state[3] += d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
}