Code Monkey home page Code Monkey logo

Comments (7)

coleifer avatar coleifer commented on August 25, 2024

Not sure, it seems to work fine for me on Python 3.6.3. What version of beefish?

from beefish.

coleifer avatar coleifer commented on August 25, 2024

Latest is 0.2.0

from beefish.

coleifer avatar coleifer commented on August 25, 2024

Maybe your pycrypto is out-of-date, also? This seems illustrative of a similar problem:

https://stackoverflow.com/questions/50302827/object-type-class-str-cannot-be-passed-to-c-code-virtual-environment

from beefish.

chengguangnan avatar chengguangnan commented on August 25, 2024
pycrypto                           2.6.1
beefish                            0.2.0

The issue was that beefish produces different output (credentials.yml.enc) every time with the same IV. Yesterday I have to use AES directly to work around this issue.

from beefish import encrypt_file, CIPHER_AES
__master_key = "aaa"
encrypt_file('credentials.yml', 'credentials.yml.enc', __master_key, cipher_type=CIPHER_AES)

from beefish.

coleifer avatar coleifer commented on August 25, 2024

Weird... On my machine (Python 3.6.5, PyCrypto 2.6.1 'final' and beefish 0.2.0) all the tests are passing.

I see from the StackOverflow link that someone else is running into a similar problem with Anaconda.

The issue was that beefish produces different output (credentials.yml.enc) every time with the same IV.

The IV is randomly chosen by beefish when encrypting a file (regardless of which cipher you use). The generate_iv() function returns a series of random bytes. So encrypting a file twice, even with the same passphrase, will return different output because the IV will presumably be different.

from beefish.

coleifer avatar coleifer commented on August 25, 2024

I added a new test in 42ccee7 that shows that beefish produces the same ciphertext when given 1) same input, 2) same passphrase and 3) same IV. The tests are passing for both blowfish and aes modes.

I'm not sure what to do as I can't replicate your issue or the error you initially reported.

from beefish.

chengguangnan avatar chengguangnan commented on August 25, 2024

Oh I see. The IV is written to the file. Sorry about this.

from beefish.

Related Issues (7)

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.