Logic behind storing images

Kirby stores the cropped, resized, compressed version of a photo in the media folder. The logic is:

media / pages / page-name / some-hash / image

Whats the logic behind this hash? Is it ever being recreated? If so, when will the has being recreated and will that hash be the same or does the name change?

The reason for this question is. I had some images index by google. Unfortunately that hash got somehow recreated leaving the images in the Google search for some time, but only in the blury Google cached version.

The purpose of the hash is to invalidate the media cache when the file is modified. Here is the relevant method

	public function mediaHash(): string
	{
		return $this->mediaToken() . '-' . $this->modifiedFile();
	}

Please see the underlying mediaToken() method for details how this token is created.

thanks. Ok, so uploading a new image would obviously trigger it. But it seems that changing the alt tag would not make the hash to change.
What about replacing an image? … even if it has the same filename?

Replacing an image should change the file modification stamp in the filesystem. After all, a file with the same name can be a completely different file.