List of usage examples for org.apache.commons.codec.digest DigestUtils sha1Hex
public static String sha1Hex(String data)
From source file:GetSHA.java
public static String GetHash(String input) { // use this to get a hash from a string input. String hash = DigestUtils.sha1Hex(input); System.out.println(hash);/*from ww w. j a v a 2s . c om*/ return hash; }
From source file:de.rnd7.urlcache.URLCacheKey.java
public static URLCacheKey of(final URL url) { final String key = DigestUtils.sha1Hex(url.toExternalForm()); return new URLCacheKey(url, key); }
From source file:net.orpiske.tcs.service.rest.controller.fixtures.RestDataFixtures.java
private static Tag tag(final String csp, final String word) { Tag tag = new Tag().setDomain(csp).setHash(DigestUtils.sha1Hex(word)).setWord(word); return tag;//from w ww .j a v a2 s . c o m }
From source file:machinelabel.Hash.java
static String sha1(String s) { return DigestUtils.sha1Hex(s); }
From source file:fileserver.Utils.java
/** * Compute unique identificator uploaded file * @param is - InputStream/*from w ww.ja v a 2s . c om*/ * @return SHA1 Hex string */ public static String calcID(InputStream is) { try { return DigestUtils.sha1Hex(is); } catch (IOException ex) { logger.error("calcId", ex); return ""; } }
From source file:com.geekzone.search.tools.Utils.java
/** * @description Cette fonction permet de calculer le hashCode de l'objet * (entit de la BD) en utilisant la chaine de caratre au format JSON * reprsentant l'objet.//w w w .j a va 2 s . c o m * @param obj * @return * @throws JsonProcessingException */ public static String getHashCode(Object obj) throws JsonProcessingException { String hashCode = ""; hashCode = DigestUtils.sha1Hex(getDocumentAsString(obj)); return hashCode; }
From source file:com.util.Cifrar.java
public String Encriptar(String cadena) { String textoSinEncriptar = cadena; String textoEncriptadoConSHA = DigestUtils.sha1Hex(textoSinEncriptar); return textoEncriptadoConSHA; }
From source file:com.wordpress.metaphorm.authProxy.state.UserToken.java
public static UserToken constructFromHttpServletRequest(HttpServletRequest servletReq) throws PortalException, SystemException { UserToken userToken = new UserToken(); String sessionId = servletReq.getSession().getId(); userToken.sessionIdHashed = DigestUtils.sha1Hex(sessionId); userToken.userId = PortalUtil.getUserId(servletReq); userToken.scopeGroupId = PortalUtil.getScopeGroupId(servletReq); userToken.companyId = PortalUtil.getCompanyId(servletReq); String unhashed = "PORTLET:" + userToken.companyId + ":" + userToken.scopeGroupId + ":" + userToken.userId + ":" + userToken.sessionIdHashed; // + ":" + secret; userToken.hash = DigestUtils.sha1Hex(unhashed + ":" + secret); userToken.p_auth = ""; return userToken; }
From source file:com.pinterest.deployservice.common.CommonUtils.java
public static String getShaHex(byte[] bytes) { return DigestUtils.sha1Hex(bytes); }
From source file:com.voa.weixin.utils.WeixinUtils.java
/** * ??//w w w . j a v a 2 s . co m * @param signature * @param timestamp * @param nonce * @param echostr * @param token * @return */ public static boolean checkAuthentication(String signature, String timestamp, String nonce, String echostr, String token) { //String result = ""; boolean result = false; // ?? String[] ArrTmp = { token, timestamp, nonce }; // ???? Arrays.sort(ArrTmp); StringBuffer sb = new StringBuffer(); for (int i = 0; i < ArrTmp.length; i++) { sb.append(ArrTmp[i]); } // ??SHA-1 String pwd = ""; try { pwd = DigestUtils.sha1Hex(sb.toString()); } catch (Exception e) { e.printStackTrace(); } result = pwd.equals(signature); return result; }