| ... | ... | @@ -4,6 +4,48 @@ |
| 4 | 4 | // The MIT license requires this copyright notice to be included in all copies |
| 5 | 5 | // and substantial portions of the software. |
| 6 | 6 | |
| 7 | /// Authenticated Encryption with Associated Data |
| 8 | pub const aead = struct { |
| 9 | const chacha20 = @import("crypto/chacha20.zig"); |
| 10 | |
| 11 | pub const Gimli = @import("crypto/gimli.zig").Aead; |
| 12 | pub const ChaCha20Poly1305 = chacha20.Chacha20Poly1305; |
| 13 | pub const XChaCha20Poly1305 = chacha20.XChacha20Poly1305; |
| 14 | pub const AEGIS128L = @import("crypto/aegis.zig").AEGIS128L; |
| 15 | pub const AEGIS256 = @import("crypto/aegis.zig").AEGIS256; |
| 16 | }; |
| 17 | |
| 18 | /// Authentication (MAC) functions. |
| 19 | pub const auth = struct { |
| 20 | pub const hmac = @import("crypto/hmac.zig"); |
| 21 | pub const siphash = @import("crypto/siphash.zig"); |
| 22 | }; |
| 23 | |
| 24 | /// Core functions, that should rarely be used directly by applications. |
| 25 | pub const core = struct { |
| 26 | pub const aes = @import("crypto/aes.zig"); |
| 27 | pub const Gimli = @import("crypto/gimli.zig").State; |
| 28 | |
| 29 | /// Modes are generic compositions to construct encryption/decryption functions from block ciphers and permutations. |
| 30 | /// |
| 31 | /// These modes are designed to be building blocks for higher-level constructions, and should generally not be used directly by applications, as they may not provide the expected properties and security guarantees. |
| 32 | /// |
| 33 | /// Most applications may want to use AEADs instead. |
| 34 | pub const modes = @import("crypto/modes.zig"); |
| 35 | }; |
| 36 | |
| 37 | /// Diffie-Hellman key exchange functions. |
| 38 | pub const dh = struct { |
| 39 | pub const X25519 = @import("crypto/25519/x25519.zig").X25519; |
| 40 | }; |
| 41 | |
| 42 | /// Elliptic-curve arithmetic. |
| 43 | pub const ecc = struct { |
| 44 | pub const Curve25519 = @import("crypto/25519/curve25519.zig").Curve25519; |
| 45 | pub const Edwards25519 = @import("crypto/25519/edwards25519.zig").Edwards25519; |
| 46 | pub const Ristretto255 = @import("crypto/25519/ristretto255.zig").Ristretto255; |
| 47 | }; |
| 48 | |
| 7 | 49 | /// Hash functions. |
| 8 | 50 | pub const hash = struct { |
| 9 | 51 | pub const Md5 = @import("crypto/md5.zig").Md5; |
| ... | ... | @@ -15,21 +57,9 @@ pub const hash = struct { |
| 15 | 57 | pub const Gimli = @import("crypto/gimli.zig").Hash; |
| 16 | 58 | }; |
| 17 | 59 | |
| 18 | | /// Authentication (MAC) functions. |
| 19 | | pub const auth = struct { |
| 20 | | pub const hmac = @import("crypto/hmac.zig"); |
| 21 | | pub const siphash = @import("crypto/siphash.zig"); |
| 22 | | }; |
| 23 | | |
| 24 | | /// Authenticated Encryption with Associated Data |
| 25 | | pub const aead = struct { |
| 26 | | const chacha20 = @import("crypto/chacha20.zig"); |
| 27 | | |
| 28 | | pub const Gimli = @import("crypto/gimli.zig").Aead; |
| 29 | | pub const ChaCha20Poly1305 = chacha20.Chacha20Poly1305; |
| 30 | | pub const XChaCha20Poly1305 = chacha20.XChacha20Poly1305; |
| 31 | | pub const AEGIS128L = @import("crypto/aegis.zig").AEGIS128L; |
| 32 | | pub const AEGIS256 = @import("crypto/aegis.zig").AEGIS256; |
| 60 | /// Key derivation functions. |
| 61 | pub const kdf = struct { |
| 62 | pub const hkdf = @import("crypto/hkdf.zig"); |
| 33 | 63 | }; |
| 34 | 64 | |
| 35 | 65 | /// MAC functions requiring single-use secret keys. |
| ... | ... | @@ -57,31 +87,6 @@ pub const pwhash = struct { |
| 57 | 87 | pub const pbkdf2 = @import("crypto/pbkdf2.zig").pbkdf2; |
| 58 | 88 | }; |
| 59 | 89 | |
| 60 | | /// Core functions, that should rarely be used directly by applications. |
| 61 | | pub const core = struct { |
| 62 | | pub const aes = @import("crypto/aes.zig"); |
| 63 | | pub const Gimli = @import("crypto/gimli.zig").State; |
| 64 | | |
| 65 | | /// Modes are generic compositions to construct encryption/decryption functions from block ciphers and permutations. |
| 66 | | /// |
| 67 | | /// These modes are designed to be building blocks for higher-level constructions, and should generally not be used directly by applications, as they may not provide the expected properties and security guarantees. |
| 68 | | /// |
| 69 | | /// Most applications may want to use AEADs instead. |
| 70 | | pub const modes = @import("crypto/modes.zig"); |
| 71 | | }; |
| 72 | | |
| 73 | | /// Elliptic-curve arithmetic. |
| 74 | | pub const ecc = struct { |
| 75 | | pub const Curve25519 = @import("crypto/25519/curve25519.zig").Curve25519; |
| 76 | | pub const Edwards25519 = @import("crypto/25519/edwards25519.zig").Edwards25519; |
| 77 | | pub const Ristretto255 = @import("crypto/25519/ristretto255.zig").Ristretto255; |
| 78 | | }; |
| 79 | | |
| 80 | | /// Diffie-Hellman key exchange functions. |
| 81 | | pub const dh = struct { |
| 82 | | pub const X25519 = @import("crypto/25519/x25519.zig").X25519; |
| 83 | | }; |
| 84 | | |
| 85 | 90 | /// Digital signature functions. |
| 86 | 91 | pub const sign = struct { |
| 87 | 92 | pub const Ed25519 = @import("crypto/25519/ed25519.zig").Ed25519; |