congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
MD5Utils
Code IndexAdd Tabnine to your IDE (free)

How to use
MD5Utils
in
com.mpush.tools.crypto

Best Java code snippets using com.mpush.tools.crypto.MD5Utils (Showing top 12 results out of 315)

origin: mpusher/mpush

  public ReusableSession genSession(SessionContext context) {
    long now = System.currentTimeMillis();
    ReusableSession session = new ReusableSession();
    session.context = context;
    session.sessionId = MD5Utils.encrypt(context.deviceId + now);
    session.expireTime = now + expiredTime * 1000;
    return session;
  }
}
origin: mpusher/mpush

public static String encrypt(byte[] bytes) {
  try {
    MessageDigest digest = MessageDigest.getInstance("MD5");
    digest.update(bytes);
    return toHex(digest.digest());
  } catch (Exception e) {
    return Strings.EMPTY;
  }
}
origin: mpusher/mpush

  public static String sha1(String data) {
    try {
      MessageDigest digest = MessageDigest.getInstance("SHA-1");
      return toHex(digest.digest(data.getBytes(Constants.UTF_8)));
    } catch (Exception e) {
      return Strings.EMPTY;
    }
  }
}
origin: com.github.mpusher/mpush-core

  public ReusableSession genSession(SessionContext context) {
    long now = System.currentTimeMillis();
    ReusableSession session = new ReusableSession();
    session.context = context;
    session.sessionId = MD5Utils.encrypt(context.deviceId + now);
    session.expireTime = now + expiredTime * 1000;
    return session;
  }
}
origin: mpusher/mpush

public static String encrypt(String text) {
  try {
    MessageDigest digest = MessageDigest.getInstance("MD5");
    digest.update(text.getBytes(Constants.UTF_8));
    return toHex(digest.digest());
  } catch (Exception e) {
    return Strings.EMPTY;
  }
}
origin: mpusher/mpush

public static String hmacSha1(String data, String encryptKey) {
  final String HMAC_SHA1 = "HmacSHA1";
  SecretKeySpec signingKey = new SecretKeySpec(encryptKey.getBytes(Constants.UTF_8), HMAC_SHA1);
  try {
    Mac mac = Mac.getInstance(HMAC_SHA1);
    mac.init(signingKey);
    mac.update(data.getBytes(Constants.UTF_8));
    return toHex(mac.doFinal());
  } catch (Exception e) {
    return Strings.EMPTY;
  }
}
origin: mpusher/mpush

public static String encrypt(File file) {
  InputStream in = null;
  try {
    MessageDigest digest = MessageDigest.getInstance("MD5");
    in = new FileInputStream(file);
    byte[] buffer = new byte[1024];//10k
    int readLen;
    while ((readLen = in.read(buffer)) != -1) {
      digest.update(buffer, 0, readLen);
    }
    return toHex(digest.digest());
  } catch (Exception e) {
    return Strings.EMPTY;
  } finally {
    IOUtils.close(in);
  }
}
origin: com.github.mpusher/mpush-tools

  public static String sha1(String data) {
    try {
      MessageDigest digest = MessageDigest.getInstance("SHA-1");
      return toHex(digest.digest(data.getBytes(Constants.UTF_8)));
    } catch (Exception e) {
      return Strings.EMPTY;
    }
  }
}
origin: com.github.mpusher/mpush-tools

public static String encrypt(byte[] bytes) {
  try {
    MessageDigest digest = MessageDigest.getInstance("MD5");
    digest.update(bytes);
    return toHex(digest.digest());
  } catch (Exception e) {
    return Strings.EMPTY;
  }
}
origin: com.github.mpusher/mpush-tools

public static String encrypt(String text) {
  try {
    MessageDigest digest = MessageDigest.getInstance("MD5");
    digest.update(text.getBytes(Constants.UTF_8));
    return toHex(digest.digest());
  } catch (Exception e) {
    return Strings.EMPTY;
  }
}
origin: com.github.mpusher/mpush-tools

public static String hmacSha1(String data, String encryptKey) {
  final String HMAC_SHA1 = "HmacSHA1";
  SecretKeySpec signingKey = new SecretKeySpec(encryptKey.getBytes(Constants.UTF_8), HMAC_SHA1);
  try {
    Mac mac = Mac.getInstance(HMAC_SHA1);
    mac.init(signingKey);
    mac.update(data.getBytes(Constants.UTF_8));
    return toHex(mac.doFinal());
  } catch (Exception e) {
    return Strings.EMPTY;
  }
}
origin: com.github.mpusher/mpush-tools

public static String encrypt(File file) {
  InputStream in = null;
  try {
    MessageDigest digest = MessageDigest.getInstance("MD5");
    in = new FileInputStream(file);
    byte[] buffer = new byte[1024];//10k
    int readLen;
    while ((readLen = in.read(buffer)) != -1) {
      digest.update(buffer, 0, readLen);
    }
    return toHex(digest.digest());
  } catch (Exception e) {
    return Strings.EMPTY;
  } finally {
    IOUtils.close(in);
  }
}
com.mpush.tools.cryptoMD5Utils

Javadoc

Created by ohun on 2015/12/25.

Most used methods

  • encrypt
  • toHex

Popular in Java

  • Finding current android device location
  • getSupportFragmentManager (FragmentActivity)
  • compareTo (BigDecimal)
  • getApplicationContext (Context)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Table (org.hibernate.mapping)
    A relational table
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now