How to fix a corrupted .txt file

Given a uniform distribution of bytes in your file, and analyzing the data for entropy, the file looks random. The entropy (for 1-tuples) is 7.61 Shannon. This is really near 8 Shannon, the redundancy in your data is insignificant und looks like random error. Of course your file is way too small for proper analysis, but it looks as if

  1. Your file was compressed before, which is unlikely if the file extension was txt and no (known to me) compression header is present.
  2. Your file was encrypted.
  3. You chose to secure erase the disk while formatting.

I think it's most likely the third option. No way to restore it.


Depending on the level of corruption, I have had varying success using the strings command, which might or might not reveal some of your previously entered data in text format. For example, if I were interested in human readable strings stored in the kernel binary, I would use it as follows :

$ strings /mach_kernel | head -5
"%s[KERNEL]: %s"@/SourceCache/xnu/xnu-2050.22.13/osfmk/default_pager/default_pager.c:175
alloc pager thread
"%s[KERNEL]: %s"@/SourceCache/xnu/xnu-2050.22.13/osfmk/default_pager/default_pager.c:179
alloc thread buffer
"%s[KERNEL]: %s"@/SourceCache/xnu/xnu-2050.22.13/osfmk/default_pager/default_pager.c:186

Other than that, you could try other recovery tools from different vendors (for example Disk Drill, or any other of the half a dozen that show up on a regular google search) to see if they remedy your situation by generating a more suitable/readable data recovery file from your formatting the hard drive.

Some of the tools I have used with success in the past (helping fellow poor souls out) include software from the YoDot or iSkySoft.

All of which probably use the exact same mechanism to recover "lost" files