Hello world,
I need some urgent help!
Due to some project purposes I cannot change I have to modify the
initial value for the RIPEMD-160 algorithm
depending on another result from the RIPEMD-160 algorithm.
I am using Java 1.3.1 with gnu crypto 1.1
(The important class RipeMD160.java has not been changed compared
to gnu crypto 2.0.1).
I want to do something like this:
(let newIV be an result of the RIPEMD-160 - e.g.
"9c1185a5c5e9fc54612808977ee8f548b2258d31")
public void setIV(String newIV) {
h0 = Integer.parseInt(newIV.substring(0, 8).toUpperCase(), 16);
h1 = Integer.parseInt(newIV.substring(8, 16).toUpperCase(), 16);
h2 = Integer.parseInt(newIV.substring(16, 24).toUpperCase(), 16);
h3 = Integer.parseInt(newIV.substring(24, 32).toUpperCase(), 16);
h4 = Integer.parseInt(newIV.substring(32, 40).toUpperCase(), 16);
}
In other words, I have to split the result in 5 4-byte-words and
use them as new initial values for the next calculation.
In the current implementation of the RipeMD160-class, the initial
value variables are declared as int.
It is possible that result.substring(0, 8) would be
"FFFFFFFF" (greater than 7FFFFFFF - max value for JAVA int)
for instance? In this case, this value would be greater than the
max value of an JAVA int and I will get a problem!