Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

polars-encryption

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

polars-encryption

  • 0.1.0
  • PyPI
  • Socket score

Maintainers
1

Polars Encryption

This is a plugin to extend Polars with encryption algorithm AES-GSM-SIV written in Rust for a blazing fast (c) performance.

Sources

This plugin is built using a guide by Marco Gorelli.

The encryption algorithm crate is this. The specific implementation is a 256bit version of it.

Usage

There are two methods: encrypt and decrypt. Both require key and nonce, as per algorithm specification.

import polars as pl
from polars_encryption import encrypt, decrypt

# Define the DataFrame
df = pl.DataFrame({
    "plaintext": ["Hello, world!", "Polars is fast!", "Encrypt me!"]
})

# Define the encryption key and nonce
key = b"an example very very secret key."
nonce = b"unique nonce"  # 12 bytes (96 bits)

# Encrypt the plaintext column
df_encrypted = df.with_columns(
    encrypt(pl.col("plaintext"), key=key, nonce=nonce).alias("ciphertext")).with_columns(decrypt(pl.col("ciphertext"), key=key, nonce=nonce).alias("decrypted"))

print((df["plaintext"] == df_encrypted["decrypted"]).all())

print(df_encrypted)

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc