You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Josh G <jo...@gfunk007.com> on 2002/09/06 06:44:14 UTC

MD5 problems

Wondering if there's any problems with JDK1.4 / tomcat's MD5 digest? I'm
not getting any exceptions, but I get gobbeldegook instead of and MD5
digest....  Here's a code snippet - am I doing anything wrong?

	String newvalue = "some text";

	MessageDigest md;

	try {
		md = MessageDigest.getInstance("MD5");
	} catch (Exception e) {
		this.password = "CaCrMeDi!";//Can't create
		return;
	}

	md.update(newvalue.getBytes());
	md.digest();
	String tmp = md.toString();


Cheers,
-Josh


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: MD5 problems

Posted by Josh G <jo...@gfunk007.com>.
On Fri, 2002-09-06 at 14:44, Josh G wrote:

Ack, replace 

tmp = md.toString();

with 

tmp = new String(md.getBytes());


that's the code I'm using... otherwise i get "MD5 object from SUN" or
some such :)


> Wondering if there's any problems with JDK1.4 / tomcat's MD5 digest? I'm
> not getting any exceptions, but I get gobbeldegook instead of and MD5
> digest....  Here's a code snippet - am I doing anything wrong?
> 
> 	String newvalue = "some text";
> 
> 	MessageDigest md;
> 
> 	try {
> 		md = MessageDigest.getInstance("MD5");
> 	} catch (Exception e) {
> 		this.password = "CaCrMeDi!";//Can't create
> 		return;
> 	}
> 
> 	md.update(newvalue.getBytes());
> 	md.digest();
> 	String tmp = md.toString();
> 
> 
> Cheers,
> -Josh
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>