本文整理汇总了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();
}
}
示例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;
}
示例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);
}
}
示例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;
}
}
示例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);
}
}
}
示例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;
}
示例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);
}
示例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;
}
示例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();
}
}
示例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
}
示例11: encrypt
import org.apache.commons.codec.digest.DigestUtils; //导入方法依赖的package包/类
public String encrypt( String rawTxt ) {
if( rawTxt==null ) {
return null;
}
return DigestUtils.shaHex( rawTxt );
}
示例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;
}
示例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);
}