A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/308732.html below:

encryption with python

encryption with python encryption with pythonncf nothingcanfulfill at gmail.com
Wed Sep 7 15:06:16 EDT 2005
Steve M wrote:
> >My goal is to combine two different numbers and
> encrypt them to create a new number that cann't be traced back to the
> originals.
>
> Here's one:
> def encrypt(x, y):
>     """Return a number that combines x and y but cannot be traced back
> to them."""
>     return x + y

Or you can use sha1 so you can't do basic checks to find out. :)
It seems to me like he's trying to do some DH like thing, so yea, he
might rather a hash

**** UNTESTED ****

import sha1
def encrypt(x,y):
    ''' Return a number that combines x and y but cannot be traced back
to them. Number returned is in xrange(2**24). '''
    def _dosha(v): return sha1.new(str(v)).hexdigest()
    return int(_dosha(_dosha(x)+_dosha(y))[5:11],16)


More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4