Ole Tange wrote:

> Hi
>
> I have a couple of time wanted a checksumming filter,
> that will work like cat if the input matches the checksum
> and output nothing if it does not:
>
>   Get_untrusted_input |
>   sha256sum bf794518e35d7f1ce3a50b3058c4191bb9401e568fc645d77e10b0f404cf1f22 |
>   do something on the stream I now know matches the sum.
>
> Could we extend the *sum programs to support that?


The fact that *sum would need to consume/buffer all the input
would mean that the parallelism from the rest of the pipe is lost
(well I suppose the process startup overhead is parallelized).

I.E. it's functionally equivalent to:

  Get_untrused_input > /tmp/blah
  sha256sum -c <(echo "$chksum  /tmp/blah") &&
  ...
  rm /tmp/blah

I'm not sure generated input is a common enough usecase
to support that directly within sha256sum

cheers,
Pádraig

Reply via email to