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:com.roncoo.pay.thirdpartypay.xinzhongli.api.XzlPayAPI.java

public static XzlResponse pay(PayInfo payInfo) throws Exception {
    String sign = DigestUtils.md5Hex(XZLStringUtils.payOrder(payInfo)).toUpperCase();
    Map<String, Object> paramMap = XZLStringUtils.payOrder(payInfo, sign);
    String pos = HttpUtils.sendToServer(EndpointConfig.XZL_PAY, paramMap, "utf-8");
    System.out.println("test-------- " + pos);

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

From source file:com.ctrip.utils.SignatureUtils.java

/**
 * Signature=Md5(TimeStamp+AllianceID+MD5().ToUpper()+SID+RequestType).ToUpper()
 * /*from   w ww  .j  a v a 2s  .  co m*/
 * ??
 * abcdefg123456
 * MD5?5393E07F94A25AAA373DBD3FA257BD3A
 * 
 * ???
 * AllianceID =1& SID =50& TimeStamp =1234567890&RequestType=OTA_Ping
 * 
 * Signature=Md5(TimeStamp+AllianceID+MD5().ToUpper()+SID+RequestType).ToUpper()
 *          =MD5(123456789015393E07F94A25AAA373DBD3FA257BD3A50OTA_Ping)
 *          =EF5FBA4AAB36FD044F8A13BA0D63DD13
 * 
 * @param timestamp - 1970
 * @param allianceId - ????
 * @param secretKey - APIKey??
 * @param sid - ?ID??
 * @param requestType - ????OTA_Ping
 * @return
 */
public static String getSignature(String timestamp, String allianceId, String secretKey, String sid,
        String requestType) {
    return DigestUtils.md5Hex(new StringBuffer().append(timestamp).append(allianceId)
            .append(DigestUtils.md5Hex(secretKey).toUpperCase()).append(sid).append(requestType).toString())
            .toUpperCase();
}

From source file:com.cuebiq.presto.scalar.HashingFunctions.java

@Description("hashes with md5")
@ScalarFunction/* w  w  w  . ja  v a2s .c  om*/
@SqlType(StandardTypes.VARCHAR)
public static Slice md_5(@SqlType(StandardTypes.VARCHAR) Slice string) {

    return Slices.utf8Slice(DigestUtils.md5Hex(string.toStringUtf8()));

}

From source file:com.qwazr.utils.HashUtils.java

public static String md5Hex(String text) {
    return DigestUtils.md5Hex(text);
}

From source file:com.vrane.metaGlacierSDK.MD5File.java

String md5hex() {
    try (FileInputStream in = new FileInputStream(path)) {
        return DigestUtils.md5Hex(in);
    } catch (FileNotFoundException ex) {
        LGR.log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        LGR.log(Level.SEVERE, null, ex);
    } catch (Exception e) {
        if (e.getSuppressed() != null) {
            for (Throwable t : e.getSuppressed()) {
                LGR.log(Level.SEVERE, null, t);
            }/*w  w w. j  ava  2  s  .c o m*/
        } else {
            LGR.log(Level.SEVERE, null, e);
        }
    }
    return null;
}

From source file:io.stallion.services.PermaCache.java

public static String get(String key) {
    if (cache.containsKey(key)) {
        return cache.get(key);
    }//ww  w  .  j  av a2s.  c  om
    if (!empty(getCacheFolder())) {
        File file = new File(getCacheFolder() + "/" + DigestUtils.md5Hex(key));
        if (file.exists()) {
            try {
                String content = FileUtils.readFileToString(file, "utf-8");
                cache.put(key, content);
                return content;
            } catch (IOException e) {
                Log.exception(e, "Error reading file from disk: " + file.toString());
            }
        }
    }
    return null;
}

From source file:com.gs.obevo.db.impl.core.checksum.ChecksumEntry.java

/**
 * Static-constructor for the given parameters, with adding the convenience of getting the hash checksum from the
 * given text input in a standard manner.
 *//* w ww . ja  v  a 2s  .c o m*/
public static ChecksumEntry createFromText(PhysicalSchema physicalSchema, String objectType, String name1,
        String name2, String checksum) {
    final String data = DAStringUtil.normalizeWhiteSpaceFromString(checksum);
    final String checksumData = StringUtils.isBlank(data) ? "" : DigestUtils.md5Hex(data);
    return new ChecksumEntry(physicalSchema, objectType, name1, name2, checksumData);
}

From source file:com.github.xiilei.ecdiff.Store.java

public String hk(String key) {
    return DigestUtils.md5Hex(key);
}

From source file:com.monitor.baseservice.utils.XCodeUtil.java

public synchronized static String getMD5(InputStream is) throws IOException {
    try {// ww  w. j ava 2  s  . com
        return DigestUtils.md5Hex(is);
    } finally {
        is.close();
    }
}

From source file:com.demandware.vulnapp.util.Helpers.java

/**
 * Simple MD5, no salt//  w w  w.j  a  va  2s.c om
 * 
 * @param input String to hash
 * @return hex encoded hash
 */
public static String md5(String input) {
    return DigestUtils.md5Hex(input);
}