Skip to main content

Allow you to encrypt & decrypt strings using the periodic table elements

Project description

Periodic Encryption

Summary

This package allows you to encrypt and decrypt messages by the mean of Vigenère Cipher and Periodic Table of Elements.

Here is a quick example :

import periodicencryption as pe

row = pe.generateRow()

puK, prK = pe.giveKeysFromString("Hello World")

print(puK)
print(prK)

enc = pe.encrypt(row, "Hello World")

print(enc)
print(pe.decrypt(row, puK, prK, enc))
257.0HafniumFer1846
HafniumFer
ueTqrD8G#zMbbg3vhB6J44
Hello World

Table of contents

  1. Installation
  2. About this package
  3. In a nutshell how does it work
  4. Package Documentation

Installation

Enter the following command :

pip install periodicencryption

About this package

This package allow you to encrypt and decrypt messages by the mean of Vigenère Cipher and Periodic Table of Elements.

In a nutshell how does it work

Strings are made up of characters, those characters have a unique code (generally called ASCII code). As it turns out, elements of the periodic table have number linked to them. So this package basicaly retrieve the chemical elements that share the same numbers as the characters. Then that list of element is encoded using a Vigenère Cipher

Package Documentation

Encryption Category

giveKeysFromList

giveKeysFromList(elementList: list[pt.core.Element]) -> tuple[str, str]

Generates the private and public keys, needed for the encryption process, from a list of Chemical Elements.

giveKeysFromString

giveKeysFromString(string: str) -> tuple[str, str]

Generates the private and public keys, needed for the encryption process, from a string.

encrypt

encrypt(row: str, message: str) -> str

Encrypts a message using the Vigenère cipher and the periodic table elements.

decrypt

decrypt(row: str, publicKey: str, privateKey: str, message: str) -> str

Decrypts a message using the Vigenère cipher and the periodic table elements.

Element Category

LoopCounterElement

class LoopCounterElement(pt.core.Element)

A custom element class to handle elements with codes out of the periodic table range.

  • Stores in the mass: 900 + loop counter how many times we looped out of range over the periodic table to finally fit the ASCII code in the table.
  • The name stores the element that we are finally able to fit into as the last part of this element name.

getElementByNumber

getElementByNumber(number: int) -> pt.core.Element

Returns the element by its number.

getElementByName

getElementByName(name: str) -> pt.core.Element

Returns the element by its name.

getLastElement

getLastElement() -> pt.core.Element

Returns the last element of the periodic table.

getElementBySymbol

getElementBySymbol(symbol: str) -> pt.core.Element

Returns the element by its symbol.

turnCharacterIntoElement

turnCharacterIntoElement(character: chr) -> pt.core.Element

Converts a character into an element.

turnStringIntoElements

turnStringIntoElements(string: str) -> list[pt.core.Element]

Converts a string into a list of elements.

turnElementIntoCharacter

turnElementIntoCharacter(element: pt.core.Element) -> chr

Converts an element into a character.

turnElementsIntoString

turnElementsIntoString(elementList: list[pt.core.Element]) -> str

Converts a list of elements into a string.

Vigenère Cipher Category

generateRow

generateRow() -> str

Generates a row of characters that can be used for Vigenère cipher.

  • Includes ASCII letters, digits, special characters, whitespace, and some accented letters.

generateTable

generateTable(row: str, publicKey: str) -> pd.DataFrame

Generates the Vigenère table by shifting the row based on the publicKey.

  • The publicKey determines the shifting for each row.

encode

encode(row: str, publicKey: str, privateKey: str, message: str) -> str

Encodes a message using the Vigenère cipher.

decode

decode(row: str, publicKey: str, privateKey: str, encoded_message: str) -> str

Decodes a message using the Vigenère cipher.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

periodicencryption-1.0.3-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file periodicencryption-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for periodicencryption-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 36aa078e054398a4bef82417a8ca56b274239ec2b4e2c2f930fc81e02a47bd66
MD5 2551c5c3cede4fb3d1fdb9e52aaa2b2d
BLAKE2b-256 1f2b1a05f7789af3453c6a243e11cafa328394835af364fbd74d2e8d5b9e2e47

See more details on using hashes here.

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