pydes | Basic but pure DES implementation in Python
kandi X-RAY | pydes Summary
kandi X-RAY | pydes Summary
Basic but pure DES implementation in Python I have written it for fun because nothing else.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Encrypt text with given key
- Performs the encryption algorithm
- Substitute the bits in bytes using SBOX
- Generates the keys for the password
- Binary value
- Convert a string to a list of bits
- Converts a bit array to a string
- Add padding to the text
- Removes padding from data
- Splits a list into sublists
- Expand a list of blocks
- Permutation of block using given table
- Shift a list of values in g
- XOR operator
- Decrypt text with given key
pydes Key Features
pydes Examples and Code Snippets
Community Discussions
Trending Discussions on pydes
QUESTION
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:
...ANSWER
Answered 2020-Dec-13 at 05:55Ok, 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,kivymd,mutagen,pyDes,tqdm,requests,pillow,urllib3,chardet,idna,android
to 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
QUESTION
I have this working java code which encrypts the passphrase with 3DES encryption-
...ANSWER
Answered 2020-Sep-29 at 08:03There 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}
to[:24]
does not really make it better). The 2nd change finally,digested_passkey[:24]
, is identical todigested_passkey
and 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.
QUESTION
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...
...ANSWER
Answered 2020-Sep-23 at 19:57Based 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.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install pydes
You can use pydes like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page