12 Replies Latest reply: Jan 11, 2007 6:36 AM by 807607 RSS

    finding md5 of a string in java

    807607
      can any one tell me how to find md5 of a string in java
        • 1. Re: finding md5 of a string in java
          807607
          java md5 example

          Go to www.google.com and type in those three words.
          • 2. Re: finding md5 of a string in java
            807607
            md5 is dead. stop using it.
            • 3. Re: finding md5 of a string in java
              807607
              md5 is dead. stop using it.
              MD5 may be broken but it is not dead. There are too many lagacy system out there that use it. The cost of changing to use a 'better' hash is probably far greater than the cost of a system being hacked.

              P.S. SHA-1 is also broken
              http://www.schneier.com/blog/archives/2005/02/sha1_broken.html
              http://www.schneier.com/blog/archives/2005/02/cryptanalysis_o.html
              • 4. Re: finding md5 of a string in java
                807607
                http://java.sun.com/j2se/1.4.2/docs/api/java/security/MessageDigest.html

                Ted.
                • 5. Re: finding md5 of a string in java
                  807607
                  md5 is dead. stop using it.
                  There are still cases where it is very useful.

                  Have the contents of my file changed since the last time its digest was taken and stored?
                  /*
                   * MD5 implementation
                   * written Santeri Paavolainen, Helsinki Finland 1996
                   * (c) Santeri Paavolainen, Helsinki Finland 1996
                   * modifications Copyright (C) 2002-2004 Stephen Ostermiller 
                   * http://ostermiller.org/contact.pl?regarding=Java+Utilities
                   *
                   * This program is free software; you can redistribute it and/or modify
                   * it under the terms of the GNU General Public License as published by
                   * the Free Software Foundation; either version 2 of the License, or
                   * (at your option) any later version.
                   *
                   * This program is distributed in the hope that it will be useful,
                   * but WITHOUT ANY WARRANTY; without even the implied warranty of
                   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                   * GNU General Public License for more details.
                   *
                   * See COPYING.TXT for details.
                   * 
                   * The original work by Santeri Paavolainen can be found at
                   * http://www.helsinki.fi/~sjpaavol/programs/md5/
                  */
                  • 6. Re: finding md5 of a string in java
                    807607
                    md5 is dead. stop using it.
                    There are still cases where it is very useful.
                    no they're aren't.


                    > Have the contents of my file changed since the last
                    time its digest was taken and stored?

                    you don't know, because md5 is broken.
                    • 7. Re: finding md5 of a string in java
                      807607
                      md5 is dead. stop using it.
                      MD5 may be broken but it is not dead. There are too
                      many lagacy system out there that use it. The cost
                      of changing to use a 'better' hash is probably far
                      greater than the cost of a system being hacked.
                      of course. but for new projects it is dead and it's continued use should be given serious consideration.

                      P.S. SHA-1 is also broken
                      http://www.schneier.com/blog/archives/2005/02/sha1_bro
                      ken.html
                      http://www.schneier.com/blog/archives/2005/02/cryptana
                      lysis_o.html
                      indeed.
                      • 8. Re: finding md5 of a string in java
                        807607
                        you don't know, because md5 is broken.
                        You have misunderstood something.

                        The last time I was happily and successfully using md5 (as supplied by the md5sum command-line command on Unix/Windows) was this morning.
                        • 9. Re: finding md5 of a string in java
                          807607
                          md5 is dead. stop using it.
                          There are still cases where it is very useful.
                          no they're aren't.
                          Yes there are! If oen is not using MD5 as part of a security system then MD5 is a good hash.

                          >
                          >
                          b]> Have the contents of my file changed since the
                          last
                          time its digest was taken and stored?
                          you don't know, because md5 is broken.
                          Yes you do know to within a certain probability. The flaw in md5 will have little effect on this.
                          • 10. Re: finding md5 of a string in java
                            807607
                            md5 is dead. stop using it.
                            There are still cases where it is very useful.
                            no they're aren't.
                            Yes there are! If oen is not using MD5 as part of a
                            security system then MD5 is a good hash.
                            no, it's not a good hash.
                            • 11. Re: finding md5 of a string in java
                              807607
                              The
                              cost
                              of changing to use a 'better' hash is probably far
                              greater than the cost of a system being hacked.
                              of course. but for new projects it is dead and it's
                              continued use should be given serious consideration.
                              Then rather than asserting that MD5 is dead and should not be used you should state the conditions under which is should not be used. You should also suggest an alternative hash.

                              The theory of hashing does not have a firm mathematical base and until it does one cannot say that any hash method is not broken. All we know is that in MD5 and SHA1 it is possible to construct two messages that have the same hash. As far as I am aware, nobody has yet produced a technique for creating a message with the same hash as a given message.

                              To quote Schneier in http://www.schneier.com/blog/archives/2005/02/cryptanalysis_o.html "They can find collisions in SHA-1 in 269 calculations, about 2,000 times faster than brute force. Right now, that is just on the far edge of feasibility with current technology. "
                              • 12. Re: finding md5 of a string in java
                                807607
                                Then rather than asserting that MD5 is dead and should not be
                                used you should state the conditions under which is should not
                                be used. You should also suggest an alternative hash.
                                okay. sorry. carry on.