1

I have a phone database /data/user/0/com.miui.gallery/databases/gallery.db containing information such as exif data and file name. there is a column sha1 containing value

e89cfb34fbea51e225ab9e17fa3a15cb171cd2d4

I lost the phone and MicroSD Card so the original files are lost. However there is a cache directory /storage/emulated/0/Android/data/com.miui.gallery/files/gallery_disk_cache/full_size containing thumbnails in 750x1000 resolution.

I identified a picture which is the preview for the above entry. However the file name cannot be found in the database. also the mtime is slightly different, although I am sure that is the same picture.

the file name of the thumbnail picture is (I don't know what it is)

57818493be39acef0f61b5530ead56a244cc9f50672635f49f1c5e31b1f33ad0.0

the calculated sha1 and sha2 of the thumbnail picture is

277a7e182228906ca92dd969d4929a6171da3f8b
1366c580e9f8e6ed28347401942934bc8d3ac7257112033e2a40c49f5973b253

assuming the thumbnail file name is the sha2 of the original picture, is there any way to assign the sha2 to sha1 without having the file? maybe with bruteforce or something?

4
  • 1
    If the file name in gallery.db with or without path? Because assuming the contained SHA-1 value is from the original image file it doesn't make sense to lookup the thumbnail by the hash of the original file data hash. Calculating the hash is pretty CPU intensive, especially for JPEG images it may be faster to load the JPEG image directly in a lower resolution than calculating the hash for looking up the thumbnail.
    – Robert
    Commented Mar 9, 2023 at 10:48
  • @Robert how does the app know which thumbnail to use?
    – alecxs
    Commented Mar 9, 2023 at 12:18
  • The fastes way would be to use the file path and meta data like last modified and lookup this in gallery.db. It is possible that the thumbnail file-name hash is not on the picture content but on its file-name and meta-data. To see how the database and the thumbnails are generated I would try to decompile the gallery app.
    – Robert
    Commented Mar 9, 2023 at 13:18
  • I also have a snapshot of the disk, so I have the file metadata. But I don't know how to look at on f2fs file system. However I have uploaded example database here
    – alecxs
    Commented Mar 13, 2023 at 20:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.