You encrypt a file first, then you calculate hash of the encrypted file.
But let's not pretend this isn't a subtle backdoor that can invalidate the entire "E2E" implementation. I believe that in the US, having the filename and/or hash/checksum is most of what is necessary to trigger the Foregone conclusion doctrine and force the person to lose their 5th amendment protection and be compelled to decrypt their data to be used against themselves.
I'd like if someone with legal knowledge could comment if my understanding is correct.