File containing its own checksum

后端 未结 12 1661
误落风尘
误落风尘 2020-12-23 13:16

Is it possible to create a file that will contain its own checksum (MD5, SHA1, whatever)? And to upset jokers I mean checksum in plain, not function calculating it.

12条回答
  •  时光说笑
    2020-12-23 14:13

    You can of course, but in that case the SHA digest of the whole file will not be the SHA you included, because it is a cryptographic hash function, so changing a single bit in the file changes the whole hash. What you are looking for is a checksum calculated using the content of the file in way to match a set of criteria.

提交回复
热议问题