Skip to content

hash performance sha256 vs. sha512 #209

@ThomasWaldmann

Description

@ThomasWaldmann

I just learned that sha512 is faster than sha256 (on 64bit platforms, see benchmark below). attic uses sha256 at some places, could/should it be replaced by sha512?

Attic uses hmac-sha256. I did similar measurements for hmac-sha256 and -sha512 and the speed was as shown below.

$ python3.2 -m timeit -r 10 -s 'from hashlib import new; h = new("sha256"); x=b"foobar"*1000000' 'h.update(x)'
10 loops, best of 10: 29.2 msec per loop

$ python3.2 -m timeit -r 10 -s 'from hashlib import new; h = new("sha512"); x=b"foobar"*1000000' 'h.update(x)'
100 loops, best of 10: 18.6 msec per loop

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions