Update Readme Files

This commit is contained in:
2025-11-13 23:56:05 +00:00
parent e51c5184e9
commit 5c33d45112
11 changed files with 155 additions and 153 deletions

15
salt.py
View File

@@ -78,6 +78,11 @@ def _build_parser() -> argparse.ArgumentParser:
default="pbkdf2",
help="Hash-Algorithmus (Standard: pbkdf2)",
)
subparsers.add_parser(
"list-algorithms", help="Zeigt alle verfügbaren Hash-Algorithmen an."
)
return parser
@@ -86,7 +91,7 @@ def _normalize_args(argv: Sequence[str] | None) -> list[str]:
if not argv:
return []
# If it starts with a subcommand, leave as-is
if argv[0] in {"hash", "verify"}:
if argv[0] in {"hash", "verify", "list-algorithms"}:
return list(argv)
# If it starts with help flags, leave as-is
if argv[0] in {"-h", "--help"}:
@@ -104,6 +109,14 @@ def main(argv: Sequence[str] | None = None) -> int:
arg_list = list(argv) if argv is not None else sys.argv[1:]
args = parser.parse_args(_normalize_args(arg_list))
if args.command == "list-algorithms":
from algorithms import list_algorithms
print("Verfügbare Algorithmen:")
for algo in list_algorithms():
print(f" - {algo}")
return 0
if args.command == "verify":
if verify_password(args.password, args.salt, args.hash, algorithm=args.algorithm):
print("✓ Passwort korrekt")