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); } }
String getStringDigest(Key key) { return com.bumptech.glide.util.Util.sha256BytesToHex(getDigest(key)); } }
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; } }
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); } }
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; } }