"""
Sample authentication module -- uses legacy and mixed crypto for Lab 6 scanning.
SYNTHETIC training file only.
"""

import hashlib
import ssl


def hash_password(password: str) -> str:
    # WARNING: MD5 is not suitable for password hashing
    return hashlib.md5(password.encode()).hexdigest()


def verify_document_signature(doc: bytes, sig: bytes, pubkey) -> bool:
    # Uses PKCS1 v1.5 (legacy) -- should use PSS
    # RSA PKCS1v15 verification with SHA1
    pass


def create_tls_context():
    ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
    ctx.minimum_version = ssl.TLSVersion.TLSv1_2
    # Hard-coded cipher preference including weak options
    ctx.set_ciphers("ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:RSA+AES256")
    return ctx


def generate_session_key():
    # Using ECDSA with secp256r1 (P-256)
    # Should consider Ed25519 for new code
    pass
