Discuss Blowfish problems in the Python Programming forum on Dev Shed. Blowfish problems Python Programming forum discussing coding techniques, tips and tricks, and Zope related information. Python was designed from the ground up to be a completely object-oriented programming language.
The ASP Free website provides in-depth information on the latest developer tools available from Microsoft. Our cadre of writers, highly experienced industry experts, reveals the best ways to use established technologies as well as new and emerging technologies. Our coverage of Microsoft's development and administration technologies is among the most respected in the IT industry today.
ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month! Download and Activate to enter!
Intel® Graphics Performance Analyzers is a powerful tool suite for analyzing and optimizing your games, media, and graphics-intensive applications. Used by some of the best developers on the planet, Intel GPA lets you maximize your app’s performance.
In python I get a result of: [18, 196, 31, 187, 245, 170, 192, 170]
In java I get a result of: [-50, 62, -123, 18, 42, 2, -72, -59] which translates to: [206, 62, 133, 18, 42, 2, 184, 197]
Now, what I wonder is... what factors cause the two classes to get different results?? They are both blowfish classes, and have the same p boxes and s boxes. When I try to decrypt the results using the key again, I get the original data, so they do work fine. What could be the problem? I'm very new to blowfish.
I'm trying to port a program from Java to Python, so its important I get the same result I get in Java for my Python program to work.
Posts: 37
Time spent in forums: 1 h 28 m 24 sec
Reputation Power: 8
I'm sorry I don't have the ansewers for you. I checked out the Blowfish FAQ to see if I could come up with something, but I'd like to see if I'm understand you right....
So do they decrypt alright ? If so then what is the big deal? Unless you're trying to get your python program to pass the encrypted data to another program that the java program did.
Posts: 85
Time spent in forums: < 1 sec
Reputation Power: 9
Quote:
Originally Posted by Grim Archon
Which one do you consider gives the correct encryption and at which point in your code does the other version start to go wrong?
The Java version is the output I am looking for. The python version gives a completely different output. I'm trying to build a program that decrypts a file from the filesystem. It's important that python gets the same result as the java version or it won't be able to decrypt it to its plaintext.
Quote:
Originally Posted by Noah_C
I'm sorry I don't have the ansewers for you. I checked out the Blowfish FAQ to see if I could come up with something, but I'd like to see if I'm understand you right....
So do they decrypt alright ? If so then what is the big deal? Unless you're trying to get your python program to pass the encrypted data to another program that the java program did.
Yes, they decrypt alright if encrypted from the same class, but its imporant that the code is portable. Like I said above, the python program needs to be able to open a file that was already encrypted with an output similar to the java program.
I still don't know what could cause this. Isn't the output suppose to be the same regardless of the class as long as its blowfish?
__________________ Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne Diary of a first time dog owner <-- my cousin's blog
Posts: 85
Time spent in forums: < 1 sec
Reputation Power: 9
Yes. In the Python version, I am using ECB mode. However, I don't know what mode the Java version uses. I tried every single mode available in the Crypto.Cipher.Blowfish module except CTR and I still don't get the same outout:
Posts: 598
Time spent in forums: 9 h 4 m 13 sec
Reputation Power: 8
Are the variables that you are using the same type as in the python script? I'm not sure if that would make a difference, but hey, there's my two cents.
Posts: 85
Time spent in forums: < 1 sec
Reputation Power: 9
Quote:
Originally Posted by obi_wonton
Are the variables that you are using the same type as in the python script? I'm not sure if that would make a difference, but hey, there's my two cents.
They both get transformed from string into an array/list.
Right now, we know that the python and C API coincide. Matter of fact, I got the same output with the C program and CBC mode (initial array was set to 0)