0

I need to output by file the sha1 checksum into an output file. Several of the files are > than 8gb if that makes a difference and the entire directory contains ~28K files.

This is what I need the output file to look like:

SHA1(Windows printed document-1.pdf)= 1c1e2844be6e9ddd995941388b98c12a8b7a1e8d
SHA1(Windows printed document.pdf)= 4ea8a157c5d8d0fc9c38aa6312d120ab425900a0
SHA1(checklist.chk)= c5f9e078578925ef3de1e6075b0777d75296bb8f
...

This is the code so far:

openssl dgst -sha1 * > ~/Desktop/output.txt

This code works great for small files or smallish directories but it's throwing an exception that the argument list is too large when I try to put it into production.

jww
  • 97,681
  • 90
  • 411
  • 885
  • 1
    Probably something like [Bash command line and input limit](https://stackoverflow.com/q/19354870/608639). You should probably add a script and unroll things a bit. Use `find` and `for each` file found. Maybe something like [How to loop through file names returned by find?](https://stackoverflow.com/q/9612090/608639) – jww Jun 30 '17 at 01:06
  • Thanks! Sounds like a good place to start. I'll give it a shot and answer my question I suppose. – kevincicero Jul 01 '17 at 03:03

1 Answers1

0

Try hashdeep -c sha1 -r $DIR or find $DIR -print0 -type f | xargs -0 -I {} sha1sum {} > output.txt

assafmo
  • 1,047
  • 3
  • 15
  • 32