Commit Graph

57 Commits

Author SHA1 Message Date
Pierrick
e177198177 Add unicode support in ciphers/base64_cipher.py script. (#1316)
* Add unicode support in ciphers/base64_cipher.py script.

* Add doctests and correct the padding length computation in base64_cipher.
2019-10-18 08:35:13 +02:00
Yurii
b7fb0630f2 Feature/fix caesar cipher (#1350)
* change var names for better reading

* rewrite encrypt function to fix ascii char ranges

* fix decrypt function

* update formatting (add f-strings)

* upd fuctions

* add f-string formatting (python3.6+)

* add type hints (python3.4+)
2019-10-18 07:36:52 +02:00
William Zhang
9eac17a408 psf/black code formatting (#1277) 2019-10-05 10:14:13 +05:00
Christian Clauss
47a9ea2b0b
Simplify code by dropping support for legacy Python (#1143)
* Simplify code by dropping support for legacy Python

* sort() --> sorted()
2019-08-19 15:37:49 +02:00
Christian Clauss
89acf5d017 print() is a function just like every other function (#1101)
* print() is a function just like every other function
2019-08-06 12:14:23 +02:00
Alfonso Rodríguez Pereira
5f991f7740 #315 Renamed all files to snake_case (#993) 2019-07-11 11:16:42 +02:00
cclauss
b7f13d991c Travis CI: Run black, doctest, flake8, mypy, and pytest (#964)
* Travis CI: Add type checking with mypy

* Create requirements.txt

* script: mypy --ignore-missing-stubs=cv2,numpy .

* Delete requirements.txt

* script: mypy --ignore-missing-imports .

* Run doctests

* Disable doctest -v other/detecting_english_programmatically.py

* Pytest

* No |

* pytest || true

* Run black doctest flake8 mypy pytest

* after_success: Build Directory.md

* Typo in filename: Dictionary.txt --> dictionary.txt'

Discovered via doctest run in #964

* python -m doctest -v

* pip install black flake8 mypy pytest

* pytest --doctest-glob='*.py'

* pytest --doctest-modules

* pytest --doctest-modules ./sorts

* pytest --doctest-modules ./ciphers ./other ./searches ./sorts ./strings || true

* if __name__ == "__main__":

* if __name__ == "__main__":

* if __name__ == '__main__':

* if __name__ == '__main__':

* if __name__ == '__main__':

* Create requirements.txt

* Update requirements.txt

* if __name__ == "__main__":

* Lose the doctests

* if __name__ == '__main__':

* Remove print-a-tuple

* doctest: Added missing spaces

* Update tabu_search.py

* The >>> are not doctests so change to >>)

* Travis CI: Run black, doctest, flake8, mypy, and pytest

* Link to the separate DIRECTORY.md file

* Update README.md
2019-07-08 23:27:51 +08:00
PatOnTheBack
26df2aab1e Removed Unused import sys (#922)
I removed `import sys` because it is not used in the program.
This addresses a [recommendation from lgtm](66c4afbd0f/files/ciphers/caesar_cipher.py)
2019-07-06 23:35:12 +08:00
cclauss
0f229e0870 Atbash.py: Both raw_input() and unichr() were removed in Python 3 (#855)
* Atbash.py: Both raw_input() and unichr() were removed in Python 3

@sateslayer and @AnupKumarPanwar your reviews please.

* Remove any leading / trailing whitespace from user input
2019-06-05 09:09:04 +08:00
Anup Kumar Panwar
f56dd7f8e3
Update Atbash.py 2019-05-26 22:59:07 +05:30
Shubhayu Das
5be32f4022 Add files via upload (#396) 2019-05-26 22:10:04 +05:30
Ambuj81
7f4f565e62 subset_generation (#326)
* subset_generation

generate all possible subset of size n of a given array of size r

* Rename subset_generation to subset_generation.py

* Update subset_generation.py

I made all changes I could  . What I mean is I removed all the empty space ....... 
There some comment extra if you feel removing those comments please do so yourself pls provide spacing as it should be

* Create morse_Code_implementation.py

* Any more changes pls let me know
2019-05-26 22:07:40 +05:30
nowakowsky
5b7730bef1 Added Trafid Cipher (#746) 2019-04-04 03:27:36 +08:00
Sravan Kumar Vinakota
2b27086c00 Added hill_cipher.py (#696)
A python class that implements the Hill cipher algorithm.
2019-02-22 00:19:28 +08:00
Abhi Kampurath
ad68eed73e Update caesar_cipher.py (#702) 2019-02-19 23:26:09 +08:00
Michael Fried
c92b02cfa3 Editing base64, Adding average file, Editing find_lcm (#673)
* avrage.py

calculate and print the avrage of number list.

* Update base64_cipher.py

encoding and decoding base64 without any module.

* Update and rename avrage.py to average.py

* update find_lcm algorithm

I made find_lcm more efficient form O(num1*num2) to O(min{num1,num2}).
2019-01-20 02:19:06 +05:30
Mickaël Schoentgen
2d70e9f747 Fix ResourceWarning: unclosed file (#681)
Signed-off-by: Mickaël Schoentgen <contact@tiger-222.fr>
2019-01-08 16:59:23 +08:00
Mickaël Schoentgen
3dc50529ca Fix DeprecationWarning: invalid escape sequence (#679)
Signed-off-by: Mickaël Schoentgen <contact@tiger-222.fr>
2019-01-08 16:58:47 +08:00
gerroo
a834326e0e Added b16, b32, a85, abs, absMax, absMin 2018-11-03 12:08:13 -08:00
gerroo
fde422e217 base64
added b64
2018-10-28 13:36:51 -08:00
Harshil
4e0184a41d
Update caesar_cipher.py
Removed unnecessary recursion and updated code!
2018-10-27 14:14:35 +02:00
Harshil
2638d57c71
Update caesar_cipher.py 2018-10-24 21:13:42 +02:00
Alex Brown
ea2ddaaf6a all valid python 3 2018-10-20 14:45:08 -05:00
Alex Brown
b566055e4b Merge branch 'master' of https://github.com/TheAlgorithms/Python 2018-10-20 14:15:21 -05:00
Jonathan Gómez
c0f7df7e22 Fixed error on chr function when decrypt (#359)
On line 23 when make the operations returns a float and chr function doesn't permit float values as parameters.
2018-10-19 15:42:19 +02:00
Alex Brown
564179a0ec increment 1 2018-10-19 07:48:28 -05:00
Alex Brown
718b99ae39 increment 1 2018-10-19 07:48:01 -05:00
Parth Shandilya
5d1f72604d
Improved Code and removed Warnings (#483) 2018-10-19 14:00:31 +05:30
ParthS007
0856a61859 Remove Multiple Unused Imports and Variable 2018-10-18 02:58:57 +05:30
cclauss
3a77380ed3 Undefined name: import random in Onepad_Cipher.py (#339) 2018-09-28 09:47:28 +05:30
cclauss
d4594da532
print() is a function in Python 3 2018-07-02 10:07:25 +02:00
psyas
0c8707d11c Elgamal cipher key generator code - (initial) 2018-06-12 21:21:38 +09:00
psyas
602eae756e Elgamal cipher key generator code - (initial) 2018-06-12 21:18:50 +09:00
Harshil
13617225ca
small improvements! 2018-05-28 23:25:48 +02:00
PyDevthon
f1fe458356
Updated_caesar_cipher.py
Updated
2018-05-28 19:16:02 +05:30
Syed Haseeb Shah
0fdd2d369e
Create Onepad_Cipher.py
In one pad algorithm length of key and length of message are equal which results in endless possibilities of false messages on bruteforce.
2018-04-13 20:49:38 +05:00
ashu01
4fb978cf58 1. typo fix {playfair_cipher.py, AVL.py}
2. Corrected Logic {AVL.py, 104-107}
3. Removed unnecessary semicolons {BellmanFord.py, Dijkstra.py}
2017-12-31 14:30:31 +05:30
Harshil
09cc769660
Merge pull request #220 from cclauss/modernize-python2-code
Modernize Python 2 code to get ready for Python 3
2017-12-29 17:19:02 +05:30
Harshil
eb9fe88e16
Merge pull request #230 from christianbender/master
improvement XOR_cipher.py
2017-12-23 18:25:38 +05:30
Christian Bender
0e7d4483ca
comment out
I comment out some code lines in the test-section
2017-12-22 17:33:09 +01:00
Christian Bender
b25bc2cb30
improvement
I improve my code
2017-12-22 17:30:11 +01:00
Harshil
ecdfd99c04
Merge pull request #229 from christianbender/master
XOR cipher algorithm
2017-12-22 18:24:43 +05:30
Christian Bender
ad265b9b61
XOR cipher algorithm
a class with simple cipher algorithm that uses bitwise XOR
2017-12-21 19:08:58 +01:00
cclauss
e31c780d94 Modernize Python 2 code to get ready for Python 3 2017-11-25 12:41:55 +01:00
cclauss
aed9cb16ec
chunk() --> chuncker() to resolve undefined name
flake8 results:
```
./ciphers/playfair_cipher.py:88:25: F821 undefined name 'chunk'
    for char1, char2 in chunk(ciphertext, 2):
                        ^
```
2017-11-25 12:15:41 +01:00
cclauss
4e06949072 Modernize Python 2 code to get ready for Python 3 2017-11-25 10:23:50 +01:00
Pedro Tôrres
75af340aff ROT13 2017-10-29 14:44:54 -03:00
eevee
73461baeb0 Playfair cipher 2017-08-18 22:41:46 -04:00
Henocks
43513803f0 Slight Performance/Visual Update 2016-11-09 23:17:04 +09:00
Harshil Darji
f5c73a6f26 initial 2016-09-06 17:53:48 +05:30