Cache2 File Name Hash

Hi everyone,

I am new to this forum, and I hope this is an appropriate area to post this question.

I’m studying the cache2 functionality to help write a security tool as a hobby and learning project. Unfortunately, I am struggling to understand the cache file naming functionality. All available sources online suggest the file name is simply the entire website URL hashed using an SHA-1 hexadecimal digest. However, I cannot verify if this is still the method used as most online sources are antiquated. At the same time, my attempts at recreating file names yield different results than what tools like MZCacheView are displaying.

Example:
Using the SHA-1 Hex Digest function in Python returns different results than MZCacheView

hashlib.sha1(b"https://www.tradingview.com").hexdigest()

‘dd077399487d0179ec6bf666f6794e1eec741160’

I’m currently trying to identify the problem (e.g. wrong hashing algorithm, misusing MZCacheView, etc.) Any help would be deeply appreciated! Thanks!

Hi,
I had the same problem. It’s a bit old post but I don’t know if you were able to solve it. There’s this github of a python Firefox Cache Parser (https://github.com/JamesHabben/FirefoxCache2).

The URL you extract from the metadata is not the same as shown in MZCacheView. It has some trailing characters. With the parser, you can eventually get a b’string’ (‘key’ variable in the script) which you will be able to sha1 and get the appropriate cache name.