com.bumptech.glide.util.Util.sha256BytesToHex()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(270)

本文整理了Java中com.bumptech.glide.util.Util.sha256BytesToHex()方法的一些代码示例,展示了Util.sha256BytesToHex()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.sha256BytesToHex()方法的具体详情如下:
包路径:com.bumptech.glide.util.Util
类名称:Util
方法名:sha256BytesToHex

Util.sha256BytesToHex介绍

[英]Returns the hex string of the given byte array representing a SHA256 hash.
[中]

代码示例

代码示例来源:origin: bumptech/glide

  1. private String calculateHexStringDigest(Key key) {
  2. PoolableDigestContainer container = Preconditions.checkNotNull(digestPool.acquire());
  3. try {
  4. key.updateDiskCacheKey(container.messageDigest);
  5. // calling digest() will automatically reset()
  6. return Util.sha256BytesToHex(container.messageDigest.digest());
  7. } finally {
  8. digestPool.release(container);
  9. }
  10. }

代码示例来源:origin: bumptech/glide

  1. String getStringDigest(Key key) {
  2. return com.bumptech.glide.util.Util.sha256BytesToHex(getDigest(key));
  3. }
  4. }

代码示例来源:origin: guolindev/giffun

  1. public String getSafeKey(Key key) {
  2. String safeKey;
  3. synchronized (loadIdToSafeHash) {
  4. safeKey = loadIdToSafeHash.get(key);
  5. }
  6. if (safeKey == null) {
  7. try {
  8. MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
  9. key.updateDiskCacheKey(messageDigest);
  10. safeKey = Util.sha256BytesToHex(messageDigest.digest());
  11. } catch (UnsupportedEncodingException e) {
  12. e.printStackTrace();
  13. } catch (NoSuchAlgorithmException e) {
  14. e.printStackTrace();
  15. }
  16. synchronized (loadIdToSafeHash) {
  17. loadIdToSafeHash.put(key, safeKey);
  18. }
  19. }
  20. return safeKey;
  21. }
  22. }

代码示例来源:origin: mozilla-tw/Rocket

  1. private String calculateHexStringDigest(Key key) {
  2. PoolableDigestContainer container = digestPool.acquire();
  3. try {
  4. key.updateDiskCacheKey(container.messageDigest);
  5. // calling digest() will automatically reset()
  6. return Util.sha256BytesToHex(container.messageDigest.digest());
  7. } finally {
  8. digestPool.release(container);
  9. }
  10. }

代码示例来源:origin: REBOOTERS/AndroidAnimationExercise

  1. public String getSafeKey(Key key) {
  2. String safeKey;
  3. synchronized (loadIdToSafeHash) {
  4. safeKey = loadIdToSafeHash.get(key);
  5. }
  6. if (safeKey == null) {
  7. try {
  8. MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
  9. key.updateDiskCacheKey(messageDigest);
  10. safeKey = Util.sha256BytesToHex(messageDigest.digest());
  11. } catch (NoSuchAlgorithmException e) {
  12. e.printStackTrace();
  13. }
  14. synchronized (loadIdToSafeHash) {
  15. loadIdToSafeHash.put(key, safeKey);
  16. }
  17. }
  18. return safeKey;
  19. }
  20. }

相关文章