41 Commits

Author SHA1 Message Date
data-man
77bb2dc094 Use writer in benchmarks 2020-06-25 19:07:25 -04:00
Vexu
e2a0f5741d
Merge pull request #5189 from zigazeljko/patch-1
Split AES struct into AESEncrypt and AESDecrypt
2020-05-16 13:20:14 +03:00
Vexu
85fd484f07
std: fix blake3 assignment to constant 2020-05-04 14:45:36 +03:00
Žiga Željko
130435a17a Split AES struct into AESEncrypt and AESDecrypt 2020-04-28 04:52:42 +08:00
Timon Kruiper
c829f2f7b7 Add mips support to standard library 2020-04-24 15:28:55 -04:00
Jay Petacat
0dbf8aaab8
crypto: fix benchmark compile error (#4919) 2020-04-02 23:46:46 -04:00
Andrew Kelley
9e7ae06249
std lib API deprecations for the upcoming 0.6.0 release
See #3811
2020-03-30 14:23:22 -04:00
Andrew Kelley
f614d94faa
update std lib to take advantage of slicing with comptime indexes 2020-03-19 14:48:47 -04:00
Andrew Kelley
1d7861a36e
fix incorrect sentinel check 2020-03-19 13:18:14 -04:00
xackus
00be934569 short std.builtin enum literals in std lib 2020-03-01 13:57:41 -05:00
Andrew Kelley
1d06c82c3b
Merge pull request #4516 from xackus/remove-bytes-to-slice
remove @bytesToSlice, @sliceToBytes from the language
2020-02-24 13:51:47 -05:00
J.W
5275b01202 hashing algorithms: fix logic and index out of bounds 2020-02-24 13:43:54 -05:00
xackus
783e8ad031 remove @bytesToSlice, @sliceToBytes from std lib 2020-02-21 19:46:53 +01:00
daurnimator
ef4ecaa462
std: add AEAD modes for gimli 2020-02-06 00:21:26 +11:00
daurnimator
b495512175
add gimli to crypto hash benchmark 2020-02-06 00:16:00 +11:00
Jay Petacat
cb2c14e03f blake3: Workaround issue #4373 with named types 2020-02-02 18:44:50 -05:00
Jay Petacat
923e567c6d blake3: Replace &arr with arr[0..] for slice args 2020-02-02 14:59:36 -05:00
Jay Petacat
b143fc0d32 blake3: Name and const pointer refinements 2020-02-02 14:42:57 -05:00
Jay Petacat
d098e212ad blake3: Convert *const [n]u8 types to [n]u8
I do not see many cases of constant pointers to arrays in the stdlib.
In fact, this makes the code run a little faster, probably because Zig
automatically converts to pointers where it makes sense.
2020-02-02 14:08:10 -05:00
Jay Petacat
4b86c1e3bb crypto: Add BLAKE3 hashing algorithm
This is a translation of the [official reference implementation][1] with
few other changes. The bad news is that the reference implementation is
designed for simplicity and not speed, so there's a lot of room for
performance improvement. The good news is that, according to the crypto
benchmark, the implementation is still fast relative to the other
hashing algorithms:

```
         md5: 430 MiB/s
        sha1: 386 MiB/s
      sha256: 191 MiB/s
      sha512: 275 MiB/s
    sha3-256: 233 MiB/s
    sha3-512: 137 MiB/s
     blake2s: 464 MiB/s
     blake2b: 526 MiB/s
      blake3: 576 MiB/s
    poly1305: 1479 MiB/s
    hmac-md5: 653 MiB/s
   hmac-sha1: 553 MiB/s
 hmac-sha256: 222 MiB/s
      x25519: 8685 exchanges/s
```

[1]: https://github.com/BLAKE3-team/BLAKE3
2020-02-01 23:03:23 -05:00
Ryan Liptak
834218d789 Fix remaining variadic formatted prints
Used a series of regex searches to try to find as many instances of the old pattern as I could and update them.
2020-01-09 13:36:44 -05:00
Andrew Kelley
5575e2a168
std.mem.compare: breaking API changes
* `std.mem.Compare` is now `std.math.Order` and the enum tags
   renamed to follow new style convention.
 * `std.mem.compare` is renamed to `std.mem.order`.
 * new function `std.math.order`
2020-01-01 18:08:40 -05:00
lukechampine
ab093228f9
Fix segfault by not reassigning to function parameter 2019-12-30 13:53:09 -05:00
lukechampine
d1a570a4b8
chacha: Fix open docstring 2019-12-30 13:35:16 -05:00
lukechampine
d6ca2323cf
chacha: Use error set instead of bool 2019-12-30 13:35:13 -05:00
lukechampine
1953b60599
chacha20poly1305: Return false on short ciphertext 2019-12-30 13:35:05 -05:00
lukechampine
ae7bb4ecc0
chacha20poly1305: verify tag in constant time 2019-12-30 13:34:57 -05:00
lukechampine
fbe7d8c1cb
crypto: Add chacha20poly1305 2019-12-30 13:34:53 -05:00
Andrew Kelley
8b2622cdd5
std.fmt.format: tuple parameter instead of var args 2019-12-08 22:53:51 -05:00
data-man
80a72c225c Crypto benchmark fixes 2019-12-06 17:14:10 -05:00
Andrew Kelley
bf3ac66150
remove type coercion from array values to references
* Implements #3768. This is a sweeping breaking change that requires
   many (trivial) edits to Zig source code. Array values no longer
   coerced to slices; however one may use `&` to obtain a reference to
   an array value, which may then be coerced to a slice.

 * Adds `IrInstruction::dump`, for debugging purposes. It's useful to
   call to inspect the instruction when debugging Zig IR.

 * Fixes bugs with result location semantics. See the new behavior test
   cases, and compile error test cases.

 * Fixes bugs with `@typeInfo` not properly resolving const values.

 * Behavior tests are passing but std lib tests are not yet. There
   is more work to do before merging this branch.
2019-11-27 03:37:50 -05:00
Andrew Kelley
47f06be369
string literals are now null terminated
this also deletes C string literals from the language, and then makes
the std lib changes and compiler changes necessary to get the behavior
tests and std lib tests passing again.
2019-11-21 20:43:41 -05:00
Andrew Kelley
0237e7a701 std.io.getStdOut and related fns no longer can error
Thanks to the Windows Process Environment Block, it is possible to
obtain handles to the standard input, output, and error streams without
possibility of failure.
2019-11-13 04:01:40 +00:00
Andrew Kelley
aa0daea541
update more of the std lib to use @as 2019-11-08 15:57:25 -05:00
Andrew Kelley
e0db54e89d
update the codebase to use @as 2019-11-08 15:57:24 -05:00
lukechampine
3d907b2943 crypto: Add support for AES-CTR 2019-11-05 11:33:11 -05:00
data-man
42ccdc2765 Replace AES variables to constants 2019-11-04 17:43:14 -05:00
Luke Champine
eb95afbc66
remove speculative AES TODOs 2019-11-04 13:59:26 -05:00
lukechampine
f403aa6cee crypto: Add AES implementation 2019-11-01 22:42:25 -04:00
SamTebbs33
bed4bfa69a Replace code occurences of --override-std-dir with --override-lib-dir 2019-10-01 07:29:24 -04:00
Andrew Kelley
ed36dbbd9c
mv std/ lib/
that's all this commit does. further commits will fix cli flags and
such.

see #2221
2019-09-25 23:35:41 -04:00