code: private MessageDigest getDigest(String algorithm)
      {
          if (createdDigests == null)
              createdDigests = new HashMap<String, MessageDigest>();
  
          MessageDigest digest = createdDigests.get(algorithm);
  
          if (digest == null) {
              try {
                  digest = MessageDigest.getInstance(algorithm);
                  createdDigests.put(algorithm, digest);
              } catch (NoSuchAlgorithmException nsae) {
                  // ignore
              }
          }
          return digest;
      }
docs: get digest from cache