File: sha1collisions.sh

package info (click to toggle)
rdfind 1.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 648 kB
  • sloc: cpp: 1,670; sh: 1,622; makefile: 32
file content (24 lines) | stat: -rwxr-xr-x 674 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
# Test for sha1 vs sha256


set -e
. "$(dirname "$0")/common_funcs.sh"


reset_teststate

#unpack collisions exampel from https://shattered.it/static/shattered.pdf
base64 --decode <$testscriptsdir/sha1collisions/coll.tar.bz2.b64 |tar xvfj -

#make sure nothing happens when using sha256
$rdfind  -checksum sha256 -deleteduplicates true . 2>&1 |tee rdfind.out
grep -q "^Deleted 0 files.$" rdfind.out
dbgecho "using sha256 did not delete any files, as expected"

$rdfind  -checksum sha1 -deleteduplicates true . 2>&1 |tee rdfind.out
grep -q "^Deleted 1 files.$" rdfind.out
dbgecho "using sha1 did delete the files, as expected"


dbgecho "all is good in this test!"