And how to know?Yes. Changing any character to a different character leaves size unchanged, but checksums would differ.
Umm, alright, ok.A bit flips because of cosmic rays and its still same size, with a different character code.
You record a checksum taken on the known uncorrupted version, then compare to a checksum, using the very same program used to create the first, taken on the suspected corrupted version. If they don't match then there has been one or more changes in the 2nd copy. If they match then they are identical.And how to know?
Can file be corrupted, even if size unchanged? Thanks.
Yes. For example, "size" could become "eize". ;-)Can a file be corrupted while having the same eize?
No, I not doing such deep stuff. I only storing original size in bytes (logs).You record a checksum taken on the known uncorrupted version, then compare to a checksum, using the very same program used to create the first, taken on the suspected corrupted version. If they don't match then there has been one or more changes in the 2nd copy. If they match then they are identical.
C:\>powershell
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell [url=https://aka.ms/pscore6]https://aka.ms/pscore6[/url]
PS C:\> Get-FileHash *.* -Algorithm MD5 > \temp\MD5_sums.txt
PS C:\> exit
C:\>
Algorithm Hash Path
--------- ---- ----
MD5 D9EBEC6668A6092FCBD1713C347AA5E0 C:\autoexec.bat
MD5 ED4FC5980BD8B1AD869FF725C7776338 C:\config.sys
MD5 2F25C43273A10EE038518BD68B177966 C:\exelist.txt
MD5 1DE223B9ED10E519311D2B9BC48FB651 C:\junk.txt
MD5 9C78D40D5758BC788AF84BD5E09D1465 C:\Log.txt
MD5 949A9099694308AA2099DABB2855BF91 C:\Reflect_Install.log
That's as far from a valid method of file verification as you can get.No, I not doing such deep stuff. I only storing original size in bytes (logs).
You need to perform some sort of checksum method (MD5, SHA, or whatever you want) to verify the integrity of any file.No, I not doing such deep stuff. I only storing original size in bytes (logs).
Thanks. So, if bytes size identical it's doesn't matter?You could use Windows' in-built Powershell from the CMD prompt to compute the checksums of your files. The following session computes the MD5 hashes for all files in the specified path and writes the results to a log file (\temp\MD5_sums.txt).
Code:C:\>powershell Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Try the new cross-platform PowerShell [url=https://aka.ms/pscore6]https://aka.ms/pscore6[/url] PS C:\> Get-FileHash *.* -Algorithm MD5 > \temp\MD5_sums.txt PS C:\> exit C:\>
Code:Algorithm Hash Path --------- ---- ---- MD5 D9EBEC6668A6092FCBD1713C347AA5E0 C:\autoexec.bat MD5 ED4FC5980BD8B1AD869FF725C7776338 C:\config.sys MD5 2F25C43273A10EE038518BD68B177966 C:\exelist.txt MD5 1DE223B9ED10E519311D2B9BC48FB651 C:\junk.txt MD5 9C78D40D5758BC788AF84BD5E09D1465 C:\Log.txt MD5 949A9099694308AA2099DABB2855BF91 C:\Reflect_Install.log
Absolutely NOT. As an example, by your method, a file containing financial data is recorded as 100 Bytes. Now, I come along and replace that file with another file containing exactly 100 Bytes of completely random garbage. Use the same filename, put it in the same place with the same size (100 Bytes) and your method will conclude that the file is completely unchanged. Checksums prevent this.Thanks. So, if bytes size identical it's doesn't matter?
So I should completely delete everything and hashing every file? Bruh, it's a bit difficult.Absolutely NOT. As an example, by your method, a file containing financial data is recorded as 100 Bytes. Now, I come along and replace that file with another file containing exactly 100 Bytes of completely random garbage. Use the same filename, put it in the same place with the same size (100 Bytes) and your method will conclude that the file is completely unchanged. Checksums prevent this.
Thanks. So, if bytes size identical it's doesn't matter?
C:\>echo abc > abc.txt
C:\>echo bbc > bbc.txt
C:\>powershell
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell [url=https://aka.ms/pscore6]https://aka.ms/pscore6[/url]
PS C:\> Get-FileHash ?bc.txt -Algorithm MD5 > \temp\MD5_sums.txt
PS C:\> exit
C:\>type \temp\MD5_sums.txt
Algorithm Hash Path
--------- ---- ----
MD5 20ABE48E15DEAF253A389062CF29DF72 C:\abc.txt
MD5 7514E5791EACB3FCC134C2FEC37FF9C2 C:\bbc.txt
Well, if you don't want to do things the proper way then I'm done here.So I should completely delete everything and hashing every file? Bruh, it's a bit difficult.
I see. You right, thanks.Well, if you don't want to do things the proper way then I'm done here.
Byte 1 | Byte 2 | Byte 3 | Byte 4 | Byte 5 | Byte 6 | Byte 7 | Byte 8 | |
Non corrupted | 00 | 01 | 02 | 03 | 04 | 05 | 06 | 07 |
Corrupted | FF | 01 | 02 | 03 | 04 | DE | AD | 07 |
Hash sum (MD5, SH1) is a must for the server, I see.If you're trying to detect corruption based on file size, consider this scenario:
Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6 Byte 7 Byte 8 Non corrupted 00 01 02 03 04 05 06 07 Corrupted FF 01 02 03 04 DE AD 07
These two files are going to show up as being 8 bytes long. Now without looking at the bytes themselves, tell me, which one is corrupted?
I using FIlezilla in Windows, not really my option.BTRFS is a file system that automatically appends checksums to data and metadata.
https://en.wikipedia.org/wiki/Btrfs
Nothing important, mediaWhat data are you trying to protect and detect?
And how to know?