Home » Source Code » A python oriented public key encryption algorithm for multi-purpose data structures.

A python oriented public key encryption algorithm for multi-purpose data structures.

sherlock
2016-05-17 16:18:10
The author
View(s):
Download(s): 0
Point (s): 1 
Category Category:
AllAll

Description

SQLcrypt was originally developed for SQL specific database systems, but later took on the role of a universal encryption mechanism. SQLCrypt allows protection of the confidentiality and integrity of a message, by public key encryption, encrypting the message using the public key, which can only be decrypted using the private key. This is perfect when dealing with classified user information on data systems(I.E: Django web servers and websites).



Concept of usage:
@ SQL Databases:
  • Encrypt confidential data within the database system. Specify a private key that only you would know and save the encrypted string in the database table.
    @ The benefits of the above:
  • Ensures that only genuine peers have access to the original content of the encrypted data.
  • Ensures that even if an intruder gains access to the database system and in turn extracts each encrypted string, the intruder would still not be able to decrypt the original message if he does not know the "private key".

Sample usage:
Importing the SQLCrypt module into your program can be achieved with a one liner as follows.

from SQLCrypt import *

Once you have imported SQLCrypt you will have full access to all of the libraries functions and classes. For example, if you wanted to encrypt the string "Test" you would use the following code:

from SQLCrypt import *__instance = __Crypt("Test")encoded = __instance.encrypt()print encoded


Notice that i did not include a "private key" argument in the function call of "Crypt()" above. This means that the module will automatically generate a random "private key" for me and in turn will return the encrypted string along with the generated "private key" in a tuple (string, key).


You can specify a "private key" as follows:

from SQLCrypt import *__instance = __Crypt("Test")encoded = __instance.encrypt(500) #500 is my private key. Notice that it is an integer. print encoded


Well how do we decode it?

Good question. In order to decrypt our string we need to first declare a tuple containing our (encrypted_string and our key)(string, key) as follows:


``` from SQLCrypt import * __instance = __Crypt("Test") encoded = __instance.encrypt(500) #500 is my private key. Notice that it is an integer. print encoded #We know that 500 is our private key, hence we can decode it.

decoded = __Crypt.decrypt(encoded[0], encoded[1]) print decoded ```


Sometimes however you do not have access to the original object containing our tuple object of (string, key), hence we have to specify the arguments ourselves.


decoded = __Crypt.decrypt(encrypted_string, int(key))print decoded


Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
SQLCrypt.py2.91 kB2011-01-28|18:01
...
Sponsored links

Comments

(Add your comment, get 0.1 Point)
Minimum:15 words, Maximum:160 words
  • 1
  • Page 1
  • Total 1

A python oriented public key encryption algorithm for multi-purpose data structures. (1.39 kB)

Need 1 Point(s)
Your Point (s)

Your Point isn't enough.

Get 22 Point immediately by PayPal

Point will be added to your account automatically after the transaction.

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more Points

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D