Thursday, 14 December 2017
arrow Previous Versions arrow JDiceLock 6.0.0.1 arrow Hash arrow BaseRipemd160X.java (2)
BaseRipemd160X.java (2nd part) (base Ripemd 160 & 320 hash digest algorithm Java source code file) Print E-mail
Get C++ DiceLock cipher architecture source code packages of DiceLock for Microsoft Visual Studio 2013 and DiceLock-x for Linux with Test Driver Programs and Response Test Vector files to verify that both them work as expected.
DiceLock for Windows and Linux
DiceLock Security governing software licenses are Free/Libre Source Code License and Educational and Research License

DiceLock is protected by US patent 7508945 and European Patent 1182777 where applicable.

DiceLock and DiceLock logo are trademarks or registered trademarks in the EC, USA and others.

License information can be obtained at our corporate web site




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
 
    /**
     * Sixth transform set
     *
     * @param   a2           int parameter by reference to be operated upon
     * @param   b2           int parameter by reference to be operated upon
     * @param   c2           int parameter by reference to be operated upon
     * @param   d2           int parameter by reference to be operated upon
     * @param   e2           int parameter by reference to be operated upon
     * @param   X            stream being hashed
     */
    protected void Transform_J5(BaseHash_Int a2, BaseHash_Int b2, BaseHash_Int c2, BaseHash_Int d2, BaseHash_Int e2, int[] X) {
 
        this.Ripemd_Transform160X(BaseRipemd160X.functionJ, a2, b2, c2, d2, e2, X[5], BaseRipemd.PRIME_RL_0_15[0], BaseRipemd.CONSTANT5);
        this.Ripemd_Transform160X(BaseRipemd160X.functionJ, e2, a2, b2, c2, d2, X[14], BaseRipemd.PRIME_RL_0_15[1], BaseRipemd.CONSTANT5);
        this.Ripemd_Transform160X(BaseRipemd160X.functionJ, d2, e2, a2, b2, c2, X[7], BaseRipemd.PRIME_RL_0_15[2], BaseRipemd.CONSTANT5);
        this.Ripemd_Transform160X(BaseRipemd160X.functionJ, c2, d2, e2, a2, b2, X[0], BaseRipemd.PRIME_RL_0_15[3], BaseRipemd.CONSTANT5);
        this.Ripemd_Transform160X(BaseRipemd160X.functionJ, b2, c2, d2, e2, a2, X[9], BaseRipemd.PRIME_RL_0_15[4], BaseRipemd.CONSTANT5);
        this.Ripemd_Transform160X(BaseRipemd160X.functionJ, a2, b2, c2, d2, e2, X[2], BaseRipemd.PRIME_RL_0_15[5], BaseRipemd.CONSTANT5);
        this.Ripemd_Transform160X(BaseRipemd160X.functionJ, e2, a2, b2, c2, d2, X[11], BaseRipemd.PRIME_RL_0_15[6], BaseRipemd.CONSTANT5);
        this.Ripemd_Transform160X(BaseRipemd160X.functionJ, d2, e2, a2, b2, c2, X[4], BaseRipemd.PRIME_RL_0_15[7], BaseRipemd.CONSTANT5);
        this.Ripemd_Transform160X(BaseRipemd160X.functionJ, c2, d2, e2, a2, b2, X[13], BaseRipemd.PRIME_RL_0_15[8], BaseRipemd.CONSTANT5);
        this.Ripemd_Transform160X(BaseRipemd160X.functionJ, b2, c2, d2, e2, a2, X[6], BaseRipemd.PRIME_RL_0_15[9], BaseRipemd.CONSTANT5);
        this.Ripemd_Transform160X(BaseRipemd160X.functionJ, a2, b2, c2, d2, e2, X[15], BaseRipemd.PRIME_RL_0_15[10], BaseRipemd.CONSTANT5);
        this.Ripemd_Transform160X(BaseRipemd160X.functionJ, e2, a2, b2, c2, d2, X[8], BaseRipemd.PRIME_RL_0_15[11], BaseRipemd.CONSTANT5);
        this.Ripemd_Transform160X(BaseRipemd160X.functionJ, d2, e2, a2, b2, c2, X[1], BaseRipemd.PRIME_RL_0_15[12], BaseRipemd.CONSTANT5);
        this.Ripemd_Transform160X(BaseRipemd160X.functionJ, c2, d2, e2, a2, b2, X[10], BaseRipemd.PRIME_RL_0_15[13], BaseRipemd.CONSTANT5);
        this.Ripemd_Transform160X(BaseRipemd160X.functionJ, b2, c2, d2, e2, a2, X[3], BaseRipemd.PRIME_RL_0_15[14], BaseRipemd.CONSTANT5);
        this.Ripemd_Transform160X(BaseRipemd160X.functionJ, a2, b2, c2, d2, e2, X[12], BaseRipemd.PRIME_RL_0_15[15], BaseRipemd.CONSTANT5);
    }
 
    /**
     * Seventh transform set
     *
     * @param   a2           int parameter by reference to be operated upon
     * @param   b2           int parameter by reference to be operated upon
     * @param   c2           int parameter by reference to be operated upon
     * @param   d2           int parameter by reference to be operated upon
     * @param   e2           int parameter by reference to be operated upon
     * @param   X            stream being hashed
     */
    protected void Transform_I6(BaseHash_Int a2, BaseHash_Int b2, BaseHash_Int c2, BaseHash_Int d2, BaseHash_Int e2, int[] X) {
 
        this.Ripemd_Transform160X(BaseRipemd160X.functionI, e2, a2, b2, c2, d2, X[6], BaseRipemd.PRIME_RL_16_31[0], BaseRipemd.CONSTANT6);
        this.Ripemd_Transform160X(BaseRipemd160X.functionI, d2, e2, a2, b2, c2, X[11], BaseRipemd.PRIME_RL_16_31[1], BaseRipemd.CONSTANT6);
        this.Ripemd_Transform160X(BaseRipemd160X.functionI, c2, d2, e2, a2, b2, X[3], BaseRipemd.PRIME_RL_16_31[2], BaseRipemd.CONSTANT6);
        this.Ripemd_Transform160X(BaseRipemd160X.functionI, b2, c2, d2, e2, a2, X[7], BaseRipemd.PRIME_RL_16_31[3], BaseRipemd.CONSTANT6);
        this.Ripemd_Transform160X(BaseRipemd160X.functionI, a2, b2, c2, d2, e2, X[0], BaseRipemd.PRIME_RL_16_31[4], BaseRipemd.CONSTANT6);
        this.Ripemd_Transform160X(BaseRipemd160X.functionI, e2, a2, b2, c2, d2, X[13], BaseRipemd.PRIME_RL_16_31[5], BaseRipemd.CONSTANT6);
        this.Ripemd_Transform160X(BaseRipemd160X.functionI, d2, e2, a2, b2, c2, X[5], BaseRipemd.PRIME_RL_16_31[6], BaseRipemd.CONSTANT6);
        this.Ripemd_Transform160X(BaseRipemd160X.functionI, c2, d2, e2, a2, b2, X[10], BaseRipemd.PRIME_RL_16_31[7], BaseRipemd.CONSTANT6);
        this.Ripemd_Transform160X(BaseRipemd160X.functionI, b2, c2, d2, e2, a2, X[14], BaseRipemd.PRIME_RL_16_31[8], BaseRipemd.CONSTANT6);
        this.Ripemd_Transform160X(BaseRipemd160X.functionI, a2, b2, c2, d2, e2, X[15], BaseRipemd.PRIME_RL_16_31[9], BaseRipemd.CONSTANT6);
        this.Ripemd_Transform160X(BaseRipemd160X.functionI, e2, a2, b2, c2, d2, X[8], BaseRipemd.PRIME_RL_16_31[10], BaseRipemd.CONSTANT6);
        this.Ripemd_Transform160X(BaseRipemd160X.functionI, d2, e2, a2, b2, c2, X[12], BaseRipemd.PRIME_RL_16_31[11], BaseRipemd.CONSTANT6);
        this.Ripemd_Transform160X(BaseRipemd160X.functionI, c2, d2, e2, a2, b2, X[4], BaseRipemd.PRIME_RL_16_31[12], BaseRipemd.CONSTANT6);
        this.Ripemd_Transform160X(BaseRipemd160X.functionI, b2, c2, d2, e2, a2, X[9], BaseRipemd.PRIME_RL_16_31[13], BaseRipemd.CONSTANT6);
        this.Ripemd_Transform160X(BaseRipemd160X.functionI, a2, b2, c2, d2, e2, X[1], BaseRipemd.PRIME_RL_16_31[14], BaseRipemd.CONSTANT6);
        this.Ripemd_Transform160X(BaseRipemd160X.functionI, e2, a2, b2, c2, d2, X[2], BaseRipemd.PRIME_RL_16_31[15], BaseRipemd.CONSTANT6);
    }
 
    /**
     * Eighth transform set
     *
     * @param   a2           int parameter by reference to be operated upon
     * @param   b2           int parameter by reference to be operated upon
     * @param   c2           int parameter by reference to be operated upon
     * @param   d2           int parameter by reference to be operated upon
     * @param   e2           int parameter by reference to be operated upon
     * @param   X            stream being hashed
     */
    protected void Transform_H7(BaseHash_Int a2, BaseHash_Int b2, BaseHash_Int c2, BaseHash_Int d2, BaseHash_Int e2, int[] X) {
 
        this.Ripemd_Transform160X(BaseRipemd160X.functionH, d2, e2, a2, b2, c2, X[15], BaseRipemd.PRIME_RL_32_47[0], BaseRipemd.CONSTANT7);
        this.Ripemd_Transform160X(BaseRipemd160X.functionH, c2, d2, e2, a2, b2, X[5], BaseRipemd.PRIME_RL_32_47[1], BaseRipemd.CONSTANT7);
        this.Ripemd_Transform160X(BaseRipemd160X.functionH, b2, c2, d2, e2, a2, X[1], BaseRipemd.PRIME_RL_32_47[2], BaseRipemd.CONSTANT7);
        this.Ripemd_Transform160X(BaseRipemd160X.functionH, a2, b2, c2, d2, e2, X[3], BaseRipemd.PRIME_RL_32_47[3], BaseRipemd.CONSTANT7);
        this.Ripemd_Transform160X(BaseRipemd160X.functionH, e2, a2, b2, c2, d2, X[7], BaseRipemd.PRIME_RL_32_47[4], BaseRipemd.CONSTANT7);
        this.Ripemd_Transform160X(BaseRipemd160X.functionH, d2, e2, a2, b2, c2, X[14], BaseRipemd.PRIME_RL_32_47[5], BaseRipemd.CONSTANT7);
        this.Ripemd_Transform160X(BaseRipemd160X.functionH, c2, d2, e2, a2, b2, X[6], BaseRipemd.PRIME_RL_32_47[6], BaseRipemd.CONSTANT7);
        this.Ripemd_Transform160X(BaseRipemd160X.functionH, b2, c2, d2, e2, a2, X[9], BaseRipemd.PRIME_RL_32_47[7], BaseRipemd.CONSTANT7);
        this.Ripemd_Transform160X(BaseRipemd160X.functionH, a2, b2, c2, d2, e2, X[11], BaseRipemd.PRIME_RL_32_47[8], BaseRipemd.CONSTANT7);
        this.Ripemd_Transform160X(BaseRipemd160X.functionH, e2, a2, b2, c2, d2, X[8], BaseRipemd.PRIME_RL_32_47[9], BaseRipemd.CONSTANT7);
        this.Ripemd_Transform160X(BaseRipemd160X.functionH, d2, e2, a2, b2, c2, X[12], BaseRipemd.PRIME_RL_32_47[10], BaseRipemd.CONSTANT7);
        this.Ripemd_Transform160X(BaseRipemd160X.functionH, c2, d2, e2, a2, b2, X[2], BaseRipemd.PRIME_RL_32_47[11], BaseRipemd.CONSTANT7);
        this.Ripemd_Transform160X(BaseRipemd160X.functionH, b2, c2, d2, e2, a2, X[10], BaseRipemd.PRIME_RL_32_47[12], BaseRipemd.CONSTANT7);
        this.Ripemd_Transform160X(BaseRipemd160X.functionH, a2, b2, c2, d2, e2, X[0], BaseRipemd.PRIME_RL_32_47[13], BaseRipemd.CONSTANT7);
        this.Ripemd_Transform160X(BaseRipemd160X.functionH, e2, a2, b2, c2, d2, X[4], BaseRipemd.PRIME_RL_32_47[14], BaseRipemd.CONSTANT7);
        this.Ripemd_Transform160X(BaseRipemd160X.functionH, d2, e2, a2, b2, c2, X[13], BaseRipemd.PRIME_RL_32_47[15], BaseRipemd.CONSTANT7);
    }
 
    /**
     * Ninth transform set
     *
     * @param   a2           int parameter by reference to be operated upon
     * @param   b2           int parameter by reference to be operated upon
     * @param   c2           int parameter by reference to be operated upon
     * @param   d2           int parameter by reference to be operated upon
     * @param   e2           int parameter by reference to be operated upon
     * @param   X            stream being hashed
     */
    protected void Transform_G8(BaseHash_Int a2, BaseHash_Int b2, BaseHash_Int c2, BaseHash_Int d2, BaseHash_Int e2, int[] X) {
 
        this.Ripemd_Transform160X(BaseRipemd160X.functionG, c2, d2, e2, a2, b2, X[8], BaseRipemd.PRIME_RL_48_63[0], BaseRipemd160X.CONSTANT8);
        this.Ripemd_Transform160X(BaseRipemd160X.functionG, b2, c2, d2, e2, a2, X[6], BaseRipemd.PRIME_RL_48_63[1], BaseRipemd160X.CONSTANT8);
        this.Ripemd_Transform160X(BaseRipemd160X.functionG, a2, b2, c2, d2, e2, X[4], BaseRipemd.PRIME_RL_48_63[2], BaseRipemd160X.CONSTANT8);
        this.Ripemd_Transform160X(BaseRipemd160X.functionG, e2, a2, b2, c2, d2, X[1], BaseRipemd.PRIME_RL_48_63[3], BaseRipemd160X.CONSTANT8);
        this.Ripemd_Transform160X(BaseRipemd160X.functionG, d2, e2, a2, b2, c2, X[3], BaseRipemd.PRIME_RL_48_63[4], BaseRipemd160X.CONSTANT8);
        this.Ripemd_Transform160X(BaseRipemd160X.functionG, c2, d2, e2, a2, b2, X[11], BaseRipemd.PRIME_RL_48_63[5], BaseRipemd160X.CONSTANT8);
        this.Ripemd_Transform160X(BaseRipemd160X.functionG, b2, c2, d2, e2, a2, X[15], BaseRipemd.PRIME_RL_48_63[6], BaseRipemd160X.CONSTANT8);
        this.Ripemd_Transform160X(BaseRipemd160X.functionG, a2, b2, c2, d2, e2, X[0], BaseRipemd.PRIME_RL_48_63[7], BaseRipemd160X.CONSTANT8);
        this.Ripemd_Transform160X(BaseRipemd160X.functionG, e2, a2, b2, c2, d2, X[5], BaseRipemd.PRIME_RL_48_63[8], BaseRipemd160X.CONSTANT8);
        this.Ripemd_Transform160X(BaseRipemd160X.functionG, d2, e2, a2, b2, c2, X[12], BaseRipemd.PRIME_RL_48_63[9], BaseRipemd160X.CONSTANT8);
        this.Ripemd_Transform160X(BaseRipemd160X.functionG, c2, d2, e2, a2, b2, X[2], BaseRipemd.PRIME_RL_48_63[10], BaseRipemd160X.CONSTANT8);
        this.Ripemd_Transform160X(BaseRipemd160X.functionG, b2, c2, d2, e2, a2, X[13], BaseRipemd.PRIME_RL_48_63[11], BaseRipemd160X.CONSTANT8);
        this.Ripemd_Transform160X(BaseRipemd160X.functionG, a2, b2, c2, d2, e2, X[9], BaseRipemd.PRIME_RL_48_63[12], BaseRipemd160X.CONSTANT8);
        this.Ripemd_Transform160X(BaseRipemd160X.functionG, e2, a2, b2, c2, d2, X[7], BaseRipemd.PRIME_RL_48_63[13], BaseRipemd160X.CONSTANT8);
        this.Ripemd_Transform160X(BaseRipemd160X.functionG, d2, e2, a2, b2, c2, X[10], BaseRipemd.PRIME_RL_48_63[14], BaseRipemd160X.CONSTANT8);
        this.Ripemd_Transform160X(BaseRipemd160X.functionG, c2, d2, e2, a2, b2, X[14], BaseRipemd.PRIME_RL_48_63[15], BaseRipemd160X.CONSTANT8);
    }
 
    /**
     * Tenth transform set
     *
     * @param   a2           int parameter by reference to be operated upon
     * @param   b2           int parameter by reference to be operated upon
     * @param   c2           int parameter by reference to be operated upon
     * @param   d2           int parameter by reference to be operated upon
     * @param   e2           int parameter by reference to be operated upon
     * @param   X            stream being hashed
     */
    protected void Transform_F9(BaseHash_Int a2, BaseHash_Int b2, BaseHash_Int c2, BaseHash_Int d2, BaseHash_Int e2, int[] X) {
 
        this.Ripemd_Transform160X(BaseRipemd160X.functionF, b2, c2, d2, e2, a2, X[12], BaseRipemd160X.PRIME_RL_64_79[0], BaseRipemd.CONSTANT9);
        this.Ripemd_Transform160X(BaseRipemd160X.functionF, a2, b2, c2, d2, e2, X[15], BaseRipemd160X.PRIME_RL_64_79[1], BaseRipemd.CONSTANT9);
        this.Ripemd_Transform160X(BaseRipemd160X.functionF, e2, a2, b2, c2, d2, X[10], BaseRipemd160X.PRIME_RL_64_79[2], BaseRipemd.CONSTANT9);
        this.Ripemd_Transform160X(BaseRipemd160X.functionF, d2, e2, a2, b2, c2, X[4], BaseRipemd160X.PRIME_RL_64_79[3], BaseRipemd.CONSTANT9);
        this.Ripemd_Transform160X(BaseRipemd160X.functionF, c2, d2, e2, a2, b2, X[1], BaseRipemd160X.PRIME_RL_64_79[4], BaseRipemd.CONSTANT9);
        this.Ripemd_Transform160X(BaseRipemd160X.functionF, b2, c2, d2, e2, a2, X[5], BaseRipemd160X.PRIME_RL_64_79[5], BaseRipemd.CONSTANT9);
        this.Ripemd_Transform160X(BaseRipemd160X.functionF, a2, b2, c2, d2, e2, X[8], BaseRipemd160X.PRIME_RL_64_79[6], BaseRipemd.CONSTANT9);
        this.Ripemd_Transform160X(BaseRipemd160X.functionF, e2, a2, b2, c2, d2, X[7], BaseRipemd160X.PRIME_RL_64_79[7], BaseRipemd.CONSTANT9);
        this.Ripemd_Transform160X(BaseRipemd160X.functionF, d2, e2, a2, b2, c2, X[6], BaseRipemd160X.PRIME_RL_64_79[8], BaseRipemd.CONSTANT9);
        this.Ripemd_Transform160X(BaseRipemd160X.functionF, c2, d2, e2, a2, b2, X[2], BaseRipemd160X.PRIME_RL_64_79[9], BaseRipemd.CONSTANT9);
        this.Ripemd_Transform160X(BaseRipemd160X.functionF, b2, c2, d2, e2, a2, X[13], BaseRipemd160X.PRIME_RL_64_79[10], BaseRipemd.CONSTANT9);
        this.Ripemd_Transform160X(BaseRipemd160X.functionF, a2, b2, c2, d2, e2, X[14], BaseRipemd160X.PRIME_RL_64_79[11], BaseRipemd.CONSTANT9);
        this.Ripemd_Transform160X(BaseRipemd160X.functionF, e2, a2, b2, c2, d2, X[0], BaseRipemd160X.PRIME_RL_64_79[12], BaseRipemd.CONSTANT9);
        this.Ripemd_Transform160X(BaseRipemd160X.functionF, d2, e2, a2, b2, c2, X[3], BaseRipemd160X.PRIME_RL_64_79[13], BaseRipemd.CONSTANT9);
        this.Ripemd_Transform160X(BaseRipemd160X.functionF, c2, d2, e2, a2, b2, X[9], BaseRipemd160X.PRIME_RL_64_79[14], BaseRipemd.CONSTANT9); 
        this.Ripemd_Transform160X(BaseRipemd160X.functionF, b2, c2, d2, e2, a2, X[11], BaseRipemd160X.PRIME_RL_64_79[15], BaseRipemd.CONSTANT9);
    }
 
    /**
     * Constructor, default
     */
    public BaseRipemd160X() {
        super();
    }
 
    /**
     * Destructor
     */
    public void finalize() {
 
    }
 
    /**
     * Initializes state of Ripmed 160 and 320 algorithms
     */
    public void Initialize() {
 
        super.Initialize();
        this.messageDigest.SetULPosition(4, BaseRipemd160X.INISTATE4);
    }
}