diff options
author | Andreas Stieger <astieger@suse.com> | 2017-05-08 22:57:38 +0300 |
---|---|---|
committer | Andreas Stieger <astieger@suse.com> | 2017-05-08 23:01:52 +0300 |
commit | 8ea89fd82714f7193212a984857ea42f283b204c (patch) | |
tree | 93281856d4cc3bd84b00fcd0eb1fd374db9512fc | |
parent | a53ad6f1675a123e9e709be57dd7cec324be18bf (diff) |
support reading from stdin
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | src/main.c | 6 |
2 files changed, 6 insertions, 1 deletions
@@ -51,6 +51,7 @@ Examples: ``` bin/sha1dcsum test/sha1_reducedsha_coll.bin test/shattered-1.pdf bin/sha1dcsum_partialcoll test/sha1reducedsha_coll.bin test/shattered-1.pdf +pipe_data | bin/sha1dcsum - ``` ## Library usage @@ -60,7 +60,11 @@ int main(int argc, char** argv) SHA1DCSetDetectReducedRoundCollision(&ctx2, 1); } - fd = fopen(argv[i], "rb"); + if(!strcmp(argv[i],"-")) { + fd = stdin; + } else { + fd = fopen(argv[i], "rb"); + } if (fd == NULL) { fprintf(stderr, "cannot open file: %s: %s\n", argv[i], strerror(errno)); |