Merge pull request #273 from j3r3mias/typo-caesar

Fix typos in Caesar Cipher.
This commit is contained in:
Ayush Bhardwaj 2022-10-10 16:28:45 +05:30 committed by GitHub
commit d6b4ad3686
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 33 deletions

View File

@ -22,7 +22,7 @@ So far, the following projects have been integrated to this repo:
|[Bitcoin price GUI](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Bitcoin-Price-GUI) |[Amirul Abu](https://github.com/amirulabu) |
|[Cryptocurrency Converter](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Cryptocurrency-converter) |[AdnCodz](https://github.com/AdnCodez) |
|[Cryptocurrency Prices](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Cryptocurrency-Prices) |[xemeds](https://github.com/xemeds) |
|[Caesar Cipher](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/caeser_cipher) |[epi052](https://github.com/epi052) |
|[Caesar Cipher](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/caesar_cipher) |[epi052](https://github.com/epi052) |
|[Checksum tool](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Checksum) |[Austin Ewens](https://github.com/aewens) |
|[Codechef autosubmitter](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Codechef-Code-Submitter) |[Harshit Mahajan](https://github.com/hmahajan99) |
|[Colored B&W Image Converter](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Color_to_BW_Converter) |[Nitish Srivastava](https://github.com/nitish-iiitd) |
@ -100,7 +100,7 @@ So far, the following projects have been integrated to this repo:
|[Asymmetric Encryption](asymmetric_cryptography) |[victor matheus](https://github.com/victormatheusc) |
|[Bitcoin price GUI](Bitcoin-Price-GUI) |[Amirul Abu](https://github.com/amirulabu) |
|[Cryptocurrency Converter](Cryptocurrency-converter) |[AdnCodz](https://github.com/AdnCodez) |
|[Caesar Cipher](caeser_cipher) |[epi052](https://github.com/epi052) |
|[Caesar Cipher](caesar_cipher) |[epi052](https://github.com/epi052) |
|[Checksum tool](Checksum) |[Austin Ewens](https://github.com/aewens) |
|[Codechef autosubmitter](Codechef-Code-Submitter) |[Harshit Mahajan](https://github.com/hmahajan99) |
|[Colored B&W Image Converter](Color_to_BW_Converter) |[Nitish Srivastava](https://github.com/nitish-iiitd) |

27
caesar_cipher/README.md Normal file
View File

@ -0,0 +1,27 @@
# Simple caesar Cipher [En,De]coder
A simple implementation of a CLI tool to work with caesar ciphers. The default implementation is ROT-13, but can be
adjusted for any offset. Works on files and string arguments passed via CLI.
```bash
python3 caesar.py
usage: caesar.py [-h] [-d] [-o OFFSET] (-f FILE | -s STRING)
caesar.py: error: one of the arguments -f/--file -s/--string is required
```
```bash
python3 caesar.py -s "have you tried turning it off and on again?"
unir lbh gevrq gheavat vg bss naq ba ntnva?
```
```bash
python3 caesar.py -d -s "unir lbh gevrq gheavat vg bss naq ba ntnva?"
have you tried turning it off and on again?
```
```bash
python3 caesar.py -s "have you tried turning it off and on again?" -o -4
dwra ukq pneaz pqnjejc ep kbb wjz kj wcwej?
```

View File

@ -9,8 +9,8 @@ except AttributeError:
maketrans = str.maketrans # python3
def caeser_cipher(string_: str, offset: int, decode: bool, file_: string) -> None:
""" Caeser Cipher implementation, reads file or string. Also decodes.
def caesar_cipher(string_: str, offset: int, decode: bool, file_: string) -> None:
""" caesar Cipher implementation, reads file or string. Also decodes.
Default implementation is ROT13 encoding.
@ -59,7 +59,7 @@ def check_offset_range(value: int) -> int:
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="Simple Caeser Cipher [En,De]coder")
parser = argparse.ArgumentParser(description="Simple caesar Cipher [En,De]coder")
parser.add_argument('-d', '--decode', action='store_true', dest='decode',
help='decode ciphertext (offset should equal what was used to encode)', default=False)
@ -72,4 +72,4 @@ if __name__ == '__main__':
args = parser.parse_args()
caeser_cipher(args.string, args.offset, args.decode, args.file)
caesar_cipher(args.string, args.offset, args.decode, args.file)

View File

@ -1,27 +0,0 @@
# Simple Caeser Cipher [En,De]coder
A simple implementation of a CLI tool to work with caeser ciphers. The default implementation is ROT-13, but can be
adjusted for any offset. Works on files and string arguments passed via CLI.
```bash
python3 caeser.py
usage: caeser.py [-h] [-d] [-o OFFSET] (-f FILE | -s STRING)
caeser.py: error: one of the arguments -f/--file -s/--string is required
```
```bash
python3 caeser.py -s "have you tried turning it off and on again?"
unir lbh gevrq gheavat vg bss naq ba ntnva?
```
```bash
python3 caeser.py -d -s "unir lbh gevrq gheavat vg bss naq ba ntnva?"
have you tried turning it off and on again?
```
```bash
python3 caeser.py -s "have you tried turning it off and on again?" -o -4
dwra ukq pneaz pqnjejc ep kbb wjz kj wcwej?
```