Example usage for org.apache.commons.codec.digest DigestUtils md5Hex

List of usage examples for org.apache.commons.codec.digest DigestUtils md5Hex

Introduction

In this page you can find the example usage for org.apache.commons.codec.digest DigestUtils md5Hex.

Prototype

public static String md5Hex(String data) 

Source Link

Usage

From source file:dev.dposadsky.java.swingteacherdesktop.utils.StringUtils.java

public static String md5Apache(String st) {
    String md5Hex = DigestUtils.md5Hex(st);

    return md5Hex;
}

From source file:com.edmunds.etm.agent.AgentUtils.java

/**
 * Creates a message digest for the specified rule set data.
 *
 * @param ruleSetData rule set data/*from  ww  w .j a  v a  2s.  c o  m*/
 * @return message digest
 */
public static String ruleSetDigest(byte[] ruleSetData) {
    return DigestUtils.md5Hex(ruleSetData);
}

From source file:io.datenwelt.cargo.rest.utils.Strings.java

public static String token() {
    ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES * 100);
    for (int i = 0; i < 100; i++) {
        buffer.putLong(random.nextLong());
    }//from w  w  w .  j  a v  a2 s. co m
    return DigestUtils.md5Hex(buffer.array());
}

From source file:com.roncoo.pay.thirdpartypay.xinzhongli.api.XzlPayAPI.java

public static XzlResponse registerMerchant(Submarchant submarchant) throws Exception {
    String sign = DigestUtils.md5Hex(XZLStringUtils.merchantRegister(submarchant)).toUpperCase();
    Map<String, Object> paramMap = XZLStringUtils.merchantRegister(submarchant, sign);
    String pos = HttpUtils.sendToServer(EndpointConfig.XZL_SUBMERCHANT_REGISTER, paramMap, "utf-8");
    System.out.println("test-------- " + pos);

    return (XzlResponse) XZLStringUtils.getEntityFromString(XzlResponse.class, pos);
}

From source file:com.rackspacecloud.blueflood.utils.Util.java

public static int computeShard(String s) {
    return (int) Long.parseLong(DigestUtils.md5Hex(s).substring(30), 16) % Constants.NUMBER_OF_SHARDS;
}

From source file:com.github.kingamajick.maven.utils.TestUtils.java

/**
 * Generate a md5 checksum for a file.// ww  w  . jav a2  s  . c o  m
 * 
 * @param f
 * @throws MojoFailureException
 */
public final static String getChecksum(final File f) throws MojoFailureException {
    try {
        FileInputStream fis = new FileInputStream(f);
        return DigestUtils.md5Hex(fis);
    } catch (FileNotFoundException e) {
        throw new MojoFailureException("Unable to generate checksum for " + f, e);
    } catch (IOException e) {
        throw new MojoFailureException("Unable to generate checksum for " + f, e);
    }
}

From source file:com.netflix.imfutility.itunes.digest.DigestHelper.java

public static String md5(File file) {
    try (FileInputStream stream = new FileInputStream(file)) {
        return DigestUtils.md5Hex(stream);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }/*from   ww w .j av  a2s  .  c o m*/
}

From source file:corner.orm.tapestry.service.captcha.RandomUtil.java

/**
 * ???//from www  .java  2s.  c om
 * @param string 
 * @return ?
 */
public static String encodeStr(String string) {
    String str = DigestUtils.md5Hex(string);
    StringBuffer sb = new StringBuffer();
    sb.append(str.charAt(7));
    sb.append(str.charAt(15));
    sb.append(str.charAt(23));
    sb.append(str.charAt(31));
    return sb.toString();
}

From source file:com.greenline.guahao.biz.manager.payment.util.AlipayMd5Encrypt.java

/**
 * MD5??/*from  w  w  w .  j  a  va  2s.c o m*/
 * 
 * @param text 
 * 
 * @return 
 */
public static String md5(String text, String charset) {
    return DigestUtils.md5Hex(getContentBytes(text, charset));
}

From source file:com.dhenton9000.filedownloader.CheckFileHash.java

public static String getFileHash(File fileToCheck, TypeOfHash typeOfHash)
        throws FileNotFoundException, IOException {

    String actualFileHash = null;
    switch (typeOfHash) {
    case MD5:/* w  ww . j a  v  a 2 s.c om*/
        actualFileHash = DigestUtils.md5Hex(new FileInputStream(fileToCheck));

        break;
    case SHA1:
        actualFileHash = DigestUtils.shaHex(new FileInputStream(fileToCheck));

        break;
    }

    return actualFileHash;

}