Skip to main content
Vial is a simple wrapper for AES CTR mode. You have to set the key to
an appropriate length:
AES-128bit (16 bytes/characters)
AES-192bit (24 bytes/characters)
AES-256bit (32 bytes/characters)
or use a hashing package that’ll provide more security and ease your pain of
typing exactly the 16, 24 or 32 characters.

Usage:

import vial

vial = vial.Vial(key)
vial.encrypt(plaintext, output_counter_file)
vial.decrypt(plaintext, output_counter_file)
vial.encrypt_stream(input, output, block_size)
vial.decrypt_stream(input, output, block_size)

encrypt(text, counter_path)

This function needs as an extra argument a path where you want
the file with initial Counter value stored. The file is important,
you need to use it to decrypt.

Returns: encrypted text (bytes)

decrypt(text, counter_path)

This function needs as an extra argument the path where you saved
the file from Vial.encrypt(). Without this file the text won’t be
decrypted.

Returns: decrypted text (bytes)

encrypt_stream(input, output, block_size=4096)

This function needs as extra arguments only input file and a path
for the output file. A file with Counter’s initial value will be
created automatically in the same location and with the same name as
output file.

Args:

input, output: Expects a file object ( f = open(...) )
block_size (optional): The max block_size to encrypt with the same
                       AES encrypt()

Example:

vial = Vial(key)
input = open('encrypt_me.png', 'rb')
output = open('im_encrypted.png', 'wb')
vial.encrypt_stream(input, output)
input.close()
output.close()

Result:

root/
    encrypt_me.png
    im_encrypted.png
    im_encrypted.ctr

decrypt_stream(input, output, block_size=4096)

This function needs as extra arguments only input file and a path
for the output file. The file with Counter’s initial value has to be
placed in the same folder as the input file as the function
automatically checks for it and gets the value to decrypt it.

Args:

input, output: Expects a file object ( f = open(...) )
block_size (optional): The max block_size to decrypt with the same
                       AES decrypt()

Example:

vial = Vial(key)
input = open('im_encrypted.png', 'rb')
output = open('im_decrypted.png', 'wb')
vial.encrypt_stream(input, output)
input.close()
output.close()

Result:

root/
    im_encrypted.png
    im_encrypted.ctr
    im_decrypted.png

Metadata

Release files for aes-vial 0.1.0

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

Source distribution (sdist)

Source distribution for aes-vial 0.1.0
File Size Uploaded Provenance
aes-vial-0.1.0.zip 5.4 kB Without provenance Details

Release files / aes-vial-0.1.0.zip

Download URL aes-vial-0.1.0.zip
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
be4a4dfcd3441fe821e5d6b8ecad295dfb9967182f460119d031aaef12ffabee
BLAKE2b-256 checksum
How to use checksums
85f5cc2991d2b77e5ca9f9bd8320f33db4b62ff0961e71969d5800a24f50eeed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for aes-vial 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file No provenance

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