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.roche.sequencing.bioinformatics.common.utils.Md5CheckSumUtil.java

public static String md5Sum(File file) throws FileNotFoundException, IOException {
    String md5Sum = null;//from w  w w.ja v a 2  s .c  om
    try (FileInputStream fis = new FileInputStream(file)) {
        md5Sum = DigestUtils.md5Hex(fis);
    }
    return md5Sum;
}

From source file:com.easybanking.data.tester.java

public static String encriptPassword(String encriptPass) {
    String encripted = DigestUtils.md5Hex(encriptPass);
    return encripted;

}

From source file:com.beginner.core.utils.MD5.java

/**
 * sign(????) <br />/*from www . jav  a  2 s  .c om*/
 * (???  ?)
 * @param text ???
 * @param key 
 * @param input_charset ??
 * @return
 * String ??
 * @exception
 * @since 1.0.0
 */
public static String sign(String text, String key, String input_charset) {
    text = text + key;
    return DigestUtils.md5Hex(getContentBytes(text, input_charset));
}

From source file:de.dennishoersch.web.chat.db.User.java

public User(String name, String password) {
    this.name = name;
    this.passwordHash = DigestUtils.md5Hex(password);
}

From source file:com.gs.obevo.util.hash.ExactDbChangeHashStrategy.java

@Override
public String hashContent(String content) {
    return DigestUtils.md5Hex(content);
}

From source file:com.enonic.cms.framework.xml.XMLBytes.java

/**
 * Return hash code./*from   ww w .  j  a  v  a2 s  . c  o m*/
 */
public synchronized String getMD5() {
    if (this.md5HashCode == null) {
        this.md5HashCode = DigestUtils.md5Hex(this.compiledBytes);
    }

    return this.md5HashCode;
}

From source file:UtilFunctions.java

public static String makeHash(File file) throws FileNotFoundException, IOException {
    FileInputStream fis = new FileInputStream(file);
    String hash = DigestUtils.md5Hex(fis);
    fis.close();/*from w  ww  .  j  a  v a 2 s  . c o  m*/

    return hash;

}

From source file:com.gs.obevo.util.hash.WhitespaceAgnosticDbChangeHashStrategy.java

@Override
public String hashContent(String content) {
    return DigestUtils.md5Hex(DAStringUtil.normalizeWhiteSpaceFromString(content));
}

From source file:dk.statsbiblioteket.hadoop.archeaderextractor.ARCHeaderExtractor.java

private static String extractHeader(ArcRecordBase arcRecord, String timeStamp) throws IOException {
    StringWriter headerString = new StringWriter();

    HttpHeader httpHeader = null;/* w  w w.ja v  a2  s.c  o  m*/
    if (hasPayload(arcRecord)) {
        httpHeader = arcRecord.getHttpHeader();
        if (httpHeader != null) {

            headerString.write("Offset: " + arcRecord.getStartOffset() + "\n");

            String URLHash = DigestUtils.md5Hex(arcRecord.getUrlStr());

            headerString.write("KEY: " + URLHash + "-" + timeStamp + "\n");
            headerString.write("URL: " + arcRecord.getUrlStr() + "\n");

            headerString.write("IP:  " + arcRecord.getIpAddress() + "\n");

            headerString.write("ProtocolVersion: " + httpHeader.getProtocolVersion() + "\n");
            headerString.write("ProtocolStatusCode: " + httpHeader.getProtocolStatusCodeStr() + "\n");
            headerString.write("ProtocolContentType: " + httpHeader.getProtocolContentType() + "\n");
            headerString.write("TotalLength: " + httpHeader.getTotalLength() + "\n");

            for (HeaderLine hl : httpHeader.getHeaderList()) {
                headerString.write(hl.name + ": " + hl.value + "\n");
            }
        }
    }
    if (httpHeader != null) {
        httpHeader.close();
    }
    arcRecord.close();
    return headerString.toString();
}

From source file:edu.lternet.pasta.common.eml.Entity.java

/**
 * Derive the entityId value from the entityName value.
 * /*from w  w w . j  av  a 2s  .co  m*/
 * @param entityName   the entityName value
 * @return the entityId value
 */
public static String entityIdFromEntityName(String entityName) {
    String entityId = null;

    if (entityName != null) {
        entityId = DigestUtils.md5Hex(entityName);
    }

    return entityId;
}