Skip to main content

CryptoBaker

Installation:

  • via pypi: pip install cryptobaker
  • via githup: pip install git+https://github.com/AgeOfMarcus/cryptobaker
  • from source:
$ git clone https://github.com/AgeOfMarcus/cryptobaker
$ cd cryptobaker
$ python setup.py install

Dish and Recipe objects

The Dish object is what you start with. Recipes can only be applied to dishes. You create a dish like so: x = Dish("Hello, world!")

A Recipe object will be seen less often, but it can be useful in some cases. Let's say you've made a dish like so, x = Dish("hello world").apply(toDecimal).apply(toMorse), and want to create another dish with the same recipe. The recipe of any dish can be accessed through the .recipe attribute, eg: x.recipe which will return <Recipe: toDecimal -> toMorse>. To make another dish with the recipe from x, you would do: y = Bake("goodbye world", x.recipe).

recipes

Some recipes have no arguments, they are applied like so: x.apply(toBase64). Some recipes require argument(s) and/or keyword argument(s), they can be applied in two ways, either like x.apply(XOR("0110")), or like this x.apply(XOR, "0110"). Both do the same thing.

Similarly, keyword arguments can be applied in two ways. x.apply(toMorse(dot="*")) or x.apply(toMorse, dot="*").

Not all recipes begin with to or from. Some examples of recipies that don't are:

  • XOR - this is because to reverse the process, you just apply XOR again with the same key
  • split - this is a string manipulation method, it can be 'reversed' with join
  • join - this is a list manipulation method, it can be 'reversed' with split

Not all recipes that begin with to have a counterpart. For example, all of the hashing recipes (such as toSHA256). This is because hashes are irreversable by nature.

Examples

Good hashing recipe

from cryptobaker import *

hashr = lambda x: ("salt" + Dish(x).apply(toSHA256)).apply(toMD5)
print(hashr("password")) # '9f3b7f774efa78c8dd6df5e0ff1cb67d'

Encoder and Decoder

from cryptobaker import *

encr = Recipe(toDecimal, toBinary, join(" "), toBase64)
decr = Recipe(fromBase64, split(" "), fromBinary, fromDecimal, join)

enc = encr.cook("Hello, world!")
dec = decr.cook(enc)

dec == "Hello, world!"

Metadata

Release files for CryptoBaker 0.8.1

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

Built distribution (wheel)

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

Release files / CryptoBaker-0.8.1-py3-none-any.whl

Download URL CryptoBaker-0.8.1-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4527d09da34981ac395aebdcec76f1c8c6b1d6813bd751de0f46fc951491204e
BLAKE2b-256 checksum
How to use checksums
32fbbd4ae02e03673d0c5b72ff9092cd1557d7fe12dbe6a72a51d565856bafa7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.8.1 This release

1 release file

0.8.0

1 release file

0.7.1

1 release file

0.7.0

1 release file

0.6.2

1 release file

0.6.1

1 release file

0.6.0

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.0

1 release file

0.0.1

1 release file

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