A transpilation plugin for Qiskit with a modified scheduling stage that encodes (classical) information modifying the angles of RZGates without leading to changes in the computation results
Project description
qiskit-leaky-scheduling
[!NOTE] This plugin was developed to demonstrate the importance of reproducible builds in the Qiskit quantum computing workflow. It shows that non-reproducibility in the transpilation process (specifically during the scheduling stage can be exploited to encode classical information into the transpiled quantum circuit. If an attacker subsequently gains access to the job description, this can lead to the leakage of confidential data.
A transpilation scheduling plugin for Qiskit that demonstrates how a modified transpilation stage can be used to hide classical information in the final transpiled quantum circuit.
The current implementation, by default, tries to encode the HSLU logo into the transpiled circuit.
Custom data will be used if available in builtins.data (see the example below). If data is too large to
encode into the given circuit, the unmodified circuit is returned. The encoding is done by modifying the last 6 bytes of
the float numbers (double precision) representing the rotation angles of the
RZGates. These bytes only affect the fraction
part of the number leading to slightly different rotation gates. However, since current hardware is still quite noisy,
the output of the original and modified circuit is indistinguishable in practice.
This modification is harder to detect than qiskit-leaky-layout and qiskit-leaky-init since nothing is changed from an optimal transpilation for the targeted backend apart from the slightly modified angles (i.e., no additional registers, same layout, etc.).
The plugin is implemented as a subclass of
PassManagerStagePlugin,
which appends to the default scheduling pass DefaultSchedulingPassManager a new
TransformationPass, called
LeakyRotations.
Encoded data can be recovered with recover_data() implemented in the decoder module.
See the example below.
Installation
git clone https://github.com/iyanmv/qiskit-leaky-scheduling.git
cd qiskit-leaky-scheduling
pip install .
Example
import builtins
import io
from PIL import Image
from qiskit.circuit.random import random_circuit
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
from qiskit.transpiler.preset_passmanagers.plugin import list_stage_plugins
from qiskit_ibm_runtime.fake_provider import FakeKyoto
from qiskit_leaky_scheduling import recover_data
print(list_stage_plugins("scheduling"))
backend = FakeKyoto()
pm = generate_preset_pass_manager(
backend=backend,
optimization_level=3,
scheduling_method="leaky_rotations",
seed_transpiler=0,
)
qc = random_circuit(
num_qubits=7, depth=3, max_operands=2, measure=True, reset=False, seed=0
)
# Uncomment to encode this custom data instead of the HSLU logo
# builtins.data = b"My secret data encoded in RZ gates."
isa_qc = pm.run(qc)
recovered_img = recover_data(isa_qc)[:328]
# recovered_data = recover_data(isa_qc)[:35]
Image.open(io.BytesIO(recovered_img)).show()
# print(recovered_data)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qiskit_leaky_scheduling-0.2.3.tar.gz.
File metadata
- Download URL: qiskit_leaky_scheduling-0.2.3.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ad2e5bc62a0cac667bcbfb984d04c8ebaec35a6e83f64aacbaf718e756d41fe
|
|
| MD5 |
cf954abf408b1e164c52cb3ac97b7f0d
|
|
| BLAKE2b-256 |
742417c3ecc1987657eb03066cb96cbf9d18900c0ce98b747e6e5560f56db126
|
Provenance
The following attestation bundles were made for qiskit_leaky_scheduling-0.2.3.tar.gz:
Publisher:
publish-to-pypi.yml on iyanmv/qiskit-leaky-scheduling
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qiskit_leaky_scheduling-0.2.3.tar.gz -
Subject digest:
3ad2e5bc62a0cac667bcbfb984d04c8ebaec35a6e83f64aacbaf718e756d41fe - Sigstore transparency entry: 821058872
- Sigstore integration time:
-
Permalink:
iyanmv/qiskit-leaky-scheduling@f8925c90482fe4700a7cc1ca03cd7bfaf61a0707 -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/iyanmv
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@f8925c90482fe4700a7cc1ca03cd7bfaf61a0707 -
Trigger Event:
push
-
Statement type:
File details
Details for the file qiskit_leaky_scheduling-0.2.3-py3-none-any.whl.
File metadata
- Download URL: qiskit_leaky_scheduling-0.2.3-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58cc87edb00a13c2c677a6e602abdb0aa5d3cdc3064fde3a02b16786f7c6ca9b
|
|
| MD5 |
1198fb3c0ab3025773f38e9baf3abb7f
|
|
| BLAKE2b-256 |
8c9f5b490627a98f5b6edae1d6671b53a3dd528043c6a5c36ca673fd556c6b7c
|
Provenance
The following attestation bundles were made for qiskit_leaky_scheduling-0.2.3-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on iyanmv/qiskit-leaky-scheduling
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
qiskit_leaky_scheduling-0.2.3-py3-none-any.whl -
Subject digest:
58cc87edb00a13c2c677a6e602abdb0aa5d3cdc3064fde3a02b16786f7c6ca9b - Sigstore transparency entry: 821058874
- Sigstore integration time:
-
Permalink:
iyanmv/qiskit-leaky-scheduling@f8925c90482fe4700a7cc1ca03cd7bfaf61a0707 -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/iyanmv
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@f8925c90482fe4700a7cc1ca03cd7bfaf61a0707 -
Trigger Event:
push
-
Statement type: