# SPDX-FileCopyrightText: © 2026 Joe T. Sylve, Ph.D. <joe.sylve@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later

"""
Embedded keystream table for the QSPICE ``.prot`` cipher.

QSPICE XORs the compressed payload with two keystreams: a Mersenne Twister
stream (see :mod:`spice_crypt.qspice.cipher`) and this fixed 9973-byte table,
walked with a seed-derived stride.  The table is a fixed constant of the QSPICE
protection scheme; it is stored here as base64 to keep the source file plain
text.  See SPECIFICATIONS/qspice.md Section 3.2 and Appendix A.

``KEYSTREAM_TABLE_LEN`` (9973) is prime, which is why the additive stride walk
visits every offset before repeating for any nonzero stride (a zero stride
stays on a single offset).
"""

import base64

KEYSTREAM_TABLE_LEN = 9973

# base64 of the 9973-byte keystream table; SHA-256:
# bfd3ff9339f28056922c167e92daffbb10668e993aef4ac7ff3dd6d662004df3
_KEYSTREAM_B64 = (
    "daSZRhncoigA7m5ui+t7gFs3g439XtsskDXi/TO+/kETAsxbXq+kS10fuQ/RXfB/3G5jMXFwrfvJby7VFDz0yulbS3zlCbYQ"
    "5bofyI2+BVesMYKuqFICNzipKluj99LfQcpFQypp25H8M4mjI+FD/8rxvk1Bsoqe2DHj7YzZ2ZM2AVAdekaDk/8+E5Wsb3Da"
    "2yScCfqQkH7cyVqG1rIrxR+nTT0BfAZL+I4j+JA7IASQ9liBix2KCkUEVHsvn45oCHHvm7a1ASNNmWN10BhBEaVVeW45f6W9"
    "/ZWf/gtQNV4J/HwvHY40HBwA5dtl6NoFpFndQ01kdfIkzMF5biF/MTjUW/42PGqSSDlAs2DuFO/2xEM7AWB3tUTWkA+M1h8i"
    "6yyC6NF8utqFIfMOurKbUN4LEVmaO1Zvtz/nw9VSAtgM19FmoPFvZLKPRRnywGyBteoVivo9u9b5jjzmZQ4dQZKRTISajEB1"
    "355bDVn3Jm9U92b9l8krDwPVt7gBL8t5/FavXmliRsag4s8n5hfxUxuvjIxSe1rWLOVbSAR6obGhl/qDGTBYbIumLwxlbIoU"
    "mcLgYx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iFJEiGSFCUPhUOghPLpo"
    "iH9JLiu+f/8m2Xc8hqA119oopRrrFe/VRW+U4X6jaMt+MI99YYMqRPif4STgLd4afWjny55eJH5GZsMmHs+gTu1WOr3yvWEy"
    "1yEgsXouYWmKRM9m9apUgQmTqT+amL7QZMti04PYw4J7DXJeblsyMb6Nhvw8BOqNW/I0fk+zaqsvl2/D96hDraXtbfsEMUAd"
    "LovkWwLCuEYqzAfGGCmF8fTh8XVCjOas9u4cNeqyb772E9j18i7CQMRcZzUERy4vztIHq9MlgvL5m980qwCbNjf4k6sk9GeG"
    "Mgt7XM1QAjkad76oc+X4rimUdhTGCV3YLqhmhWrWveRVX2GywqxBtPprg/+GZn38P72CzVrwkyVFuldcKMDZ46QeXY09lClj"
    "DU6bmlweP67F5RMj0dZrZB/Z+Rw95F2u908WSKJ/mj5D24pn0xhLgujIisFtajDSmGYlo+hk9qnQ1A8mZXMURT5limOTSL+b"
    "sERsFMDHqT6rOWQKIuSe88xveWviB5H9qodPd82hknnVWbewvrWJN+4+SWmJixW6TcW3i3HJia2+jXsP11LfFPiqpea05CnY"
    "8irJ5k37RWuKPunT10U/OVEMt7REdKhxafyGttlUQxvwMaPM7JSELYFZkMhsnHpaoJlsyz7z5oGt0MVHgZy/36bQc5i3dXIn"
    "Q9LpAx7zydpLpCx0a9rWJHc0t5TQ5EelyDm8/G2r4+9MOED4VseF0LOA8qtJbpWaOUMC9JFc3s0SLC/tq17skk4mgzSu1k8j"
    "2srfZ4r7wI+fPH0gknB2V9zel/ertJMF8TatZfKGRPejAT71o2MYCo8laqzrPxEvnOXPAbjl0+slakftxbg1Ana/qss5KbP/"
    "X0v/uXz6b7XfA+LpBo60ABKGe7q5NkSRK88LXx5EB7E2TzCCNzIvtY0zERnz4QFqw9MMB6shsx2Aj1musJMsyhXVqWIjh5jh"
    "W2dqCIgbA1+OyEcMz7OgJzJjBy8UaLHUnTN+XCoTNUBc5xRhcASnNhU0fxjZaNZ5o+JzRPCB7M9USRO3ZkjG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L/4egeyJE8+iWJSo8/eJbYf7x99Bo77K1IwH/pXYeLRAH+C+8Hd90RgtMbiy6e5VH6Hs7vttOE6"
    "OrafqMHAMoZ9hCRW23Vm3Aozu8HQYkUNJm4leDraghykCwvRF09Q/F7+wxtZekletDQk543KjswRuohLesfv4msULn/TLUmt"
    "ZOX1IdYIUyiIsnO1WYOMh1cYIhs9ZWuGQUvAt9HHpnf3X3a9gRVgg7PPliH5mLCbLxoFgZ25WT+KU5u4yOeWuwnXNV0mec4N"
    "VxHG4eotYRLVIHbtbJDeA43fMOvUWA4CLoeUDUShAq/vyDcgwA=="
)

KEYSTREAM_TABLE = base64.b64decode(_KEYSTREAM_B64)

if len(KEYSTREAM_TABLE) != KEYSTREAM_TABLE_LEN:  # pragma: no cover - static data
    raise RuntimeError("QSPICE keystream table corrupt")
