]> granicus.if.org Git - apache/commitdiff
correct the digest password Java example code - doc PR 45340
authorThomas J. Donovan <tdonovan@apache.org>
Mon, 7 Jul 2008 10:50:57 +0000 (10:50 +0000)
committerThomas J. Donovan <tdonovan@apache.org>
Mon, 7 Jul 2008 10:50:57 +0000 (10:50 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@674445 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/misc/password_encryptions.xml

index 0b6450efceaa885c46cec9a868e711782d3ce921..55baf2fa06688895b43a20d7e40fa0b056c16e7f 100644 (file)
       
       <example><title>Java</title>
       byte b[] = java.security.MessageDigest.getInstance("MD5").digest( (user + ":" + realm + ":" + password ).getBytes());<br />
-      java.math.BigInteger bi = new java.math.BigInteger(b);<br />
+      java.math.BigInteger bi = new java.math.BigInteger(1, b);<br />
       String s = bi.toString(16);<br />
-      if (s.length() % 2 != 0)<br />
+      while (s.length() < 32)<br />
       <indent>
         s = "0" + s;
       </indent>