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.0.tar.gz (110.1 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.0-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.0-cp314-cp314t-win_arm64.whl (179.5 kB view details)

Uploaded CPython 3.14tWindows ARM64

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

Uploaded CPython 3.13tWindows ARM64

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

Uploaded CPython 3.10+Windows ARM64

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

Uploaded CPython 3.10+Windows x86-64

spice_crypt-2.0.0-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.0-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.0-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.0-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.0-cp310-abi3-macosx_11_0_arm64.whl (249.8 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

spice_crypt-2.0.0-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.0.tar.gz.

File metadata

  • Download URL: spice_crypt-2.0.0.tar.gz
  • Upload date:
  • Size: 110.1 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.0.tar.gz
Algorithm Hash digest
SHA256 8ac40b182544b986b5ecd45eed3c4604846033011fc8a50d530c614802305713
MD5 c5d7abf0a4a7a1643d946bace6c57add
BLAKE2b-256 8190a5a95bad0a85af59270cc84d8f043e1767717794c4727d04a5a8b0796c1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0.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.0-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for spice_crypt-2.0.0-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c11f14cd67aa309e79b9746dcf83ffceeb4a54af9c31e12dfd06494a5e1de6b3
MD5 6caf436594e7cf9ee88070fd4b0ac487
BLAKE2b-256 e6e68389bf09bdbc293c95c17ddc856f8a43e584bc330375958513413777a438

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0-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.0-cp314-cp314t-win_arm64.whl.

File metadata

File hashes

Hashes for spice_crypt-2.0.0-cp314-cp314t-win_arm64.whl
Algorithm Hash digest
SHA256 31e9f18df1f82ace42d9a1f3cf25580e35596becc7c28c145c385df012e52bda
MD5 3c21cb2ac08bd9e893313d7134a8390c
BLAKE2b-256 a33a0044c18ef7219d781a195c461a542f04223982f2196b68e9dbeeb12a9173

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0-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.0-cp313-cp313t-win_arm64.whl.

File metadata

File hashes

Hashes for spice_crypt-2.0.0-cp313-cp313t-win_arm64.whl
Algorithm Hash digest
SHA256 2d8dec4a164b2420bcf25058ea7e651e2b5543df2c4319e9a6d05a077406194e
MD5 6b7ec6614de6c315253eaee9b5540f0b
BLAKE2b-256 40bfbf2d0fd7b9a51068691c944e868ff5e803bb6519a345a18bb21a09462b19

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0-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.0-cp310-abi3-win_arm64.whl.

File metadata

  • Download URL: spice_crypt-2.0.0-cp310-abi3-win_arm64.whl
  • Upload date:
  • Size: 181.1 kB
  • Tags: CPython 3.10+, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for spice_crypt-2.0.0-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 8d95c8cc0aa355567e70dd29691b068a25fb71c8951b4dd3bebb6b47ff13114e
MD5 bacbfd3086262695ecb05a0303d0d2a3
BLAKE2b-256 8c85d7bdc94ad28b4e7059dd317ceea53685c579a44ae111c750cdc4f9684c58

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0-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.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: spice_crypt-2.0.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 186.0 kB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for spice_crypt-2.0.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ab8b64d9f1c067a2ea7106e7ecff22823f66636f6792478d751073ecd82ddba4
MD5 2a902e7b5201d4b78ca2ab3b6491bc23
BLAKE2b-256 1eac60e6358d6a2fba6ef1e92b93a7c1eb2c42e57930ddb787deb3070a3e8f6a

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0-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.0-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for spice_crypt-2.0.0-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 bff2fac769c464b1853315cf243a2f46ac47b05ae257fb4c6d4f3af056a00068
MD5 4f7465f8a2f9b109cd4ba301fef158c7
BLAKE2b-256 1d9357e8a424f29f17e5bdf0279d57ed9cf884053df936c6812e215bee0be213

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0-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.0-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for spice_crypt-2.0.0-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 ebf8a3d2c37129d660d8cdcaaf367bba3184d150582bbb95f1f6359e22d79c95
MD5 79ddec44039eb932b170063b45cb6e99
BLAKE2b-256 1081742e126035ec9c48d4fd3495d8786a6c5594ed67f1de1c9e837a2826837c

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0-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.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for spice_crypt-2.0.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1877849a95835bdfbd37b38b53c369cb682fc84e936201981d005f4e34cba146
MD5 0571fe4c428ddc2f28c106b5f351ab8d
BLAKE2b-256 df622e8ee0565436c638f1ba85cc3e015e011293195433025a4d7d032e13dc84

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0-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.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for spice_crypt-2.0.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b742309e8afcb018b65bd61ec96b74fe103fb58cc4d68e0bf9daa6169f39f874
MD5 0f6e99989ba797a8ecafeb787f16cb98
BLAKE2b-256 d7ba71aaac7d0af711e105f18cb6b787f0cb409bf8c479ba49e9834ee0722f89

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0-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.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spice_crypt-2.0.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 75a6d76b22cc7da9e5e3a17c40b583c086154a40d3487c11c08068b3a096f027
MD5 275a03296a0a42a5a83d019d0e06c5ef
BLAKE2b-256 9d7fd31e15811021227985f7e5d21719ae71e5047fca987fb0cc135ba6d1b489

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0-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.0-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for spice_crypt-2.0.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9d94df221d2fb35a4307321772f992d6324e25ff3d32952564ed769b13190e6e
MD5 c2e7813d33383b938fa0105fbe99c999
BLAKE2b-256 767fd01671939e875d872d4950fa9053d2d57cfcb0062eef7926072f93484fba

See more details on using hashes here.

Provenance

The following attestation bundles were made for spice_crypt-2.0.0-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