0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
zig/std
Marc Tiehuis 51fdbf7f8c Add Md5 and Sha1 hash functions
Some performance comparisons to C.

We take the fastest time measurement taken across multiple runs.

The block hashing functions use the same md5/sha1 methods.

```
Cpu: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
Gcc: 7.2.1 20171224
Clang: 5.0.1
Zig: 0.1.1.304f6f1d
```

See https://www.nayuki.io/page/fast-md5-hash-implementation-in-x86-assembly:

```
gcc -O2
    661 Mb/s
clang -O2
    490 Mb/s
zig --release-fast and zig --release-safe
    570 Mb/s
zig
    50 Mb/s
```

See https://www.nayuki.io/page/fast-sha1-hash-implementation-in-x86-assembly:

```
gcc -O2
    588 Mb/s
clang -O2
    563 Mb/s
zig --release-fast and zig --release-safe
    610 Mb/s
zig
    21 Mb/s
```

In short, zig provides pretty useful tools for writing this sort of
code. We are in the lead against clang (which uses the same LLVM
backend) with us being slower only against md5 with GCC.
History 2018-01-13 14:40:21 +13:00
..
c Darwin -> MacOSX, added Zen. See #438 2018-01-06 23:10:53 -05:00
crypto Add Md5 and Sha1 hash functions 2018-01-13 14:40:21 +13:00
debug replace a %% b with a catch b 2018-01-07 17:28:20 -05:00
fmt remove %% prefix operator 2018-01-09 00:51:51 -05:00
math Add integer rotation functions 2018-01-13 13:23:12 +13:00
os remove %% prefix operator 2018-01-09 00:51:51 -05:00
special remove %% prefix operator 2018-01-09 00:51:51 -05:00
zlib c-to-zig: return statement 2017-09-01 03:16:35 -04:00
array_list.zig remove %% prefix operator 2018-01-09 00:51:51 -05:00
base64.zig remove %% prefix operator 2018-01-09 00:51:51 -05:00
buf_map.zig replace %return with try 2018-01-07 16:53:13 -05:00
buf_set.zig replace %return with try 2018-01-07 16:53:13 -05:00
buffer.zig remove %% prefix operator 2018-01-09 00:51:51 -05:00
build.zig remove %% prefix operator 2018-01-09 00:51:51 -05:00
cstr.zig replace %return with try 2018-01-07 16:53:13 -05:00
dwarf.zig better stack traces for ELF x86_64 2017-04-24 12:14:45 -04:00
elf.zig replace %return with try 2018-01-07 16:53:13 -05:00
empty.zig recognize ar program and pass --gc-sections to ld 2016-05-11 14:44:10 -07:00
endian.zig Fix endian swap parameters 2018-01-11 19:50:08 +13:00
hash_map.zig remove %% prefix operator 2018-01-09 00:51:51 -05:00
heap.zig remove %% prefix operator 2018-01-09 00:51:51 -05:00
index.zig Add Md5 and Sha1 hash functions 2018-01-13 14:40:21 +13:00
io.zig replace %return with try 2018-01-07 16:53:13 -05:00
io_test.zig remove %% prefix operator 2018-01-09 00:51:51 -05:00
linked_list.zig Intrusive linked lists 2018-01-10 00:33:07 -05:00
mem.zig remove %% prefix operator 2018-01-09 00:51:51 -05:00
net.zig remove %% prefix operator 2018-01-09 00:51:51 -05:00
rand.zig remove %% prefix operator 2018-01-09 00:51:51 -05:00
rand_test.zig std: add tests for mt32 and mt64 2016-07-28 20:14:57 -07:00
sort.zig remove %% prefix operator 2018-01-09 00:51:51 -05:00
unicode.zig remove %% prefix operator 2018-01-09 00:51:51 -05:00