Package com.twmacinta.util

Examples of com.twmacinta.util.MD5.Update()


      MD5 md5 = new MD5();
      StringBuilder toHash = new StringBuilder(BASE_KEY_LENGTH);
      if (context instanceof CacheContextImpl) {
        CacheContextImpl cci = (CacheContextImpl) context;
        for (Map.Entry<String, Object> entry : cci.entries()) {
          md5.Update(entry.getKey(), ENCODING);
          md5.Update(":");
          if (log.isDebugEnabled()) {
            toHash.append(entry.getKey());
            toHash.append(":");
          }
View Full Code Here


      StringBuilder toHash = new StringBuilder(BASE_KEY_LENGTH);
      if (context instanceof CacheContextImpl) {
        CacheContextImpl cci = (CacheContextImpl) context;
        for (Map.Entry<String, Object> entry : cci.entries()) {
          md5.Update(entry.getKey(), ENCODING);
          md5.Update(":");
          if (log.isDebugEnabled()) {
            toHash.append(entry.getKey());
            toHash.append(":");
          }
          Object value = entry.getValue();
View Full Code Here

            toHash.append(":");
          }
          Object value = entry.getValue();
          if (null != value) {
            String cid = getCacheId(value);
            md5.Update(cid, ENCODING);
            if (log.isDebugEnabled()) {
              toHash.append(cid);
            }
          }
          md5.Update("-");
View Full Code Here

            md5.Update(cid, ENCODING);
            if (log.isDebugEnabled()) {
              toHash.append(cid);
            }
          }
          md5.Update("-");
          if (log.isDebugEnabled()) {
            toHash.append("-");
          }
        }
      } else {
View Full Code Here

            toHash.append("-");
          }
        }
      } else {
        String cid = getCacheId(context);
        md5.Update(cid, ENCODING);
        if (log.isDebugEnabled()) {
          toHash.append(cid);
        }
      }
      String key = md5.asHex();
View Full Code Here

        try
        {
      // Fast MD5 by Timothy W Macinta
      // http://www.twmacinta.com/myjava/fast_md5.php
            MD5 md5 = new MD5();
            md5.Update(s);
            s1 = md5.asHex();
        }
        catch(Exception exception)
        {
            System.out.println(exception);
View Full Code Here

    User admin = UserHelper.getUser(session, "admin");
    if (admin == null) {
      admin = new User();
      admin.setUsername("admin");
      MD5 md5 = new MD5();
      md5.Update("p@$$w0rd");
      admin.setPasswordHash(md5.asHex());
      admin.setFirstname("Admin");
      admin.setLastname("Istrator");
      admin.setPasswordHint("default");
      admin.setEmail("admin@domain.com");
View Full Code Here

    User anonymous = UserHelper.getUser(session, "anonymous");
    if (anonymous == null) {
      anonymous = new User();
      anonymous.setUsername("anonymous");
      MD5 md5 = new MD5();
      md5.Update("s,!5C6xAwM");
      anonymous.setPasswordHash(md5.asHex());
      anonymous.setFirstname("anonymous");
      anonymous.setLastname("anonymous");
      anonymous.setPasswordHint("default");
      anonymous.setSignupDate(System.currentTimeMillis());
View Full Code Here

  @Test
  public void passwordHashTest() {
    String password = "t@k30ff";
    MD5 md5 = new MD5();
    md5.Update(password);
    String hash1 = md5.asHex();
    md5 = new MD5();
    md5.Update(password);
    String hash2 = md5.asHex();
    assertEquals(hash1, hash2);
View Full Code Here

    String password = "t@k30ff";
    MD5 md5 = new MD5();
    md5.Update(password);
    String hash1 = md5.asHex();
    md5 = new MD5();
    md5.Update(password);
    String hash2 = md5.asHex();
    assertEquals(hash1, hash2);
    System.out.println(hash1);
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.