當前位置: 首頁>>代碼示例>>Java>>正文


Java DigestUtils.shaHex方法代碼示例

本文整理匯總了Java中org.apache.commons.codec.digest.DigestUtils.shaHex方法的典型用法代碼示例。如果您正苦於以下問題:Java DigestUtils.shaHex方法的具體用法?Java DigestUtils.shaHex怎麽用?Java DigestUtils.shaHex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.codec.digest.DigestUtils的用法示例。


在下文中一共展示了DigestUtils.shaHex方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: girisButonuTiklandi

import org.apache.commons.codec.digest.DigestUtils; //導入方法依賴的package包/類
@FXML
private void girisButonuTiklandi(ActionEvent event) throws IOException
{
	String username=kullaniciAdi.getText();
	String password=DigestUtils.shaHex(sifreText.getText());
	
	if(username.equals(secimler.getKullaniciadi()) && password.equals(secimler.getPassword()))
	{
		closeStage();
		loadMain();
	}
	else
	{
		Alert alert1=new Alert(Alert.AlertType.ERROR);
		alert1.setTitle("Giri� Yap�lamad�");
		alert1.setHeaderText(null);
		alert1.setContentText("Kullan�c� ad� veya �ifre hatal�");
		alert1.showAndWait();
	}
	
}
 
開發者ID:mevlanayalcin,項目名稱:KutuphaneOtomasyonSistemi,代碼行數:22,代碼來源:Controller.java

示例2: getJoinMeetingURL

import org.apache.commons.codec.digest.DigestUtils; //導入方法依賴的package包/類
@Override
   public String getJoinMeetingURL(UserDTO userDTO, String meetingKey, String password) throws Exception {

// Get Bbb details
String serverURL = getConfigValue(Constants.CFG_SERVER_URL);
String securitySalt = getConfigValue(Constants.CFG_SECURITYSALT);
// Get Join parameter
String joinParam = Constants.BBB_JOIN_PARAM;

if (serverURL == null) {
    BbbService.logger.error("Config item : '" + Constants.CFG_SERVER_URL + "' not defined");
    throw new BbbException("Server url not defined");
}

String queryString = "fullName="
	+ URLEncoder.encode(userDTO.getFirstName() + " " + userDTO.getLastName(), "UTF8") + "&meetingID="
	+ URLEncoder.encode(meetingKey, "UTF8") + "&password=" + URLEncoder.encode(password, "UTF8");

String checkSum = DigestUtils.shaHex("join" + queryString + securitySalt);

String url = serverURL + joinParam + queryString + "&checksum=" + checkSum;

return url;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:25,代碼來源:BbbService.java

示例3: poll

import org.apache.commons.codec.digest.DigestUtils; //導入方法依賴的package包/類
@Override
public synchronized Request poll(String spiderName) {

    Jedis jedis = pool.getResource();
    try {
        String url = jedis.lpop(getQueueKey(spiderName));
        if (url == null) {
            return null;
        }

        String key = ITEM_PREFIX + url;
        String field = DigestUtils.shaHex(url);
        byte[] bytes = jedis.hget(key.getBytes(), field.getBytes());
        if (bytes != null) {
            Request o = JSON.parseObject(new String(bytes), Request.class);
            return o;
        }

        Request request = new Request(url);
        return request;
    } finally {
        pool.returnResource(jedis);
    }
}
 
開發者ID:fengzhizi715,項目名稱:NetDiscovery,代碼行數:25,代碼來源:RedisQueue.java

示例4: setPassword

import org.apache.commons.codec.digest.DigestUtils; //導入方法依賴的package包/類
public void setPassword(String password) {
	if(password.length()<16)
	{
	this.password =DigestUtils.shaHex(password);
	}
	else
	{
		this.password =password;
	}
}
 
開發者ID:mevlanayalcin,項目名稱:KutuphaneOtomasyonSistemi,代碼行數:11,代碼來源:Secimler.java

示例5: cleanupTileCache

import org.apache.commons.codec.digest.DigestUtils; //導入方法依賴的package包/類
public void cleanupTileCache() {
  final String hstr = DigestUtils.shaHex(
    metadata.getName() + "_" + metadata.getVersion()
  );

  final File tdir = new File(Info.getConfDir(), "tiles/" + hstr);
  if (tdir.exists()) {
    try {
      FileUtils.forceDelete(tdir);
    }
    catch (IOException e) {
      WriteErrorDialog.error(e, tdir);
    }
  }
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:16,代碼來源:ModuleManagerWindow.java

示例6: getImageTileSource

import org.apache.commons.codec.digest.DigestUtils; //導入方法依賴的package包/類
public ImageTileSource getImageTileSource() {
  if (tcache == null) {
    // FIXME: There's no guarantee that getGameName() and getGameVersion()
    // are properly set at this point.

    final String hstr =
      DigestUtils.shaHex(getGameName() + "_" + getGameVersion());

    final File tc = new File(Info.getConfDir(), "tiles/" + hstr);
    tcache = new ImageTileDiskCache(tc.getAbsolutePath());
  }

  return tcache;
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:15,代碼來源:GameModule.java

示例7: generateConfigSignature

import org.apache.commons.codec.digest.DigestUtils; //導入方法依賴的package包/類
/**
 * 生成 config接口 signature
 * @param noncestr noncestr
 * @param jsapi_ticket jsapi_ticket
 * @param timestamp timestamp
 * @param url url
 * @return sign
 */
public static String generateConfigSignature(String noncestr,String jsapi_ticket,String timestamp,String url){
	Map<String, String> map = new HashMap<String, String>();
	map.put("noncestr", noncestr);
	map.put("jsapi_ticket", jsapi_ticket);
	map.put("timestamp", timestamp);
	map.put("url", url);
	
	Map<String, String> tmap = MapUtil.order(map);
	String str = MapUtil.mapJoin(tmap,true,false);
	return DigestUtils.shaHex(str);
}
 
開發者ID:luotuo,項目名稱:springboot-security-wechat,代碼行數:20,代碼來源:JsUtil.java

示例8: getMeetingKey

import org.apache.commons.codec.digest.DigestUtils; //導入方法依賴的package包/類
public static String getMeetingKey(Long toolSessionId, String attendeePassword) {

	/*
	 * We hash the attendee's password to be used as part of the meetingKey.
	 * The main reason for this is so we can keep this unique in case there are many
	 * other instances that use the same BBB server
	 */
	return "bbb_" + DigestUtils.shaHex(attendeePassword) + "-" + toolSessionId;
    }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:10,代碼來源:BbbUtil.java

示例9: pushWhenNoDuplicate

import org.apache.commons.codec.digest.DigestUtils; //導入方法依賴的package包/類
@Override
protected void pushWhenNoDuplicate(Request request) {

    Jedis jedis = pool.getResource();
    try {
        jedis.rpush(getQueueKey(request.getSpiderName()), request.getUrl());
        String field = DigestUtils.shaHex(request.getUrl());
        String value = JSON.toJSONString(request);
        jedis.hset((ITEM_PREFIX + request.getUrl()), field, value);
    } finally {
        jedis.close();
    }

}
 
開發者ID:fengzhizi715,項目名稱:NetDiscovery,代碼行數:15,代碼來源:RedisQueue.java

示例10: apacheApiVariations

import org.apache.commons.codec.digest.DigestUtils; //導入方法依賴的package包/類
public static void apacheApiVariations() {

        printHex(DigestUtils.getMd2Digest().digest("123".getBytes()));
        printHex(DigestUtils.getMd5Digest().digest("123".getBytes()));
        printHex(DigestUtils.getDigest("md2").digest("123".getBytes()));
        printHex(DigestUtils.getDigest("md5").digest("123".getBytes()));
        DigestUtils.md2("123".getBytes());
        DigestUtils.md5("123".getBytes());
        System.out.println(DigestUtils.md2Hex("123".getBytes()));
        System.out.println(DigestUtils.md5Hex("123".getBytes()));

        printHex(DigestUtils.getSha1Digest().digest("123".getBytes()));
        printHex(DigestUtils.getShaDigest().digest("123".getBytes()));
        printHex(DigestUtils.getDigest("sha1").digest("123".getBytes()));
        printHex(DigestUtils.getDigest("sha-1").digest("123".getBytes()));
        DigestUtils.sha1("123".getBytes());
        DigestUtils.sha("123".getBytes());
        DigestUtils.sha1Hex("123".getBytes());
        DigestUtils.shaHex("123".getBytes());

        printHex(DigestUtils.getDigest("sha256").digest("123".getBytes())); //OK!
        printHex(DigestUtils.getDigest(getDigest()).digest("123".getBytes())); //Unknown
    }
 
開發者ID:blackarbiter,項目名稱:Android_Code_Arbiter,代碼行數:24,代碼來源:WeakMessageDigest.java

示例11: encrypt

import org.apache.commons.codec.digest.DigestUtils; //導入方法依賴的package包/類
public String encrypt( String rawTxt ) {
	if( rawTxt==null ) {
		return null;
	}
	return DigestUtils.shaHex( rawTxt );
}
 
開發者ID:yswang0927,項目名稱:ralasafe,代碼行數:7,代碼來源:ShaEncrypt.java

示例12: tileName

import org.apache.commons.codec.digest.DigestUtils; //導入方法依賴的package包/類
/**
 * Gets the name of a tile file.
 *
 * @param iname the image name
 * @param tileX the X coordinate of the tile
 * @param tileY the Y coordinate of the tile
 * @param div the scale divisor
 * @return the name of the tile file
 */
public static String tileName(String iname, int tileX, int tileY, int div) {
  final String sha = DigestUtils.shaHex(
    iname + "(" + tileX + "," + tileY + "@1:" + div
  );

  return sha.substring(0, 1) + '/' + sha.substring(0, 2) + '/' + sha;
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:17,代碼來源:TileUtils.java

示例13: generateEventMessageSignature

import org.apache.commons.codec.digest.DigestUtils; //導入方法依賴的package包/類
/**
 * 生成事件消息接收簽名
 * @param token token
 * @param timestamp timestamp
 * @param nonce nonce
 * @return str
 */
public static String generateEventMessageSignature(String token, String timestamp,String nonce) {
	String[] array = new String[]{token,timestamp,nonce};
	Arrays.sort(array);
	String s = StringUtils.arrayToDelimitedString(array, "");
	return DigestUtils.shaHex(s);
}
 
開發者ID:luotuo,項目名稱:springboot-security-wechat,代碼行數:14,代碼來源:SignatureUtil.java


注:本文中的org.apache.commons.codec.digest.DigestUtils.shaHex方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。