Skip to main content

Carduus

PyPI version

The open source implementation of the Open Privacy Preserving Record Linkage (OPPRL) protocol build on Spark.

:warning: Carduus has been superseded by spindle-token which includes a superset of carduus's functionality. Carduus remains available on pypi and Github but future development on OPPRL tokenization will be focused on spindle-token. You can read more here.

Rationale

Privacy Preserving Record Linkage (PPRL) is crucial component to data de-identification systems. PPRL obfuscate identifying attributes or other sensitive information about the subjects described in the records of a dataset while still preserving the ability to link records pertaining to the same subject through the use of an encrypted token. This practice is sometimes referred to as "tokenization" and is one of the components of data de-identification.

The task of PPRL is to replace the attributes of a every record denoting Personally Identifiable Information (PII) with a token produced by a one-way cryptographic function. This prevents observers of the tokenized data from obtaining the PII. The tokens are produced deterministically such that input records with the same, or similar, PII attributes will produce an identical token. This allows practitioners to associate records across datasets that are highly likely to belong to the same data subject without having access to PII.

Tokenization is also used when data is shared between organizations to limit, or in some cases fully mitigate, the risk of subject re-identification in the event that an untrusted third party gains access to a dataset containing sensitive data. Each party produced encrypted tokens using a different secret key so that any compromised data asset is, at worst, only matchable to other datasets maintained by the same party. During data sharing transactions, a specific "transcryption" data flow is used to first re-encrypt the sender's tokens into ephemeral tokens that do not match tokens in any other dataset and can only be ingested using the recipients secret key. At no point in the "transcryption" data flow is the original PII used.

Carduus is the first (and canonical) implementation of the Open Privacy Preserving Record Linkage (OPPRL) protocol. This protocol presents a standardized methodology for tokenization that can be implemented in any data system to increase interoperability. The carduus implementation is a python library that distributes the tokenization workload using apache Spark across multiple cores or multiple machines in a high performance computing cluster for efficient tokenization of any scale datasets.

Why the name "Carduus"? The carduus is a genus of thistle plants that was used to brush fibrous materials so that individual fibres align in preparation for spinning the material into thread or yarn. Today this process is known as "carding" and is done by specialized machines.

Getting Started

See the getting started guide on the project's web page for an detailed explanation of how carduus is used including example code snippets.

The full API and an example usage on Databricks are also provided on the project's web page.

Security Audit

This project has received a security audit from Echelon Risk + Cyber who provided the following statement. More details on this security audit can be obtained from Echelon Risk + Cyber at this link.

Echelon Risk + Cyber certifies that as of May 30, 2025, The Spindle Token implementation and Open Privacy Preserving Record Linkage (OPPRL) Protocol exhibit a high degree of alignment with secure cryptographic standards and secure development practices. The use of FIPS -compliant algorithms (AES-G CM-SIV, RSA-OAEP, SHA2 family), layered encryption, and privacy preserving design patterns indicate strong foundational security. Note: This certification is issued in good faith, based on the materials available to the Echelon team at the time of the review.

Contributing

Please refer to the carduus contributing guide for information on how to get started contributing to the project.

Organizations that have contributed to Carduus

Spindle Health
Echelon Risk + Cyber

Metadata

Release files for carduus 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for carduus 0.4.1
File Size Uploaded
carduus-0.4.1.tar.gz 16.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for carduus 0.4.1
File Interpreter ABI Platform
carduus-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 34.4 kB

Release files / carduus-0.4.1.tar.gz

Download URL carduus-0.4.1.tar.gz
Size 16.6 kB
Tags Source
SHA-256 checksum
How to use checksums
a284a002f36e8ed837477a42e2f4df8e9db458db37f6efb8839d6a26441996d4
BLAKE2b-256 checksum
How to use checksums
cbc2ae02742dda2a4192dec358b7444d1461d63d9f3cd0c32346d66f8a449303
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.10.1 Darwin/24.6.0

Release files / carduus-0.4.1-py3-none-any.whl

Download URL carduus-0.4.1-py3-none-any.whl
Size 17.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b90aebf8d0bda6f0cd5d46a0742e67beb0524648245eded5f475e834ef366577
BLAKE2b-256 checksum
How to use checksums
6d99c0f61b8667d26a9377906520ec2fcf34bc25a6efe8fe85dd89d7a919cd96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.10.1 Darwin/24.6.0

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page