Skip to main content

A library for decrypting LTspice® and PSpice® encrypted files

Project description

SpiceCrypt

A specialized Python library for decrypting LTspice® and PSpice® encrypted model files. It supports both LTspice formats — the text-based format (.CIR, .SUB, .LIB, .ASY, and other files using a modified DES variant) and the Binary File format (a two-layer XOR stream cipher) — as well as six PSpice encryption modes (0–5, DES and AES-256 ECB), with automatic format detection.

Installation

Install from PyPI:

pip install spice-crypt

Or with uv:

uv tool install spice-crypt

Or add as a dependency to an existing project:

uv add spice-crypt

Updating

Update with pip:

pip install --upgrade spice-crypt

Or update a uv tool installation:

uv tool upgrade spice-crypt

Or update the dependency in a project:

uv lock --upgrade-package spice-crypt

Requirements

  • Python 3.10 or higher
  • No external dependencies

Command Line Usage

SpiceCrypt provides a spice-crypt command for decrypting LTspice and PSpice encrypted files.

# Run directly without installing
uvx spice-crypt path/to/encrypted_file.CIR

# Or after installation, decrypt to stdout
spice-crypt path/to/encrypted_file.CIR

# Decrypt to a file
spice-crypt -o output.cir path/to/encrypted_file.CIR

# Force overwrite if output file exists
spice-crypt -f -o output.cir path/to/encrypted_file.CIR

# Decrypt with verbose output (shows verification values)
spice-crypt --verbose path/to/encrypted_file.CIR

# Suppress all error messages
spice-crypt --quiet -o output.cir path/to/encrypted_file.CIR

# Process raw hex data (not LTspice format)
spice-crypt --raw path/to/hex_file.txt

# Show version
spice-crypt --version

# PSpice: brute-force recover a Mode 4 user key
spice-crypt --recover-key path/to/encrypted_file.LIB

# PSpice: decrypt with a user key
spice-crypt --user-key KEY path/to/encrypted_file.LIB

Python API

decrypt(data, is_ltspice_file=None)

Decrypt an in-memory string of encrypted data.

from spice_crypt import decrypt

with open("encrypted_file.CIR") as f:
    data = f.read()

plaintext, (v1, v2) = decrypt(data)
print(plaintext)

Parameters:

  • data (str): Encrypted data as a string (LTspice format or raw hex).
  • is_ltspice_file (bool, optional): Whether the data is in LTspice format. Auto-detected if None.

Returns: (plaintext, (v1, v2)): The decrypted text and a tuple of CRC-based verification values.

decrypt_stream(input_file, output_file=None, is_ltspice_file=None, user_key=None)

Stream-decrypt from a file path or file object. Supports LTspice formats (text-based hex/DES and Binary File) and PSpice formats ($CDNENCSTART/$CDNENCFINISH delimited blocks). When called with a file path, the format is auto-detected: files beginning with the Binary File signature are handled first, then PSpice markers are checked, and otherwise the text-based LTspice format is assumed.

from spice_crypt import decrypt_stream

# Decrypt file to file (format auto-detected)
_, verification = decrypt_stream("encrypted.CIR", "decrypted.cir")

# Decrypt file to string
plaintext, verification = decrypt_stream("encrypted.CIR")

# Use file objects directly
with open("encrypted.CIR") as infile:
    plaintext, verification = decrypt_stream(infile)

Parameters:

  • input_file: File path (str/PathLike) or file object (text or binary mode).
  • output_file (optional): File path (str) or binary-mode file object. If None, returns decrypted content as a string.
  • is_ltspice_file (bool, optional): Whether the input is in LTspice format. Auto-detected if None.
  • user_key (bytes, optional): Raw user key bytes for PSpice mode 4 decryption.

Returns: (content, (v1, v2)): content is the decrypted string if no output file was given, otherwise None. (v1, v2) are verification values — for the text-based format these are CRC-based checksums that should match the values on the file's End line; for the Binary File format they are a CRC-32 and rotate-left hash of the decrypted content; for PSpice format both are 0.

File Formats

SpiceCrypt supports two LTspice encryption formats and six PSpice encryption modes, all auto-detected when decrypting:

Text-Based DES Format

LTspice encrypted files in this format contain hex-encoded ciphertext wrapped in comment headers:

* LTspice Encrypted File
*
* This encrypted file has been supplied by a 3rd
* party vendor that does not wish to publicize
* the technology used to implement this library.
*
* Permission is granted to use this file for
* simulations but not to reverse engineer its
* contents.
*
* [Header Comments]
*
* Begin:
  A7 CD 92 6F EA 22 42 3D 95 5E D2 59 B6 03 E5 31
  67 06 C2 AF 8A BB 32 98 00 15 89 AF C1 15 0C D9
  ...additional hex data...
* End 1032371916 1759126504

The first 128 eight-byte blocks (1024 bytes) form the crypto table. All subsequent blocks are ciphertext. The two integers on the End line are CRC-based checksums used to verify decryption integrity.

Binary File Format

LTspice encrypted files in this format are binary files identified by a 20-byte signature (\r\n<Binary File>\r\n\r\n\x1a). They use a two-layer XOR stream cipher unrelated to the DES-based scheme. The file header contains two 32-bit keys used to derive a substitution table index and step value for decryption.

Specification

For detailed technical descriptions of the encryption schemes, see:

  • SPECIFICATIONS/ltspice.md — LTspice encryption: key derivation, pre-DES stream cipher layer, all deviations from standard DES, and the Binary File XOR stream cipher.
  • SPECIFICATIONS/pspice.md — PSpice encryption: six modes (0–5), custom DES variant, AES-256 ECB, key derivation, and mode 4 brute-force key recovery.
  • SPECIFICATIONS/pspice-attack-summary.md — Analysis of the PSpice mode 4 key derivation bug that reduces the effective keyspace from 2^256 to 2^32.

Purpose and Legal Basis

Many third-party component vendors distribute SPICE models exclusively as LTspice- or PSpice-encrypted files. This encryption locks the models to a single simulator, preventing their use in open-source and alternative tools such as NGSpice, Xyce, PySpice, and others. SpiceCrypt exists to restore interoperability by allowing engineers to use lawfully obtained models in the simulator of their choice.

This type of reverse engineering for interoperability is specifically permitted by law:

  • United States: 17 U.S.C. § 1201(f) permits circumvention of technological protection measures for the sole purpose of achieving interoperability between independently created programs. Section 1201(f)(2) explicitly allows distributing the tools developed for this purpose to others seeking interoperability. Additionally, § 1201(g) permits circumvention when conducted in good-faith encryption research — studying the flaws and vulnerabilities of encryption technologies — and allows dissemination of the research findings.
  • European Union: Article 6 of the Software Directive (2009/24/EC) permits decompilation and reverse engineering when it is indispensable to achieve interoperability with independently created programs. Article 6(3) provides that this right cannot be overridden by contract.

Research Contributors

  • Joe T. Sylve, Ph.D. — Reverse engineering and documentation of the LTspice text-based DES encryption format and PSpice encryption modes.
  • Lucas Gerads — Reverse engineering and documentation of the LTspice Binary File encryption format.

Trademarks

LTspice® is a registered trademark of Analog Devices, Inc.
PSpice® is a registered trademark of Cadence Design Systems, Inc.

License

This project is licensed under the GNU Affero General Public License v3.0 or later.

Copyright (c) 2026 Joe T. Sylve, Ph.D.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spice_crypt-2.0.0rc2.tar.gz (98.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

spice_crypt-2.0.0rc2-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (284.9 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

spice_crypt-2.0.0rc2-cp314-cp314t-win_arm64.whl (179.5 kB view details)

Uploaded CPython 3.14tWindows ARM64

spice_crypt-2.0.0rc2-cp313-cp313t-win_arm64.whl (179.7 kB view details)

Uploaded CPython 3.13tWindows ARM64

spice_crypt-2.0.0rc2-cp310-abi3-win_arm64.whl (181.1 kB view details)

Uploaded CPython 3.10+Windows ARM64

spice_crypt-2.0.0rc2-cp310-abi3-win_amd64.whl (186.0 kB view details)

Uploaded CPython 3.10+Windows x86-64

spice_crypt-2.0.0rc2-cp310-abi3-musllinux_1_2_x86_64.whl (497.8 kB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

spice_crypt-2.0.0rc2-cp310-abi3-musllinux_1_2_aarch64.whl (453.2 kB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

spice_crypt-2.0.0rc2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (284.4 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

spice_crypt-2.0.0rc2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (275.6 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

spice_crypt-2.0.0rc2-cp310-abi3-macosx_11_0_arm64.whl (249.8 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

spice_crypt-2.0.0rc2-cp310-abi3-macosx_10_12_x86_64.whl (260.9 kB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file spice_crypt-2.0.0rc2.tar.gz.

File metadata

  • Download URL: spice_crypt-2.0.0rc2.tar.gz
  • Upload date:
  • Size: 98.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for spice_crypt-2.0.0rc2.tar.gz
Algorithm Hash digest
SHA256 8faa5c362d181c7189236c38583a76cf1a2f63701f91ac088022a55fa563ab5d
MD5 ff0d50e4f03fb07afeeb2e226b4fe304
BLAKE2b-256 01be2145cb97826ec5e26d7823a37255f876330ba66480530796ac118f22962a

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0rc2.tar.gz:

Publisher: publish.yml on jtsylve/spice-crypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spice_crypt-2.0.0rc2-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for spice_crypt-2.0.0rc2-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b8442ae8d48f66f978222734b980b0129287d1bd4b62002c9ef2f502a61463a1
MD5 cad1a3debf8b714d58c70d8b8b451259
BLAKE2b-256 d26b399072c50e8a34ab11f9b00dc1be12d9006d8d56f8884be01f23aa4564e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0rc2-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on jtsylve/spice-crypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spice_crypt-2.0.0rc2-cp314-cp314t-win_arm64.whl.

File metadata

File hashes

Hashes for spice_crypt-2.0.0rc2-cp314-cp314t-win_arm64.whl
Algorithm Hash digest
SHA256 4e7e25fc04e01d6b5a57c8532b64e0ad0cfa8088b23c4ccd07feb871c54e6f8a
MD5 1066ded47921ed540aca00db5c5094c9
BLAKE2b-256 97bcd844276775f709dfeb8dd0c0bd904cba1a7a20f0306f1b4693bf97374fef

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0rc2-cp314-cp314t-win_arm64.whl:

Publisher: publish.yml on jtsylve/spice-crypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spice_crypt-2.0.0rc2-cp313-cp313t-win_arm64.whl.

File metadata

File hashes

Hashes for spice_crypt-2.0.0rc2-cp313-cp313t-win_arm64.whl
Algorithm Hash digest
SHA256 f50aee5190f1fa79ee411493490b520ee004f8e460d31ee406483b76f24620bb
MD5 fddf40f10c432b833fb53950b78abcf7
BLAKE2b-256 efa37a095258beb75f9a07036e271322c0f7f51d38563db5d442fdf431a4a9e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0rc2-cp313-cp313t-win_arm64.whl:

Publisher: publish.yml on jtsylve/spice-crypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spice_crypt-2.0.0rc2-cp310-abi3-win_arm64.whl.

File metadata

File hashes

Hashes for spice_crypt-2.0.0rc2-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 3f2cb816bcc657cf01c93716c6df5656daf68ab887954c99545ffe8bd9baa223
MD5 5322372ebfb466b3b98a6b9ede610835
BLAKE2b-256 5716b403ccae5e8d5e232b50ecdb6c807ddac9fa10558e0a8e5fbbb2c830af87

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0rc2-cp310-abi3-win_arm64.whl:

Publisher: publish.yml on jtsylve/spice-crypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spice_crypt-2.0.0rc2-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for spice_crypt-2.0.0rc2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 16f304c5108850c374c4d54ff558733e4562f0ef8cd6f9b8f9e3830aa19388b5
MD5 beda92feb7d1701d1bec066898210c4c
BLAKE2b-256 20d6e3a73691b192a2b13dabf097f5111a29d66aa14d0485182c638c4987c5bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0rc2-cp310-abi3-win_amd64.whl:

Publisher: publish.yml on jtsylve/spice-crypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spice_crypt-2.0.0rc2-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for spice_crypt-2.0.0rc2-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 3cd3eb480feeca93e1e87bca324841d5b11ac97f336f7b11bc6b4c06b0bc8998
MD5 02ea7c449f51aa191903921a2eccaea5
BLAKE2b-256 5685cb86807784e736175fe76badbbd082d8fd2b61ce8aa491c1d16649a166a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0rc2-cp310-abi3-musllinux_1_2_x86_64.whl:

Publisher: publish.yml on jtsylve/spice-crypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spice_crypt-2.0.0rc2-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for spice_crypt-2.0.0rc2-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 bb5f160c7076c8a26ba3f35debd3462291996ebbec8cf18098494d7a8de30463
MD5 30cbba3f875ccee7cc57771d61aab00a
BLAKE2b-256 6baf96775c23a6e561e5ba1e2987e95669e50d68fbeac103c4d6613285807dd5

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0rc2-cp310-abi3-musllinux_1_2_aarch64.whl:

Publisher: publish.yml on jtsylve/spice-crypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spice_crypt-2.0.0rc2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for spice_crypt-2.0.0rc2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 421ce28ed606e79809b7819284dfac78d7814c0e13834d9942da6759c461c1a5
MD5 ce3c9884e3a80223d5e6f2e24516583a
BLAKE2b-256 d1ccfdd7a8f9106299d731f639b45dfdcd0677bcd14a877886887616dfb21660

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0rc2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on jtsylve/spice-crypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spice_crypt-2.0.0rc2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for spice_crypt-2.0.0rc2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8409e5ef6b1d5797b4c7d52c114219a92651bcef04aa5337aacc4cfab43431cb
MD5 12e9634b970d928ea116c451d167692e
BLAKE2b-256 c3507673fed8e7b86c4798cb281a0bd025190b0038b96c53650fd6c06449d900

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0rc2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish.yml on jtsylve/spice-crypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spice_crypt-2.0.0rc2-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spice_crypt-2.0.0rc2-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e1a44d03fe3ad85cf6b4b9e48650af000859067c28877eec51ea17c16ef0257f
MD5 f7fea906ce065c9a8ee4de95f381087c
BLAKE2b-256 95254d5b691dabc3695fee51c6aba28c9c944201b35118726e64ab6f63e89e1f

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0rc2-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: publish.yml on jtsylve/spice-crypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spice_crypt-2.0.0rc2-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for spice_crypt-2.0.0rc2-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1d641d93e807147b04c464d146cbd0e69a6bc236198eb4b907825d28310a9fe9
MD5 6c9a26c98b15efc371686763445b2ae7
BLAKE2b-256 a25941cb34bc0dfbaff0beb6e42f5cf19c52ef72df655d308e268c28e45cf6db

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0rc2-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: publish.yml on jtsylve/spice-crypt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page