Skip to content

Commit 4b3f68c

Browse files
committed
Converted krypton file suffix and kdf context into constants
1 parent 185a64d commit 4b3f68c

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

quantcrypt/internal/cipher/krypton_kem.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from quantcrypt.internal.kdf.argon2_kdf import Argon2
1616
from quantcrypt.internal.pqa.base_kem import BaseKEM
1717
from quantcrypt.internal.chunksize import ChunkSize
18-
from quantcrypt.internal import utils
18+
from quantcrypt.internal import utils, constants as const
1919

2020

2121
__all__ = ["KryptonKEM"]
@@ -44,7 +44,7 @@ def __init__(
4444
self,
4545
kem_class: Type[BaseKEM],
4646
kdf_params: KDFParams = None,
47-
context: bytes = b"quantcrypt",
47+
context: bytes = const.KDFContext,
4848
callback: Optional[Callable] = None,
4949
chunk_size: ChunkSize.Atd = None
5050
) -> None:
@@ -111,7 +111,7 @@ def encrypt(
111111
raise FileNotFoundError(_in_file)
112112

113113
if output_file is None:
114-
_out_file = _in_file.with_suffix(".kptn")
114+
_out_file = _in_file.with_suffix(const.KryptonFileSuffix)
115115
else:
116116
_out_file = utils.resolve_relpath(output_file)
117117

quantcrypt/internal/cli/annotations.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
# SPDX-License-Identifier: MIT
1010
#
1111

12-
from typing import Annotated
1312
from typer import Option
13+
from typing import Annotated
14+
from quantcrypt.internal import constants as const
1415

1516

1617
__all__ = [
@@ -80,7 +81,8 @@
8081
EncOutFile = Annotated[str, Option(
8182
'--out-file', '-o', show_default=False, help=' '.join([
8283
"Path to the output file where the encrypted data will be written to, optional.",
83-
"Defaults to the Current Working Directory, using the data file name with the .kptn suffix."
84+
"Defaults to the Current Working Directory, using the data file name "
85+
f"with the {const.KryptonFileSuffix} suffix."
8486
])
8587
)]
8688

@@ -94,7 +96,7 @@
9496
DecOutFile = Annotated[str, Option(
9597
'--out-file', '-o', show_default=False, help=' '.join([
9698
"Path to the output file where the decrypted data will be written to, optional.",
97-
"Defaults to the Current Working Directory, using the original filename of the ",
99+
"Defaults to the Current Working Directory, using the original filename of the",
98100
"plaintext file that was stored into the ciphertext file."
99101
])
100102
)]

quantcrypt/internal/constants.py

+2
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ def armor_names(cls, pqa_type: PQAType | None = None) -> list[str]:
118118
if not pqa_type or spec.type == pqa_type]
119119

120120

121+
KDFContext = b"quantcrypt"
122+
KryptonFileSuffix = ".kptn"
121123
SupportedVariants = [PQAVariant.REF]
122124
AMDArches = ["x86_64", "amd64", "x86-64", "x64", "intel64"]
123125
ARMArches = ["arm_8", "arm64", "aarch64", "armv8", "armv8-a"]

0 commit comments

Comments
 (0)