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

  • Parsing JSON documents to java classes using gson
  • setContentView (Activity)
  • findViewById (Activity)
  • onCreateOptionsMenu (Activity)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Top 17 PhpStorm Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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