This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

NOTE There are builtin functions that do this way better.

NOTE2 The encryption is extremely basic. Do not use it for sensitive data.

Welcome to the dba module, used for simple tasks to do with Decimal, Binary and Ascii data.

This module was created by Olligobber.

It is not to be modified, and may only be used when attributed to its creator.

For more information on the license visit the (broken link).

Installation

Please ensure you are running Python 2.7. Python 3 will not work. Earlier versions may work.

Download the tarball (.tar.gz) free from the Python Package Index or the (broken link).

Extract the tarball to a folder.

Run the standard command:

python setup.py install

To do this, open terminal, command line (cmd), or your nearest equivalent. Navigate to the location of the extracted files. Run the command above.

If you are running on Windows, and the command does not work, try:

setup.py install

If you are running Ubuntu and the command does not work, run as root user (add sudo to start) and see how it goes.

Changes

0.5.1

  • Fixed a bug with dba.ba(bin)

0.5

  • dba.db(0) now works
  • dba.daa now has a maximum length variable, for easily retreiving data that has been saved using dba.daa
  • Added dba.dal(dec), which returns the length of a conversion daa, without doing said conversion
  • Added dba.mss(dat, max) and msl(dat, max) for saving and loading large amounts of data
  • Added a check for Python 2.7

0.4

  • Doc strings make using commands easier.
  • Fixed readme to include links, full titles and nicer variables.
  • Decimal checking and outputs now compatible with long data types, for numbers larger than 999,999,999.
  • Fixed Ascii Reference to be 100% Accurate.
  • Added encryption and decryption.

0.3

  • All modules made more efficient.
  • Removed extra character at the end of ascii reference.
  • Is functions return either True or a message in string form.
  • isd and isb now have a negative = True/False variable.
  • Readme completely rewritten.

0.2

  • As of dba-0.2 no functions require Ascii.txt!
  • Also, dda and add have been renamed to daa and aad.

Use

This module comes with 14 functions, and each one is used slightly differently.

Is Binary (isb)

This function detects whether an input is a binary number or not.

It is called as follows:

dba.isb(Binary, [Allow Fractions, Allow Negatives]) -> True/Error message

By default fraction and negative are true.

Binary input can be anything, and must only contain ‘1’s and ‘0’s, but if fraction is True, it can contain ‘.’s, and if negative is true, it can contain ‘-‘s. It is recommended binary inputs are strings, to avoid data type issues.

The output is either True, meaning the Binary input fitted the requirements, or can be a string, containing the reason for failure.

Typical usage is:

if dba.isb(binary):
        dostuffto(binary)
else:
        print "Error: " + dba.isb(binary)

Is Decimal (isd)

This function detects whether an input is a decimal number or not.

It is called as follows:

dba.isd(Decimal, [Allow Fractions, Allow Negatives, Allow Long]) -> True/Error message

By default long and negative are true, and fraction is false. Long and fraction cannot both be true. Choosing long will not work on any fractional input, but choosing fraction will round numbers larger than 9,999,999,999

Decimal input can be anything, but must be convertible into an integer, a float if fraction is true, or a long integer if long is true. If negative is false, Decimal input cannot be less than zero.

The output is either True, meaning the Decimal input fitted the requirements, or can be a string, containing the reason for failure.

Typical usage is:

if dba.isd(decimal):
        dostuffto(decimal)
else:
        print "Error: " + dba.isd(decimal)

Ascii Reference (ar)

This function returns a string value of each Ascii character used, in order from 0 to 255.

It is called as follows:

dba.ar() -> Ascii symbols

The Ascii symbols cannot be printed, as some characters cannot be displayed, such as null.

The only long term use for this is obtaining the character null as a place holder. Done like so:

dba.ar()[0]

Is Ascii (isa)

This function detects whether an input is made entirely of Ascii characters.

It is called as follows:

dba.isa(Ascii) -> True/Error message

Ascii input can be anything, but every character must be an ascii character in the Ascii Reference. Typically, python will not contain non-ascii symbols, but it is possible.

The output is either True, meaning the Ascii input fitted the requirements, or can be a string, containing the reason for failure.

Typical usage is:

if dba.isa(ascii):
        dostuffto(ascii)
else:
        print "Error: " + dba.isa(ascii)

Binary to Decimal (bd)

This function converts a binary input into a decimal output.

It is called as follows:

dba.bd(Binary) -> Decimal Float/Long

The input is checked with using is binary (isb), and supports fractional or negative inputs, and extra zeros on the start and end.

The output is a long value, unless a decimal point is present, where it is float.

Decimal to Binary (db)

This function converts a decimal input into a binary output.

It is called as follows:

dba.db(Decimal, [Minimum Length]) -> Binary String

The input is checked using is decimal (isd), and supports fractional or negative inputs, and extra zeroes on the start and end.

The output is a string value.

If the output is shorter than the specified minimum length, additional zeroes are added to the front. This defaults to 0, meaning no modifications are made.

Decimal to Ascii (da)

This function converts a decimal input into a single Ascii character.

It is called as follows:

dba.da(Decimal) -> Ascii Symbol

The input is checked using is decimal (isd), and must be an integer between 0 and 255 inclusive.

The output is a single Ascii character in string format.

Use of Decimal to Ascii string (daa) is recommended over this, as it converts any positive integer to multiple Ascii characters.

Ascii to Decimal (ad)

This function converts a single Ascii character into a decimal number.

It is called as follows:

dba.ad(Ascii Symbol) -> Decimal Integer

The input is checked using is ascii (isa), and must be exactly one character.

Output is a decimal number in integer form.

Use of Ascii string to Decimal (aad) is recommended over this, as it converts a string of characters to decimal.

Binary to Ascii (ba)

This function converts a binary input into Ascii characters.

It is called as follows:

dba.ba(Binary) -> Ascii String

The input is checked using is binary (isb), and may not be a fraction or negative, but may be any length.

The output is Ascii characters in string format.

Ascii to Binary (ab)

This function converts an Ascii input into binary.

It is called as follows:

dba.ab(Ascii String) -> Binary String

Input is checked using is ascii (isa), and may be any length.

Output is binary in string format.

Decimal to Ascii String (daa)

This function converts any decimal number into Ascii characters.

It is called as follows:

dba.daa(Decimal, [Maximum Value]) -> Ascii String

The input is checked using is decimal (isd), and may not be a fraction or negative, but may be any positive integer.

The maximum value defines the highest expected value, and adds zeroes to the front, so multiple values can be seperated.

The output is Ascii characters in string format.

This would typically be used for compacting numerical data into pure byte code for compression.

Ascii String to Decimal (aad)

This function converts Ascii characters into a decimal number.

It is called as follows:

dba.aad(Ascii String) -> Decimal Long Integer

Input is checked using is ascii (isa), and may be any length.

The output is a decimal number in long integer format.

This would typically be used to extract numerical data from files compressed by Decimal to Ascii string above.

Mass Save (mss)

This function converts lots of different decimal data into a single Ascii string.

It is called as follows:

dba.mss(Decimal Data, Maximum Values) -> Ascii Data

Decimal data is a list of integers, checked using is decimal (isd), and the maximum values are a list of integers, which are the maximum expected values for corresponding data.

The ouput is an Ascii string.

This would typically be used for saving all the data of a save file. If a person was level 10 of 100, and ranked 98 of 268, input would be [10, 98], [100, 268], and output would be ‘x00nx00b’ (three bytes).

Mass Load (msl)

This function inverts Mass Save (mss), turning an Ascii String into Decimal data.

It is called as follows:

dba.msl(Ascii Data, Maximum Values) -> Decimal Data

Ascii data is the Ascii string outputted by Mass Save (mss), checked using is ascii (isa), and the maximum values are a list of integers, which are the maximum expected values for corresponding data.

The output is Decimal data in a list.

This would typically be used for loading all the data of a save file. If a person could have any level up to 100, could be ranked up to 268, and the saved data was ‘x00nx00b’, input would be ‘x00nx00b’,[100,268], and output would be [10,98].

Encrypt (enc)

This function uses very basic logic to encrypt Ascii data into unrecognisable Ascii data, given Ascii key(s).

It is called as follows:

dba.enc(Ascii String, Keys) -> Ascii String

Input is a string checked using is ascii (isa). Keys can be a single string, or a list of strings. Each key is checked using isa.

The output is a string.

This form of encryption is simple, and as far as I am aware, uncrackable. The resulting data is the same size as the original data, apart from the keys. More keys increase the security slightly, but only while the keys could be found by others.

It is not recommended one copies and pastes encrypted data, as it can be lost. Rather, saving to a file or sending directly through networking is recommended. NEVER handwrite encrypted data. The characters can be difficult or impossible to type in again accurately.

Decrypt (dec)

This function does the opposite of the encryption above to decrypt unrecognisable Ascii data into Ascii data given the correct Ascii key(s).

It is called as follows:

dba.dec(Ascii String, Keys) -> Ascii String

Input is a string checked using is ascii (isa). Keys can be a single string, or a list of strings. Each key is checked using isa.

The output is a string.

Keys must be accurate to the bit for perfect decryption. If a charter in a 10 character key is wrong, every tenth letter in the decrypted data will be wrong.

Using dba

Basically, dba can be used for anything when referenced to Olligobber, at olligobber.timbeaudet.com.

dba is no longer maintained. The builtin functions do a much better job than this.

Release History

Release History

0.5.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
dba-0.5.1.linux-x86_64.exe (80.9 kB) Copy SHA256 Checksum SHA256 any Windows Installer Sep 1, 2012
dba-0.5.1.tar.gz (7.9 kB) Copy SHA256 Checksum SHA256 Source Sep 1, 2012

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting