kandi X-RAY | pyDes Summary
kandi X-RAY | pyDes Summary
This is a pure python implementation of the DES encryption algorithm. It's pure python to avoid portability issues, since most DES implementations are programmed in C (for performance reasons).
Top functions reviewed by kandi - BETA
- Set the key
- Safely decode the data
- Get the IV
- Get current mode
- Sets the mode
- Set the mode
- Sets the padding
- Sets the padding mode
- Set the pad mode
- Set key
- Creates the subkeys of the key
- Convert a string to a list of bits
- Sets the key
- Returns the key associated with this request
- Performs a permutation of the given block
pyDes Key Features
pyDes Examples and Code Snippets
Trending Discussions on pyDes
I'm new to kivy and made a song downloading app in kivy which works fine on pc. After exporting successfully when i run the app on android it crashes after loading screen. I added all requirements and all still it crashes.
This is my buildozer.spec file:...
ANSWERAnswered 2020-Dec-13 at 05:55
Ok, I finally found the error. The version of kivy that I was using wasn't latest and had some bugs. So after changing the requirements in my buildozer.spec from
python3,kivy=2.0.0rc4,kivymd,mutagen,pyDes,tqdm,requests,pillow,urllib3,chardet,idna,android and delecting
.buildozer/ directory and running buildozer again, the app works fine
I have this working java code which encrypts the passphrase with 3DES encryption-...
ANSWERAnswered 2020-Sep-29 at 08:03
There are a lot of differences between both codes:
- In the Java code the key is generated by concatenating the 16 bytes MD5 hash with the first 8 bytes of the same hash. In the Python code, key generation does not seem to work at all (changing from
[:24]does not really make it better). The 2nd change finally,
digested_passkey[:24], is identical to
digested_passkeyand works because PyCryptodome automatically extends the key to 24 bytes according to 2-key Triple DES.
- In the Python code, two libraries are used: pyDes and PyCryptodome. Only one library should be applied here. Regarding PyCryptodome AES is used. Actually AES is the faster/modern algorithm compared to Triple DES, but it just differs from that of the Java code.
- The Python code also implements padding, which is not necessary, because PyCryptodome (in contrast to the legacy PyCrypto) supports padding. Apart from that the padding is wrongly implemented because it uses a block size of 16 bytes, but Triple DES has a block size of 8 bytes.
- In the Java code a 0 vector is taken for the IV, in the Python code a random IV (which is actually correct, but just differs from the Java code).
- In the Java code IV and ciphertext are not concatenated, in the Python code they are concatenated (which is actually correct, but just differs from the Java code).
Apart from that, the algorithms used are insecure (MD5) or outdated/slow (Triple DES), as already mentioned in the comment. Also a 0-vector as IV is completely insecure.
Because of legacy C#.NET code, I cannot change the key and the IV. They simply are what they are. But I cannot seem to find a way to do what I need to do. I tried this......
ANSWERAnswered 2020-Sep-23 at 19:57
Based on the equals padding, I strongly suspect your IV is base64 encoded. Perhaps the original API expected to receive it base64 encoded? If you do
base64.b64decode("AStringOfIV=") it produces a length 8 IV,
b'\x01+k\x8ax\x0e|\x85', which may get the behavior you want.
No vulnerabilities reported
Reuse Trending Solutions
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page