authorgravatar for 35231115+Rocknest@users.noreply.github.comRocknest <35231115+Rocknest@users.noreply.github.com> 2020-09-13 23:00:33+03:00
committergravatar for 35231115+Rocknest@users.noreply.github.comRocknest <35231115+Rocknest@users.noreply.github.com> 2020-09-13 23:00:33+03:00
logd75cbb01db4f7fb73c4382af4351dc0e393d5d39
tree85d3bca7eee389be8a537701a181b76b2882a30a
parentb6385870d0e65c5d7c6d7c6ef8c8ed33780b71e4

Reference all crypto declarations


2 files changed, 23 insertions(+), 19 deletions(-)

lib/std/crypto.zig+23-2
...@@ -35,7 +35,14 @@ pub const onetimeauth = struct {...@@ -35,7 +35,14 @@ pub const onetimeauth = struct {
35 pub const Poly1305 = @import("crypto/poly1305.zig").Poly1305;35 pub const Poly1305 = @import("crypto/poly1305.zig").Poly1305;
36};36};
3737
38pub const kdf = @import("crypto/kdf.zig");38/// A Key Derivation Function (KDF) is intended to turn a weak, human generated password into a
39/// strong key, suitable for cryptographic uses. It does this by salting and stretching the
40/// password. Salting injects non-secret random data, so that identical passwords will be converted
41/// into unique keys. Stretching applies a deliberately slow hashing function to frustrate
42/// brute-force guessing.
43pub const kdf = struct {
44 pub const pbkdf2 = @import("crypto/pbkdf2.zig").pbkdf2;
45};
3946
40/// Core functions, that should rarely be used directly by applications.47/// Core functions, that should rarely be used directly by applications.
41pub const core = struct {48pub const core = struct {
...@@ -72,6 +79,20 @@ const std = @import("std.zig");...@@ -72,6 +79,20 @@ const std = @import("std.zig");
72pub const randomBytes = std.os.getrandom;79pub const randomBytes = std.os.getrandom;
7380
74test "crypto" {81test "crypto" {
82 inline for (std.meta.declarations(std)) |decl| {
83 switch (decl.data) {
84 .Type => |t| {
85 std.meta.refAllDecls(t);
86 },
87 .Var => |v| {
88 _ = v;
89 },
90 .Fn => |f| {
91 _ = f;
92 },
93 }
94 }
95
75 _ = @import("crypto/aes.zig");96 _ = @import("crypto/aes.zig");
76 _ = @import("crypto/blake2.zig");97 _ = @import("crypto/blake2.zig");
77 _ = @import("crypto/blake3.zig");98 _ = @import("crypto/blake3.zig");
...@@ -79,7 +100,7 @@ test "crypto" {...@@ -79,7 +100,7 @@ test "crypto" {
79 _ = @import("crypto/gimli.zig");100 _ = @import("crypto/gimli.zig");
80 _ = @import("crypto/hmac.zig");101 _ = @import("crypto/hmac.zig");
81 _ = @import("crypto/md5.zig");102 _ = @import("crypto/md5.zig");
82 _ = @import("crypto/kdf.zig");103 _ = @import("crypto/pbkdf2.zig");
83 _ = @import("crypto/poly1305.zig");104 _ = @import("crypto/poly1305.zig");
84 _ = @import("crypto/sha1.zig");105 _ = @import("crypto/sha1.zig");
85 _ = @import("crypto/sha2.zig");106 _ = @import("crypto/sha2.zig");
lib/std/crypto/kdf.zig deleted-17
...@@ -1,17 +0,0 @@
1// SPDX-License-Identifier: MIT
2// Copyright (c) 2015-2020 Zig Contributors
3// This file is part of [zig](https://ziglang.org/), which is MIT licensed.
4// The MIT license requires this copyright notice to be included in all copies
5// and substantial portions of the software.
6
7//! A Key Derivation Function (KDF) is intended to turn a weak, human generated password into a
8//! strong key, suitable for cryptographic uses. It does this by salting and stretching the
9//! password. Salting injects non-secret random data, so that identical passwords will be converted
10//! into unique keys. Stretching applies a deliberately slow hashing function to frustrate
11//! brute-force guessing.
12
13pub const pbkdf2 = @import("pbkdf2.zig").pbkdf2;
14
15test "kdf" {
16 _ = @import("pbkdf2.zig");
17}