Uploaded image for project: 'i2b2 Core Software'
  1. i2b2 Core Software
  2. CORE-55

PMUtil: MD5 : strips "0" from encoded bytes

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 1.5.00
    • None
    • PM Cell
    • None

    Description

          public String toHex(byte[] digest)
          {
                  StringBuffer buf = new StringBuffer();
                  for (int i = 0; i < digest.length; i++) {
                          buf.append(Integer.toHexString((int) digest[i] & 0x00FF));
                  }
                  return buf.toString();
          }

          public String getHashedPassword(String pass) throws Exception
          {
              MessageDigest md5 = MessageDigest.getInstance("MD5");
              md5.update(pass.getBytes());

              return toHex(md5.digest());
          }


      For example: The real MD5 for "demouser" vs PMUtil

      md5('demouser')
      91017d590a69dc49807671a51f10ab7f

      PMUtil.getHashedPassword("demouser")
      9117d59a69dc49807671a51f10ab7f



      Attachments

        Activity

          People

            mem61 Mike Mendis
            amcmurry Andrew McMurry
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: