com.taobao.tanggong.HashUtil.java Source code

Java tutorial

Introduction

Here is the source code for com.taobao.tanggong.HashUtil.java

Source

/*
 * Copyright 2012 Alibaba.com All right reserved. This software is the
 * confidential and proprietary information of Alibaba.com ("Confidential
 * Information"). You shall not disclose such Confidential Information and shall
 * use it only in accordance with the terms of the license agreement you entered
 * into with Alibaba.com.
 */
package com.taobao.tanggong;

import com.google.common.hash.HashCode;
import com.google.common.hash.HashFunction;
import com.google.common.hash.Hashing;

/**
 * 
 * HashUtil.java??TODO ?? 
 * @author jingjing.zhijj 2012-12-22 ?2:39:31
 */
public class HashUtil {

    public static String md5Hash(String src) {
        HashFunction hf = Hashing.md5();
        HashCode hc = hf.newHasher().putString(src).hash();
        return hc.toString();
    }

    public static void main(String... strings) {
        System.out.println(HashUtil.md5Hash("x"));
    }

}