List of usage examples for org.apache.commons.codec.digest DigestUtils shaHex
@Deprecated public static String shaHex(String data)
From source file:AddSHA1.java
public static void main(String args[]) { //1d5e6de6782a0406b4f49690d2849cf3c8365156 //System.out.println(DigestUtils.shaHex("1397553651725919662weixin")); //signature:1d5e6de6782a0406b4f49690d2849cf3c8365156,timestamp:1397612997,nonce:57092655,echostr:3405473746965751253 byte[] digest = DigestUtils.sha("1397553651725919662weixin"); String outStr = bytetoString(digest); System.out.println(outStr);//w w w. jav a 2 s .c o m System.out.println(DigestUtils.shaHex("1397553651725919662weixin")); System.out.println(SHA1("1397553651725919662weixin")); }
From source file:com.enonic.esl.util.DigestUtil.java
/** * Generate SHA digest string.//from w ww . j av a2s . c om */ public static String generateSHA(byte[] bytes) { return DigestUtils.shaHex(bytes).toUpperCase(); }
From source file:com.enonic.esl.util.DigestUtil.java
/** * Generate MD5 digest string. */ public static String generateSHA(String value) { return DigestUtils.shaHex(value).toUpperCase(); }
From source file:com.system.util.encode.EncodeUtils.java
/** * SHAHAX? */ public static String shaHexDecode(String input) { return DigestUtils.shaHex(input); }
From source file:bigbluej.Checksum.java
public static String create(String call, String query, String sharedSecret) { String base = call + query + sharedSecret; return DigestUtils.shaHex(base); }
From source file:de.berlios.jhelpdesk.utils.StampUtils.java
public static String craeteStampFromObjects(Object first, Object... rest) { StringBuilder sb = new StringBuilder(Thread.currentThread().getName()); sb.append(Thread.currentThread().getId()); sb.append(first);/*from w ww .ja v a2 s .c om*/ for (Object o : rest) { sb.append(o); } sb.append(System.nanoTime()); return DigestUtils.shaHex(sb.toString()); }
From source file:com.gson.util.Tools.java
public static final boolean checkSignature(String token, String signature, String timestamp, String nonce) { List<String> params = new ArrayList<String>(); params.add(token);//from ww w . jav a2s. co m params.add(timestamp); params.add(nonce); Collections.sort(params, new Comparator<String>() { @Override public int compare(String o1, String o2) { return o1.compareTo(o2); } }); String temp = params.get(0) + params.get(1) + params.get(2); return DigestUtils.shaHex(temp).equals(signature); }
From source file:net.mamian.mySpringboot.utils.SecurityUtils.java
/** * ?//ww w. j a v a 2 s.c o m * * @param salt * @param userPassword * @return */ public static String getPassphrase(String salt, String userPassword) { return DigestUtils.shaHex(blend(salt, userPassword)); }
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 w w . j a va 2s.c o m*/ actualFileHash = DigestUtils.md5Hex(new FileInputStream(fileToCheck)); break; case SHA1: actualFileHash = DigestUtils.shaHex(new FileInputStream(fileToCheck)); break; } return actualFileHash; }
From source file:edu.lternet.pasta.datapackagemanager.checksum.DigestUtilsWrapper.java
/** * Gets the SHA-1 checksum of a file object * // ww w .j a v a 2s. c o m * @param file the file object whose checksum is being calculated * @return the SHA-1 checksum, a 40-character string * @throws Exception */ public static String getSHA1Checksum(File file) throws Exception { InputStream fis = new FileInputStream(file); String shaHex = DigestUtils.shaHex(fis); fis.close(); return shaHex; }