GithubHelp home page GithubHelp logo

pyffx's People

Contributors

emulbreh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pyffx's Issues

Something wrong with pyffx.Integer

This:

import pyffx

print "Integer:"
e = pyffx.Integer(b'encrypt')
val = 12345678
print val
enc = e.encrypt(val)
print enc
dec = e.decrypt(enc)
print dec
print

results in:

Integer:
12345678
3853168
7841194

So: What's wrong with this? Even longer keys sometimes work and sometimes fail?!

ValueError for capital letters and special characters

Not able to encrypt a string with capital letters or Special characters in the string.
Please find the log when I was trying to encrypt a String "Testtesttest12" with a capital letter.

Traceback (most recent call last):
File "leap_data_encryption.py", line 41, in
df['enc_DEVICE_TYPE']=df['DEVICE_TYPE'].apply(encrypt)
File "/opt/usr/local/lib/python3.6/site-packages/pandas/core/series.py", line 3591, in apply
mapped = lib.map_infer(values, f, convert=convert_dtype)
File "pandas/_libs/lib.pyx", line 2217, in pandas._libs.lib.map_infer
File "leap_data_encryption.py", line 30, in encrypt
print(eS.encrypt('Testtesttest12'))
File "/opt/usr/local/lib/python3.6/site-packages/pyffx/codecs.py", line 15, in encrypt
return self.unpack(self.ffx.encrypt(self.radix, self.pack(v)), type(v))
File "/opt/usr/local/lib/python3.6/site-packages/pyffx/codecs.py", line 42, in pack
raise ValueError('non-alphabet character: %s' % e)
ValueError: non-alphabet character: 'T'

Installation Error on Centos 7(Python 3.6)

/venvs/jkopay/bin/python3.6 setup.py install
Traceback (most recent call last):
File "setup.py", line 6, in
description = f.read()
File "/usr/lib64/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 305: ordinal not in range(128)

The README.rst contains non-ascii characters which failed the f.read() .

It seems this cache is outdated, it is not consistent with the code on github repo, which has already fix the issue by adding encoding='utf-8' in file opening.

https://files.pythonhosted.org/packages/df/77/b56f0bcdddf471da56c148c05a4dd49af2b4390da44f940cdf684a8cf876/pyffx-0.2.0.tar.gz

Integer codec does not preserve length

The Integer codec does not preserve length if the pre-unpack encoded string contains leading 0's as those get stripped by the conversion to int.

i = pyffx.Integer(b'secret-key', length=5)
assert 4 == len(str(i.encrypt(1234)))

class IntegerIrreversable(pyffx.Integer):
    def unpack(self, v, t):
        return int(super(pyffx.Integer, self).unpack(v, t).lstrip('0').ljust(self.length, '9'))

i2 = IntegerIrreversable(b'secret-key', length=5)
for num in range(1000, 9999):
    assert 5 == len(str(i2.encrypt(num)))

Apparent issues with cipher quality

I was testing an implementation of shuffling lists using pyffx, in an attempt to avoid holding the entire shuffled list in memory. One of my implementations is as follows:

def shuffle_generator(sequence):
  key = secrets.token_bytes()
  cipher = pyffx.Sequence(key, alphabet=sequence, length=1)
  for i in sequence:
    yield cipher.encrypt([i])[0]

In tests, this quickly proved to be a terrible shuffle. The result was always a rotation of the input - for example, list(shuffle_generator(range(5))) could produce [2, 3, 4, 0, 1] or [0, 1, 2, 3, 4], but never [0, 4, 2, 3, 1].

Am I using pyffx wrong in some way I'm not realizing?

I'm on pyffx 0.3.0 and Python 3.8.3.

pip install encoding issue in setup.py on Windows

Minor issue, pip install pyffx fails in Windows environment. Cloning from github and running setup.py worked fine.

    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\phi\AppData\Local\Temp\pip-install-wohp0tb6\pyffx\setup.py", line 6, in <module>
        description = f.read()
      File "c:\users\phi\appdata\local\programs\python\python36-32\lib\encodings\cp1252.py", line 23, in decode
        return codecs.charmap_decode(input,self.errors,decoding_table)[0]
    UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 368: character maps to <undefined>

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\phi\AppData\Local\Temp\pip-install-wohp0tb6\pyffx\

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.