def calc_encryption_key(subject_number: int, loop_size: int) -> int:
    """For a parm subject number (a PK) and loop size, return the encryption key."""

    # "Transforming the subject number of 17807724 (the door's public key) with a loop size of 8 (the card's loop size)
    # produces the encryption key, 14897079."
    result = 1

    for loop in range(loop_size):
        result = (result * subject_number) % 20201227

    return result