mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
Travis CI: Don’t allow bare exceptions (#1734)
* Travis CI: Don’t allow bare exceptions * fixup! Format Python code with psf/black push * except IOError: * except IOError: * Update hamming_code.py * IndexError * Get rid of the nonsense logic Co-authored-by: John Law <johnlaw.po@gmail.com>
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
import math
|
||||
|
||||
'''
|
||||
"""
|
||||
In cryptography, the TRANSPOSITION cipher is a method of encryption where the
|
||||
positions of plaintext are shifted a certain number(determined by the key) that
|
||||
follows a regular system that results in the permuted text, known as the encrypted
|
||||
text. The type of transposition cipher demonstrated under is the ROUTE cipher.
|
||||
'''
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
message = input("Enter message: ")
|
||||
key = int(input("Enter key [2-%s]: " % (len(message) - 1)))
|
||||
|
||||
@@ -148,7 +148,7 @@ class XORCipher:
|
||||
for line in fin:
|
||||
fout.write(self.encrypt_string(line, key))
|
||||
|
||||
except:
|
||||
except IOError:
|
||||
return False
|
||||
|
||||
return True
|
||||
@@ -173,7 +173,7 @@ class XORCipher:
|
||||
for line in fin:
|
||||
fout.write(self.decrypt_string(line, key))
|
||||
|
||||
except:
|
||||
except IOError:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user