| ... | ... | @@ -35,7 +35,14 @@ pub const onetimeauth = struct { |
| 35 | 35 | pub const Poly1305 = @import("crypto/poly1305.zig").Poly1305; |
| 36 | 36 | }; |
| 37 | 37 | |
| 38 | | pub 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. |
| 43 | pub const kdf = struct { |
| 44 | pub const pbkdf2 = @import("crypto/pbkdf2.zig").pbkdf2; |
| 45 | }; |
| 39 | 46 | |
| 40 | 47 | /// Core functions, that should rarely be used directly by applications. |
| 41 | 48 | pub const core = struct { |
| ... | ... | @@ -72,6 +79,20 @@ const std = @import("std.zig"); |
| 72 | 79 | pub const randomBytes = std.os.getrandom; |
| 73 | 80 | |
| 74 | 81 | test "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 | 96 | _ = @import("crypto/aes.zig"); |
| 76 | 97 | _ = @import("crypto/blake2.zig"); |
| 77 | 98 | _ = @import("crypto/blake3.zig"); |
| ... | ... | @@ -79,7 +100,7 @@ test "crypto" { |
| 79 | 100 | _ = @import("crypto/gimli.zig"); |
| 80 | 101 | _ = @import("crypto/hmac.zig"); |
| 81 | 102 | _ = @import("crypto/md5.zig"); |
| 82 | | _ = @import("crypto/kdf.zig"); |
| 103 | _ = @import("crypto/pbkdf2.zig"); |
| 83 | 104 | _ = @import("crypto/poly1305.zig"); |
| 84 | 105 | _ = @import("crypto/sha1.zig"); |
| 85 | 106 | _ = @import("crypto/sha2.zig"); |