From: <php...@li...> - 2007-04-27 09:36:25
|
Hi, > algorithm.update(password.getBytes()); > $str = new Java('java.lang.String'); > $algorithm->update($str->getBytes($password)); the above PHP code creates a zero-length String and then calls "".getBytes(<password>). The getBytes() function needs a symbol as its argument or no argument at all, not a password. :) Your Java code translated into PHP is: <?php require_once("http://localhost:8080/JavaBridge/java/Java.inc"); $password=new String("$passwd"); $algorithm=java("java.security.MessageDigest")->getInstance(ENCRYPTION_TYPE); $algorithm->reset(); $algorithm.update($password->getBytes()); $encrypted = $algorithm->digest(); $out = new java("java.io.ByteArrayOutputStream"); $encoder = java("javax.mail.internet.MimeUtility")->encode(out, ENCODING_TYPE); $encoder->write(encrypted); $encoder.flush(); return new String(out.toByteArray()); ?> (not tested) Regards, Jost Boekemeier __________________________________ Yahoo! Clever: Sie haben Fragen? Yahoo! Nutzer antworten Ihnen. www.yahoo.de/clever |