DescriptorDigest getDigestFromFilename(Path layerFile) throws CacheCorruptedException {
    try {
      String hash = layerFile.getFileName().toString();
      return DescriptorDigest.fromHash(hash);

    } catch (DigestException | IndexOutOfBoundsException ex) {
      throw new CacheCorruptedException(
          cacheDirectory, "Layer file did not include valid hash: " + layerFile, ex);
    }
  }
Gets the diff ID portion of the layer filename.

@param layerFile the layer file to parse for the diff ID
@return the diff ID portion of the layer file filename
@throws CacheCorruptedException if no valid diff ID could be parsed
jib-core/src/main/java/com/google/cloud/tools/jib/cache/CacheStorageFiles.java