I see a bunch of FOSS projects which have ".sha256" files. They look something like this:
dsdfdfdsffdfsdfdsfdsfdsfdsfdsfds23r2ewrefdefdsfdsgfdsgffgfkgdfgg *meow.exe
Asdfdfdsffdfsdfdsfdsfdsfdsfdsfds23r2ewrefdefdsfdsgfdsgffgfkgdfg3 cool_stuff.exe
dsdfdfdsfDdfsdfdsfdsfdsfdsfdsfds23r2ewrefdefdsfdsgfdsgffg3kgdfgg even_more_stuff.exe
I currently get these out with:
#^([A-Za-z0-9]{64})\s+(\S+)$#um
That will match dsdfdfdsffdfsdfdsfdsfdsfdsfdsfds23r2ewrefdefdsfdsgfdsgffgfkgdfgg
and *meow.exe
, etc. Filenames that mysteriously begin with an asterisk (I've countless times tried to look this up without getting any wise as to what this means) are stripped off their beginning *
.
Is there anything more to it than that? What happens if the filenames have spaces in them instead of underscores? Then my regexp breaks down. Can they be quoted? If so, is Linux (single quotes) or Windows-style (double quotes) quoting used?
This seemingly simple file format actually has countless questions associated with it, but I don't see it defined anywhere. Nor have I ever so far encountered filenames which use spaces or quotes of any kind. But they do use asterisks, which apparently can also appear in the end of the filename...
How should this madness be parsed to not break one day?
*
indicator can sometimes come in at the end, I think all you really need to do is adapt for the possibility of spaces, underscores, hyphens, etc. (but likely not quotes) if you want the broadest solution possible.