How ipfs able to detect to download only block that contains the changed character?

For example userA added a file sized 1 GB. ipfs add file.tar.gz and userB get that file into his local storage through ipfs.

Later userA released a mistake and changed only a single character on the file and wants to share this updated version with userB with newly generated hash.

When userB* gets that newly generated hash, how ipfs will handle to detect the new block to fetch. Will it go through all the hashes of the chunks and checks that weather they exists on their local storage?


Example:
Step 1:

userA:

$ mkdir folder
$ cd folder
$ fallocate -l 1G gentoo_root.img
$ fallocate -l 1G gentoo_root_static.img
$ ipfs add -r .
added QmdiETTY5fiwTkJeERbWAbPKtzcyjzMEJTJJosrqo2qKNm folder/gentoo_root.img
added QmdiETTY5fiwTkJeERbWAbPKtzcyjzMEJTJJosrqo2qKNm folder/gentoo_root_fix.img
added QmXrG14cBN4yz7wnkWCQgcApjiyMUszBP4oPftwGJawzxx folder
 2.00 GiB / 2.00 GiB [=================================================] 100.00%

userB:

$ ipfs get QmXrG14cBN4yz7wnkWCQgcApjiyMUszBP4oPftwGJawzxx
Saving file(s) to QmXrG14cBN4yz7wnkWCQgcApjiyMUszBP4oPftwGJawzxx
 2.00 GB / 2.00 GB [==================================] 100.00% 49s

// Here I assume that transmitted data size should be 2 GB and repo size should be increase for 2 GB. So communication and cache cost will be for 2 GB.


Step 2:

userA:

$ cd folder
$ echo 'hello' >> gentoo_root.img
$ ipfs add -r .
added Qmew8yVjNzs2r54Ti6R64W9psxYFd16X3yNY28gZS4YeM3 folder/gentoo_root.img
added QmdiETTY5fiwTkJeERbWAbPKtzcyjzMEJTJJosrqo2qKNm folder/gentoo_root_fix.img
added QmRT279mp9tE4vcgwpPZuxhxCgexKPecNoFLgxXwcJagmt junk
 2.00 GiB / 2.00 GiB [=================================================] 100.00%

userB:

$ ipfs get QmRT279mp9tE4vcgwpPZuxhxCgexKPecNoFLgxXwcJagmt
Saving file(s) to QmRT279mp9tE4vcgwpPZuxhxCgexKPecNoFLgxXwcJagmt
 2.00 GB / 2.00 GB [=========================] 100.00% 45s

  • At this point as I understand from the answer of a question I asked before, if the data is already stored it does not re-downloaded again.

They will not fetch the full 1GB, only the block that contains the changed character

[Q] Since it will fetch only the block that contains the changed character, in order to detect the block that has the changed character; will ipfs go through all the hash of the chunkes where it will eventually download all the hash of the chunks along the the updated block?