If you open a port on a listening host and send bytes with nc to this port, the hash of the source and destination file might not be the same. Why is that and can it be prevented?
Here are the commands i use:
On the receiver:
bash@ubuntu $ nc -nlvp 4444 > target # at 192.168.155.51
On the sender:
powershell@windows $ Get-Content binaryFile.exe | nc 192.168.155.51 4444
SHA256 of the source (calculated with Get-FileHash
):
FFECB298B1381AFBF86247156F625EAECA327015C5BC0658F6FF6E063D59D759
SHA256 of the target (sha256sum
): 1c1148ace41bc0d22c1523787c64fb34abba456551d62387a085d12c36d34452