Skip to content

Commit 88489d5

Browse files
author
Paul Dreik
committed
default first/last bytess size to 4096
1 parent 94e87cc commit 88489d5

File tree

4 files changed

+23
-8
lines changed

4 files changed

+23
-8
lines changed

Options.hh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ struct Options
3636
long nsecsleep = 0; // number of nanoseconds to sleep between each file read.
3737
std::string resultsfile = "results.txt"; // results file name.
3838
std::uint64_t first_bytes_size =
39-
64; // how much to read during the "read first bytes" step
39+
4096; // how much to read during the "read first bytes" step
4040
std::uint64_t last_bytes_size =
41-
64; // how much to read during the "read last bytes" step
41+
4096; // how much to read during the "read last bytes" step
4242
/// checksum used for first and last bytes
4343
checksumtypes checksum_for_firstlast_bytes =
4444
#ifdef HAVE_LIBXXHASH

testcases/md5collisions.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,17 @@ mkdir md5coll
1111
cp "$testscriptsdir/md5collisions/"*.ps md5coll
1212
sync
1313

14+
# set small first/last bytes sizes
15+
firstlastoptions="-firstbytessize 64 -lastbytessize 64"
16+
1417
#make sure nothing happens when using sha
15-
$rdfind -checksum sha1 -deleteduplicates true md5coll 2>&1 | tee rdfind.out
18+
# shellcheck disable=SC2086
19+
$rdfind $firstlastoptions -checksum sha1 -deleteduplicates true md5coll 2>&1 | tee rdfind.out
1620
grep -q "^Deleted 0 files.$" rdfind.out
1721
dbgecho "using sha1 did not delete any files, as expected"
1822

19-
$rdfind -checksum md5 -deleteduplicates true md5coll 2>&1 | tee rdfind.out
23+
# shellcheck disable=SC2086
24+
$rdfind $firstlastoptions -checksum md5 -deleteduplicates true md5coll 2>&1 | tee rdfind.out
2025
grep -q "^Deleted 1 files.$" rdfind.out
2126
dbgecho "using md5 did delete files, as expected"
2227

testcases/sha1collisions.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@ set -e
66

77
reset_teststate
88

9+
# set small first/last bytes sizes
10+
firstlastoptions="-firstbytessize 64 -lastbytessize 64"
11+
912
#unpack collisions example from https://shattered.it/static/shattered.pdf
1013
base64 --decode <"$testscriptsdir/sha1collisions/coll.tar.bz2.b64" | tar xvfj -
1114

1215
#make sure nothing happens when using sha256
13-
$rdfind -checksum sha256 -deleteduplicates true . 2>&1 | tee rdfind.out
16+
# shellcheck disable=SC2086
17+
$rdfind $firstlastoptions -checksum sha256 -deleteduplicates true . 2>&1 | tee rdfind.out
1418
grep -q "^Deleted 0 files.$" rdfind.out
1519
dbgecho "using sha256 did not delete any files, as expected"
1620

17-
$rdfind -checksum sha1 -deleteduplicates true . 2>&1 | tee rdfind.out
21+
# shellcheck disable=SC2086
22+
$rdfind $firstlastoptions -checksum sha1 -deleteduplicates true . 2>&1 | tee rdfind.out
1823
grep -q "^Deleted 1 files.$" rdfind.out
1924
dbgecho "using sha1 did delete the files, as expected"
2025

testcases/verify_nochecksum.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,19 @@ makefiles() {
2424
reset_teststate
2525
makefiles
2626

27+
# set small first/last to small sizes
28+
firstlastoptions="-firstbytessize 64 -lastbytessize 64"
29+
2730
# with no checksum, we should falsely believe the files are equal
28-
$rdfind -checksum none a* b* \
31+
# shellcheck disable=SC2086
32+
$rdfind $firstlastoptions -checksum none a* b* \
2933
| grep "files that are not unique" >output.log
3034

3135
verify [ "$(cat output.log)" = "It seems like you have 2 files that are not unique" ]
3236

3337
# with checksumming (the default) the files should not be considered equal.
34-
$rdfind -checksum sha1 a* b* \
38+
# shellcheck disable=SC2086
39+
$rdfind $firstlastoptions -checksum sha1 a* b* \
3540
| grep "files that are not unique" >output.log
3641

3742
verify [ "$(cat output.log)" = "It seems like you have 0 files that are not unique" ]

0 commit comments

Comments
 (0)