Afficher un message
Vieux 16/05/2007, 13h36   #1
Prince Al
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Creating password hash value

Hi,

Before I start, I want to apologise for mixing a unix and Java. I
wasn't really sure which group to post in, but figured that seeing as
my query ultimately involves unix tools, it should go in here.
However, if someone knows of a better group for this, please let me
know!

I am trying to write a script (KSH) that takes in a list of passwords
and returns a list hash equivalents. From what I have gleaned on the
interweb, I should be using openssl and associated utilities, which I
have been doing and creating hashes quite nicely.

The problem is that I cannot get the hash result of TDS123 to equal
that of the hash result from the following Java code:

public static String hashPassword(String password) {
MessageDigest md = null;

try { md = MessageDigest.getInstance("MD5"); }
catch (NoSuchAlgorithmException e) { // Ignore this error as
we have hard-coded the algorithm }

md.update(password.getBytes());
byte[] digestedPwdBytes = md.digest();
String digestedPwdString = new
String(Util.encodeBase64(digestedPwdBytes));
// Base64.encode
return digestedPwdString.trim();
}

The Hash returned by the above Java code is: zZyZDPFGJ4emgl4gi1+Mmg==
and no matter how many different combinations I try, I cannot get the
*nix output to be the same.

Any ideas or advice would be very much appreciated!

Cheers

Tim

  Réponse avec citation
 
Page generated in 0,05906 seconds with 9 queries