gnu-crypto-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNU Crypto] W.: RipeMD160 - Changing the initial value


From: ronald . crypto
Subject: [GNU Crypto] W.: RipeMD160 - Changing the initial value
Date: Fri, 18 Nov 2005 13:23:03 +0100 (CET)

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!

Is there a different (or correct) way to set the initial value so that the 
problem will not occur?
Or is the problem not existing? Why?

Thank you for your help.

Kind regards
Ronald




reply via email to

[Prev in Thread] Current Thread [Next in Thread]