From: Thomas J. Donovan Date: Mon, 7 Jul 2008 10:50:57 +0000 (+0000) Subject: correct the digest password Java example code - doc PR 45340 X-Git-Tag: 2.3.0~438 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8a73cc5ec80522ed6483f56640ecaca7dadc911e;p=apache correct the digest password Java example code - doc PR 45340 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@674445 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/misc/password_encryptions.xml b/docs/manual/misc/password_encryptions.xml index 0b6450efce..55baf2fa06 100644 --- a/docs/manual/misc/password_encryptions.xml +++ b/docs/manual/misc/password_encryptions.xml @@ -182,9 +182,9 @@ Java byte b[] = java.security.MessageDigest.getInstance("MD5").digest( (user + ":" + realm + ":" + password ).getBytes());
- java.math.BigInteger bi = new java.math.BigInteger(b);
+ java.math.BigInteger bi = new java.math.BigInteger(1, b);
String s = bi.toString(16);
- if (s.length() % 2 != 0)
+ while (s.length() < 32)
s = "0" + s;