-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* beta branch * banner styling & readme update * update readme * update to banner generation * add gaderypoluki.py (#50) * add gaderypoluki.py * fix * bug fixes * Update update.py Co-authored-by: Martin <marvahus@proton.me> Co-authored-by: Martin <44480334+marvhus@users.noreply.github.com> * Updated README.md (#56) * Update README.md Removed guide on how to use cryptex, and linked to wiki. Changed version number for Pumpkin Patch from V0.1.0 to V1.0.0 * Update CONTRIBUTING.md Added instructions for adding featured in the beta branch * added sha 224, 256, 384 hash algorithms (#57) * cryoads setup * loki resolves * added sha 224, 256, 384 hash algorithms Co-authored-by: Shepherd <81541045+ItsJustShepherd@users.noreply.github.com> Co-authored-by: Alex Kollar <89718570+AlexKollar@users.noreply.github.com> Co-authored-by: Martin <44480334+marvhus@users.noreply.github.com> * add pb cipher (#60) Co-authored-by: Martin <marvahus@proton.me> * Update README.md * Update README.md * Update CONTRIBUTING.md * Made lots of tweaks to the grammar, spellings, and made the overall text sound more concise. (#61) * Update README.md * Update CONTRIBUTING.md * Made lots of tweaks to the grammar, spellings, and made the overall text sound more concise. Co-authored-by: Martin <44480334+marvhus@users.noreply.github.com> * Fixed SE error where it overwrote the image content * add tests (#47) * add test * added tests fro cc, and text * Added some tests, and exceptions * Added tests * Added some tests - r47 -- Rot 47 - rc --- Reverse Cipher * B64 test * Updates to ciphers and requirements - Changed required googletrans version from 3.0.0 to 3.1.0a0 - Added test for L33T.py - Added test for mor.py - Added test for oct.py - Added test for translate.py - Added test for vig.py - Added test for xor.py modified: requirements.txt modified: src/cipher/ciphers/L33T.py modified: src/cipher/ciphers/mor.py modified: src/cipher/ciphers/oct.py modified: src/cipher/ciphers/translate.py modified: src/cipher/ciphers/vig.py modified: src/cipher/ciphers/xor.py * feat: Add Affine Cipher (#66) * Update README.md * Update CONTRIBUTING.md * add affine cipher Co-authored-by: Martin <44480334+marvhus@users.noreply.github.com> Co-authored-by: Martin <marvahus@proton.me> * feat: Add Playfair Cipher (#67) * Update README.md * Update CONTRIBUTING.md * add playfair cipher Co-authored-by: Martin <44480334+marvhus@users.noreply.github.com> Co-authored-by: Martin <marvahus@proton.me> * final preparations for merge Co-authored-by: bmalvo <95172679+bmalvo@users.noreply.github.com> Co-authored-by: Sowham Bhuin <108983339+sb-decoder@users.noreply.github.com> Co-authored-by: R C N <plbwymw@gmail.com> Co-authored-by: Shepherd <81541045+ItsJustShepherd@users.noreply.github.com> Co-authored-by: Alex Kollar <89718570+AlexKollar@users.noreply.github.com> Co-authored-by: mastdev <44112399+mastdev@users.noreply.github.com> Co-authored-by: dia <54020066+dianosaur12@users.noreply.github.com>
- Loading branch information
1 parent
1c07649
commit b953983
Showing
30 changed files
with
907 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
qrcode | ||
Cryptography | ||
googletrans==3.0.0 | ||
googletrans==3.1.0a0 | ||
colorama | ||
pillow | ||
numpy | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
""" | ||
Author: Sparsh Gupta | Contributor | ||
Description: Affine Cipher Implementation | ||
""" | ||
from cipher import Cipher | ||
import math | ||
|
||
def extended_euclidean_common_devisor(a, b): | ||
if a == 0: | ||
return (b, 0, 1) | ||
else: | ||
gcd, x, y = extended_euclidean_common_devisor(b % a, a) | ||
return (gcd, y - (b // a) * x, x) | ||
|
||
|
||
def mod_inv(a, m): | ||
gcd, x, _ = extended_euclidean_common_devisor(a, m) | ||
if gcd != 1: | ||
return None # modular inverse does not exist | ||
else: | ||
return x % m | ||
|
||
class Affine(Cipher): #make sure you change this from text to your cipher | ||
|
||
name = 'Affine' #change the name | ||
type = 'cipher' | ||
|
||
|
||
def encode(args): | ||
text = args.text | ||
key_a=args.key_a | ||
key_b=args.key_b | ||
|
||
if not text: | ||
return {'text': "No input text", 'success': False} | ||
|
||
if key_a==None : | ||
key_a=1 | ||
if key_b==None: | ||
key_b=0 | ||
|
||
|
||
default_dict='abcdefghijklmnopqrstuvwxyz' | ||
m=len(default_dict) | ||
|
||
output='' | ||
for char in text: | ||
if(char in default_dict): | ||
x=default_dict.find(char) | ||
e_x=(key_a*x+key_b)%m | ||
output+=default_dict[e_x] | ||
else: | ||
output+=char | ||
return {'text': output, 'success': True} | ||
|
||
def decode(args): | ||
text = args.text | ||
key_a=args.key_a | ||
key_b=args.key_b | ||
|
||
if not text: | ||
return {'text': "No input text", 'success': False} | ||
|
||
if key_a==None : | ||
key_a=1 | ||
if key_b==None: | ||
key_b=0 | ||
|
||
|
||
default_dict='abcdefghijklmnopqrstuvwxyz' | ||
m=len(default_dict) | ||
|
||
output='' | ||
for char in text: | ||
if(char in default_dict): | ||
x=default_dict.find(char) | ||
e_x=(mod_inv(key_a,m)*((x-key_b)%m))%m | ||
output+=default_dict[e_x] | ||
else: | ||
output+=char | ||
return {'text': output, 'success': True} | ||
|
||
|
||
def print_options(): | ||
#Edit this section as needed for your specific encoding / decoding. | ||
print(''' | ||
### Modes | ||
-d / --decode ---- decode | ||
-e / --encode ---- encode | ||
### Input | ||
-t / --text ------ input text | ||
-ka / --key_a ------input key -a | ||
-kb / --key_b -------input key -b | ||
### Examples | ||
python main.py text -e -t 'hello' -ka 21 -kb 1 | ||
python main.py text -d -t 'hello' -ka 2 | ||
Note: Cipher is Case Sensitive. Default Dictionary: abcdefghijklmnopqrstuvwxyz | ||
''') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.