本文整理了Java中com.bumptech.glide.util.Util.sha256BytesToHex()
方法的一些代码示例,展示了Util.sha256BytesToHex()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.sha256BytesToHex()
方法的具体详情如下:
包路径:com.bumptech.glide.util.Util
类名称:Util
方法名:sha256BytesToHex
[英]Returns the hex string of the given byte array representing a SHA256 hash.
[中]
代码示例来源:origin: bumptech/glide
private String calculateHexStringDigest(Key key) {
PoolableDigestContainer container = Preconditions.checkNotNull(digestPool.acquire());
try {
key.updateDiskCacheKey(container.messageDigest);
// calling digest() will automatically reset()
return Util.sha256BytesToHex(container.messageDigest.digest());
} finally {
digestPool.release(container);
}
}
代码示例来源:origin: bumptech/glide
String getStringDigest(Key key) {
return com.bumptech.glide.util.Util.sha256BytesToHex(getDigest(key));
}
}
代码示例来源:origin: guolindev/giffun
public String getSafeKey(Key key) {
String safeKey;
synchronized (loadIdToSafeHash) {
safeKey = loadIdToSafeHash.get(key);
}
if (safeKey == null) {
try {
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
key.updateDiskCacheKey(messageDigest);
safeKey = Util.sha256BytesToHex(messageDigest.digest());
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
synchronized (loadIdToSafeHash) {
loadIdToSafeHash.put(key, safeKey);
}
}
return safeKey;
}
}
代码示例来源:origin: mozilla-tw/Rocket
private String calculateHexStringDigest(Key key) {
PoolableDigestContainer container = digestPool.acquire();
try {
key.updateDiskCacheKey(container.messageDigest);
// calling digest() will automatically reset()
return Util.sha256BytesToHex(container.messageDigest.digest());
} finally {
digestPool.release(container);
}
}
代码示例来源:origin: REBOOTERS/AndroidAnimationExercise
public String getSafeKey(Key key) {
String safeKey;
synchronized (loadIdToSafeHash) {
safeKey = loadIdToSafeHash.get(key);
}
if (safeKey == null) {
try {
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
key.updateDiskCacheKey(messageDigest);
safeKey = Util.sha256BytesToHex(messageDigest.digest());
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
synchronized (loadIdToSafeHash) {
loadIdToSafeHash.put(key, safeKey);
}
}
return safeKey;
}
}
内容来源于网络,如有侵权,请联系作者删除!