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 {
3535 pub const Poly1305 = @import("crypto/poly1305.zig").Poly1305;
3636};
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
4047/// Core functions, that should rarely be used directly by applications.
4148pub const core = struct {
......@@ -72,6 +79,20 @@ const std = @import("std.zig");
7279pub const randomBytes = std.os.getrandom;
7380
7481test "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
7596 _ = @import("crypto/aes.zig");
7697 _ = @import("crypto/blake2.zig");
7798 _ = @import("crypto/blake3.zig");
......@@ -79,7 +100,7 @@ test "crypto" {
79100 _ = @import("crypto/gimli.zig");
80101 _ = @import("crypto/hmac.zig");
81102 _ = @import("crypto/md5.zig");
82 _ = @import("crypto/kdf.zig");
103 _ = @import("crypto/pbkdf2.zig");
83104 _ = @import("crypto/poly1305.zig");
84105 _ = @import("crypto/sha1.zig");
85106 _ = @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}