summaryrefslogtreecommitdiff
path: root/trunk/scripts/checksum-benchmark
blob: 5f70017938b8632e32d54d00295247c524bc4ecb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
#
# Compare various checksum algorithms for speed.

set -e

algo()
{
    printf "%6s: " "$1"
    python -m timeit \
        -c \
        -s 'import hashlib' \
        -s 'data = file("test-plugins/test.cr2").read()' \
        "hashlib.new('$1', string=data)" 
}

algo md5
algo sha1
algo sha224
algo sha256
algo sha384
algo sha512