Example usage for com.squareup.okhttp.internal Util md5Hex

List of usage examples for com.squareup.okhttp.internal Util md5Hex

Introduction

In this page you can find the example usage for com.squareup.okhttp.internal Util md5Hex.

Prototype

public static String md5Hex(String s) 

Source Link

Document

Returns a 32 character string containing an MD5 hash of s .

Usage

From source file:com.frostwire.android.util.DiskCache.java

License:Open Source License

private String encodeKey(String key) {
    return Util.md5Hex(key);
}

From source file:com.magnet.max.android.rest.qos.internal.CacheUtils.java

License:Apache License

public static String getRequestHash(Request request) {
    StringBuilder sb = new StringBuilder();
    //Method and URL
    sb.append(request.method()).append(request.urlString());
    //Headers/*from   w  w  w.j av a  2  s . co  m*/
    if (null != request.headers()) {

    }
    //Body
    //Don't include body when it's multipart
    if (toHashBody(request)) {
        try {
            Buffer buffer = new Buffer();
            Request copy = request.newBuilder().build();
            copy.body().writeTo(buffer);
            sb.append(buffer.readUtf8());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    return Util.md5Hex(sb.toString());
}