path
stringlengths 9
117
| type
stringclasses 2
values | project
stringclasses 10
values | commit_hash
stringlengths 40
40
| commit_message
stringlengths 1
137
| ground_truth
stringlengths 0
2.74k
| main_code
stringlengths 102
3.37k
| context
stringlengths 0
14.7k
|
---|---|---|---|---|---|---|---|
app.Tests.test_neural_network/TestNN.test_sha512_yes | Modified | Ciphey~Ciphey | 6009f35c1442c11bba654adefaa01328cb2b94fa | Fixed some Pytest stuff | <0>:<add> model = app.neuralNetworkMod.nn.NeuralNetwork()
<del> model = NeuralNetwork()
| # module: app.Tests.test_neural_network
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
class TestNN(unittest.TestCase):
def test_sha512_yes(self):
<0> model = NeuralNetwork()
<1> result = model.predictnn("9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043")
<2> numpy.set_printoptions(suppress=True)
<3> result = numpy.argmax(result)
<4> self.assertEqual(result, 3)
<5>
| ===========unchanged ref 0===========
at: app.neuralNetworkMod.nn
NeuralNetwork()
at: app.neuralNetworkMod.nn.NeuralNetwork
predictnn(text)
at: numpy.core.arrayprint
set_printoptions(precision: None | SupportsIndex=..., threshold: None | int=..., edgeitems: None | int=..., linewidth: None | int=..., suppress: None | bool=..., nanstr: None | str=..., infstr: None | str=..., formatter: None | _FormatDict=..., sign: Literal[None, "-", "+", " "]=..., floatmode: None | _FloatMode=..., *, legacy: Literal[None, False, "1.13", "1.21"]=...) -> None
at: numpy.core.fromnumeric
argmax(a: ArrayLike, axis: None=..., out: None=..., *, keepdims: Literal[False]=...) -> intp
argmax(a: ArrayLike, axis: None | SupportsIndex=..., out: _ArrayType=..., *, keepdims: bool=...) -> _ArrayType
argmax(a: ArrayLike, axis: None | SupportsIndex=..., out: None=..., *, keepdims: bool=...) -> Any
at: unittest.case.TestCase
assertEqual(first: Any, second: Any, msg: Any=...) -> None
===========changed ref 0===========
# module: app.Tests.test_neural_network
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
class TestNN(unittest.TestCase):
def test_md5_yes(self):
+ model = app.neuralNetworkMod.nn.NeuralNetwork()
- model = NeuralNetwork()
result = model.predictnn("5d41402abc4b2a76b9719d911017c592")
numpy.set_printoptions(suppress=True)
result = numpy.argmax(result)
self.assertEqual(result, 1)
===========changed ref 1===========
# module: app.Tests.test_neural_network
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
class TestNN(unittest.TestCase):
def test_sha1_yes(self):
+ model = app.neuralNetworkMod.nn.NeuralNetwork()
- model = NeuralNetwork()
result = model.predictnn("6D32263A85C7846D70439026B75758C9FC31A9B7")
numpy.set_printoptions(suppress=True)
result = numpy.argmax(result)
self.assertEqual(result, 0)
===========changed ref 2===========
# module: app.Tests.test_neural_network
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
class TestNN(unittest.TestCase):
def test_english_yes(self):
"""Checks to see if it returns True (it should)"""
+ model = app.neuralNetworkMod.nn.NeuralNetwork()
- model = NeuralNetwork()
result = model.predictnn("bcpvu up qvu ifs cpplt bxbz, cvu jotufbe tif qvmmfe")
numpy.set_printoptions(suppress=True)
result = numpy.argmax(result)
self.assertEqual(result, 4)
===========changed ref 3===========
+ # module: app.Decryptor
+
+
===========changed ref 4===========
# module: app.Tests.test_basic_parent
-
-
===========changed ref 5===========
# module: app.Tests.test_Encoding
-
-
===========changed ref 6===========
# module: app.Tests.test_caesarcipher_basic
-
-
===========changed ref 7===========
# module: app.Tests.test_basic_parent
- sys.path.append("..")
-
===========changed ref 8===========
# module: app.Tests.test_Encoding
- sys.path.append("..")
-
===========changed ref 9===========
# module: app.Tests.test_caesarcipher_basic
- sys.path.append("..")
-
===========changed ref 10===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_unusual_three(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("")
self.assertEqual(result, False)
===========changed ref 11===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_unusual_6(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("\"")
self.assertEqual(result, False)
===========changed ref 12===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_unusual_five(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("#")
self.assertEqual(result, False)
===========changed ref 13===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_unusual_four(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage(".")
self.assertEqual(result, False)
===========changed ref 14===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics_german(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("hallo keine lieben leute nach")
self.assertEqual(result, True)
===========changed ref 15===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_unusual_one(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("HELLO MY NAME IS BRANDON AND I LIKE DOLLAR")
self.assertEqual(result, True)
|
app.Tests.test_neural_network/TestNN.test_caesar_yes | Modified | Ciphey~Ciphey | 6009f35c1442c11bba654adefaa01328cb2b94fa | Fixed some Pytest stuff | <0>:<add> model = app.neuralNetworkMod.nn.NeuralNetwork()
<del> model = NeuralNetwork()
| # module: app.Tests.test_neural_network
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
class TestNN(unittest.TestCase):
def test_caesar_yes(self):
<0> model = NeuralNetwork()
<1> result = model.predictnn("bcpvu up qvu ifs cpplt bxbz, cvu jotufbe tif qvmmfe")
<2> numpy.set_printoptions(suppress=True)
<3> result = numpy.argmax(result)
<4> self.assertEqual(result, 4)
<5>
| ===========unchanged ref 0===========
at: app.neuralNetworkMod.nn
NeuralNetwork()
at: app.neuralNetworkMod.nn.NeuralNetwork
predictnn(text)
at: numpy.core.arrayprint
set_printoptions(precision: None | SupportsIndex=..., threshold: None | int=..., edgeitems: None | int=..., linewidth: None | int=..., suppress: None | bool=..., nanstr: None | str=..., infstr: None | str=..., formatter: None | _FormatDict=..., sign: Literal[None, "-", "+", " "]=..., floatmode: None | _FloatMode=..., *, legacy: Literal[None, False, "1.13", "1.21"]=...) -> None
at: numpy.core.fromnumeric
argmax(a: ArrayLike, axis: None=..., out: None=..., *, keepdims: Literal[False]=...) -> intp
argmax(a: ArrayLike, axis: None | SupportsIndex=..., out: _ArrayType=..., *, keepdims: bool=...) -> _ArrayType
argmax(a: ArrayLike, axis: None | SupportsIndex=..., out: None=..., *, keepdims: bool=...) -> Any
at: unittest.case.TestCase
assertEqual(first: Any, second: Any, msg: Any=...) -> None
===========changed ref 0===========
# module: app.Tests.test_neural_network
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
class TestNN(unittest.TestCase):
def test_md5_yes(self):
+ model = app.neuralNetworkMod.nn.NeuralNetwork()
- model = NeuralNetwork()
result = model.predictnn("5d41402abc4b2a76b9719d911017c592")
numpy.set_printoptions(suppress=True)
result = numpy.argmax(result)
self.assertEqual(result, 1)
===========changed ref 1===========
# module: app.Tests.test_neural_network
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
class TestNN(unittest.TestCase):
def test_sha1_yes(self):
+ model = app.neuralNetworkMod.nn.NeuralNetwork()
- model = NeuralNetwork()
result = model.predictnn("6D32263A85C7846D70439026B75758C9FC31A9B7")
numpy.set_printoptions(suppress=True)
result = numpy.argmax(result)
self.assertEqual(result, 0)
===========changed ref 2===========
# module: app.Tests.test_neural_network
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
class TestNN(unittest.TestCase):
def test_english_yes(self):
"""Checks to see if it returns True (it should)"""
+ model = app.neuralNetworkMod.nn.NeuralNetwork()
- model = NeuralNetwork()
result = model.predictnn("bcpvu up qvu ifs cpplt bxbz, cvu jotufbe tif qvmmfe")
numpy.set_printoptions(suppress=True)
result = numpy.argmax(result)
self.assertEqual(result, 4)
===========changed ref 3===========
# module: app.Tests.test_neural_network
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
class TestNN(unittest.TestCase):
def test_sha512_yes(self):
+ model = app.neuralNetworkMod.nn.NeuralNetwork()
- model = NeuralNetwork()
result = model.predictnn("9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043")
numpy.set_printoptions(suppress=True)
result = numpy.argmax(result)
self.assertEqual(result, 3)
===========changed ref 4===========
+ # module: app.Decryptor
+
+
===========changed ref 5===========
# module: app.Tests.test_basic_parent
-
-
===========changed ref 6===========
# module: app.Tests.test_Encoding
-
-
===========changed ref 7===========
# module: app.Tests.test_caesarcipher_basic
-
-
===========changed ref 8===========
# module: app.Tests.test_basic_parent
- sys.path.append("..")
-
===========changed ref 9===========
# module: app.Tests.test_Encoding
- sys.path.append("..")
-
===========changed ref 10===========
# module: app.Tests.test_caesarcipher_basic
- sys.path.append("..")
-
===========changed ref 11===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_unusual_three(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("")
self.assertEqual(result, False)
===========changed ref 12===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_unusual_6(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("\"")
self.assertEqual(result, False)
===========changed ref 13===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_unusual_five(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("#")
self.assertEqual(result, False)
===========changed ref 14===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_unusual_four(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage(".")
self.assertEqual(result, False)
|
app.Decryptor.basicEncryption.reverse/Reverse.__init__ | Modified | Ciphey~Ciphey | 6009f35c1442c11bba654adefaa01328cb2b94fa | Fixed some Pytest stuff | <1>:<add> self.mh = app.mathsHelper.mathsHelper()
<del> self.mh = mathsHelper.mathsHelper()
| # module: app.Decryptor.basicEncryption.reverse
+
+
class Reverse:
def __init__(self, lc):
<0> self.lc = lc
<1> self.mh = mathsHelper.mathsHelper()
<2>
| ===========unchanged ref 0===========
at: mathsHelper
mathsHelper()
===========changed ref 0===========
+ # module: app.Decryptor.Encoding
+
+
===========changed ref 1===========
+ # module: app.Decryptor
+
+
===========changed ref 2===========
# module: app.Tests.test_basic_parent
-
-
===========changed ref 3===========
# module: app.Tests.test_Encoding
-
-
===========changed ref 4===========
# module: app.Tests.test_caesarcipher_basic
-
-
===========changed ref 5===========
# module: app.Tests.test_basic_parent
- sys.path.append("..")
-
===========changed ref 6===========
# module: app.Tests.test_Encoding
- sys.path.append("..")
-
===========changed ref 7===========
# module: app.Tests.test_caesarcipher_basic
- sys.path.append("..")
-
===========changed ref 8===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_unusual_three(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("")
self.assertEqual(result, False)
===========changed ref 9===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_unusual_6(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("\"")
self.assertEqual(result, False)
===========changed ref 10===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_unusual_five(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("#")
self.assertEqual(result, False)
===========changed ref 11===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_unusual_four(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage(".")
self.assertEqual(result, False)
===========changed ref 12===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics_german(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("hallo keine lieben leute nach")
self.assertEqual(result, True)
===========changed ref 13===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_unusual_one(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("HELLO MY NAME IS BRANDON AND I LIKE DOLLAR")
self.assertEqual(result, True)
===========changed ref 14===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("Hello my name is new and this is an example of some english text")
self.assertEqual(result, True)
===========changed ref 15===========
# module: app.languageCheckerMod.dictionaryChecker
class dictionaryChecker:
def __init__(self):
+ self.mh = app.mathsHelper.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
self.languagePercentage = 0.0
self.languageWordsCounter = 0.0
self.languageThreshold = 55
===========changed ref 16===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_unusual_two(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
self.assertEqual(result, False)
===========changed ref 17===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_unusual_7(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("")
self.assertEqual(result, False)
===========changed ref 18===========
# module: app.Tests.test_chi_squared
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestChi(unittest.TestCase):
def tests_english_no_words(self):
+ self.chi = app.languageCheckerMod.chisquared.chiSquared()
- self.chi = chisquared.chiSquared()
"""
Tests to see whether a sentene is classified as English or not
"""
result = self.chi.checkChi("!!!!!!!!!!!!!!!!!!!")
self.assertEqual(result, True)
===========changed ref 19===========
# module: app.Tests.test_Encoding
+ #from languageCheckerMod import LanguageChecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
class TestNN(unittest.TestCase):
def test_english_yes(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
+ ep = app.Decryptor.Encoding.encodingParent.EncodingParent(lc)
- lc = LanguageChecker()
- ep = EncodingParent(lc)
result = ep.decrypt("eW91ciB0ZXh0")
self.assertEqual(result['IsPlaintext?'], True)
|
app.languageCheckerMod.chisquared/chiSquared.__init__ | Modified | Ciphey~Ciphey | 6009f35c1442c11bba654adefaa01328cb2b94fa | Fixed some Pytest stuff | # module: app.languageCheckerMod.chisquared
class chiSquared:
def __init__(self):
<0> self.languages = {
<1> "English":
<2> #[0.0855, 0.0160, 0.0316, 0.0387, 0.1210,0.0218, 0.0209, 0.0496, 0.0733, 0.0022,0.0081, 0.0421, 0.0253, 0.0717, 0.0747,0.0207, 0.0010, 0.0633, 0.0673, 0.0894,0.0268, 0.0106, 0.0183, 0.0019, 0.0172,0.0011]
<3> #{'A': 8.12, 'B': 1.49, 'C': 2.71, 'D': 4.32, 'E': 12.02, 'F': 2.3, 'G': 2.03, 'H': 5.92, 'I': 7.31, 'J': 0.1, 'K': 0.69, 'L': 3.98, 'M': 2.61, 'N': 6.95, 'O': 7.68, 'P': 1.82, 'Q': 0.11, 'R': 6.02, 'S': 6.28, 'T': 9.1, 'U': 2.88, 'V': 1.11, 'W': 2.09, 'X': 0.17, 'Y': 2.11, 'Z': 0.07}
<4> [0.0812, 0.0271, 0.0149, 0.1202, 0.0432, 0.0203, 0.023, 0.0731, 0.0592, 0.0069, 0.001, 0.026099999999999998, 0.0398, 0.0768, 0.0695, 0.0011, 0.0182, 0.06280000000000001, 0.0602, 0.0288, 0.091, 0.0209, 0.0111, 0.021099999999999997, 0.0017000000000000001</s> | ===========below chunk 0===========
# module: app.languageCheckerMod.chisquared
class chiSquared:
def __init__(self):
# offset: 1
}
self.average = 0.0
self.totalDone = 0.0
self.oldAverage = 0.0
self.mh = mathsHelper.mathsHelper()
self.highestLanguage = ""
self.totalChi = 0.0
self.totalEqual = False
self.chisAsaList = []
# these are settings that may impact how the program works overall
self.chiSquaredSignificaneThreshold = 1 # how many stds you want to go below it
self.totalDoneThreshold = 10
self.standarddeviation = 0.00 # the standard deviation I use
self.oldstandarddeviation = 0.00
===========unchanged ref 0===========
at: app.languageCheckerMod.chisquared.chiSquared.chiSquared
self.totalEqual = self.mh.checkEqual(list(letterFreq.values()))
self.highestLanguage = language
self.oldAverage = self.average
self.totalDone += 1
self.average = (self.totalChi + maxChiSquare) / self.totalDone
self.oldstandarddeviation = abs(self.standarddeviation)
self.standarddeviation = abs(std(self.chisAsaList))
at: mathsHelper
mathsHelper()
===========changed ref 0===========
+ # module: app.Decryptor.Encoding
+
+
===========changed ref 1===========
+ # module: app.Decryptor
+
+
===========changed ref 2===========
# module: app.Tests.test_basic_parent
-
-
===========changed ref 3===========
# module: app.Tests.test_Encoding
-
-
===========changed ref 4===========
# module: app.Tests.test_caesarcipher_basic
-
-
===========changed ref 5===========
# module: app.Tests.test_basic_parent
- sys.path.append("..")
-
===========changed ref 6===========
# module: app.Tests.test_Encoding
- sys.path.append("..")
-
===========changed ref 7===========
# module: app.Tests.test_caesarcipher_basic
- sys.path.append("..")
-
===========changed ref 8===========
# module: app.Decryptor.basicEncryption.reverse
+
+
class Reverse:
def __init__(self, lc):
self.lc = lc
+ self.mh = app.mathsHelper.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
===========changed ref 9===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_unusual_three(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("")
self.assertEqual(result, False)
===========changed ref 10===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_unusual_6(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("\"")
self.assertEqual(result, False)
===========changed ref 11===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_unusual_five(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("#")
self.assertEqual(result, False)
===========changed ref 12===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_unusual_four(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage(".")
self.assertEqual(result, False)
===========changed ref 13===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics_german(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("hallo keine lieben leute nach")
self.assertEqual(result, True)
===========changed ref 14===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_unusual_one(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("HELLO MY NAME IS BRANDON AND I LIKE DOLLAR")
self.assertEqual(result, True)
===========changed ref 15===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("Hello my name is new and this is an example of some english text")
self.assertEqual(result, True)
===========changed ref 16===========
# module: app.languageCheckerMod.dictionaryChecker
class dictionaryChecker:
def __init__(self):
+ self.mh = app.mathsHelper.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
self.languagePercentage = 0.0
self.languageWordsCounter = 0.0
self.languageThreshold = 55
===========changed ref 17===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_unusual_two(self):
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
self.assertEqual(result, False)
|
|
app.Tests.test_integration_languagechecker/TestLanguageChecker.test_basics_german | Modified | Ciphey~Ciphey | 81e6a5c14253bd258fa1a51f80fa1e0ea28884d9 | All tests - FIXED | <2>:<add> self.assertEqual(result, False)
<del> self.assertEqual(result, True)
| # module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics_german(self):
<0> lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
<1> result = lc.checkLanguage("hallo keine lieben leute nach")
<2> self.assertEqual(result, True)
<3>
| ===========unchanged ref 0===========
at: app.languageCheckerMod.LanguageChecker
LanguageChecker()
at: app.languageCheckerMod.LanguageChecker.LanguageChecker
checkLanguage(text)
at: unittest.case.TestCase
failureException: Type[BaseException]
longMessage: bool
maxDiff: Optional[int]
_testMethodName: str
_testMethodDoc: str
assertEqual(first: Any, second: Any, msg: Any=...) -> None
|
app.Tests.test_integration_languagechecker/TestLanguageChecker.test_basics_quickbrownfox | Modified | Ciphey~Ciphey | 81e6a5c14253bd258fa1a51f80fa1e0ea28884d9 | All tests - FIXED | <3>:<add> lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
<del> lc = LanguageChecker()
| # module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics_quickbrownfox(self):
<0> """
<1> This returns true becaue by default chi squared returns true so long as it's less than 10 items it's processed
<2> """
<3> lc = LanguageChecker()
<4> result = lc.checkLanguage("The quick brown fox jumped over the lazy dog")
<5> self.assertEqual(result, True)
<6>
| ===========unchanged ref 0===========
at: app.languageCheckerMod.LanguageChecker
LanguageChecker()
at: app.languageCheckerMod.LanguageChecker.LanguageChecker
checkLanguage(text)
at: unittest.case.TestCase
assertEqual(first: Any, second: Any, msg: Any=...) -> None
===========changed ref 0===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics_german(self):
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
result = lc.checkLanguage("hallo keine lieben leute nach")
+ self.assertEqual(result, False)
- self.assertEqual(result, True)
|
app.Tests.test_integration_languagechecker/TestLanguageChecker.test_integration_addition | Modified | Ciphey~Ciphey | 81e6a5c14253bd258fa1a51f80fa1e0ea28884d9 | All tests - FIXED | <6>:<add> lc2 = app.languageCheckerMod.LanguageChecker.LanguageChecker()
<del> lc2 = app.LanguageChecker()
| # module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_addition(self):
<0> """
<1> Makes sure you can add 2 lanuggae objecs together
<2> """
<3> lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
<4> result = lc.checkLanguage("hello my darling")
<5>
<6> lc2 = app.LanguageChecker()
<7> result = lc.checkLanguage("sad as dasr as s")
<8>
<9> temp = lc.getChiScore()
<10> temp2 = lc2.getChiScore()
<11> temp3 = temp + temp2
<12> lc3 = lc + lc2
<13>
<14> self.assertAlmostEqual(lc3.getChiScore(), temp3)
<15>
| ===========unchanged ref 0===========
at: app.languageCheckerMod.LanguageChecker
LanguageChecker()
at: app.languageCheckerMod.LanguageChecker.LanguageChecker
checkLanguage(text)
getChiScore()
at: unittest.case.TestCase
assertAlmostEqual(first: float, second: float, places: Optional[int]=..., msg: Any=..., delta: Optional[float]=...) -> None
assertAlmostEqual(first: datetime.datetime, second: datetime.datetime, places: Optional[int]=..., msg: Any=..., delta: Optional[datetime.timedelta]=...) -> None
===========changed ref 0===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics_german(self):
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
result = lc.checkLanguage("hallo keine lieben leute nach")
+ self.assertEqual(result, False)
- self.assertEqual(result, True)
===========changed ref 1===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics_quickbrownfox(self):
"""
This returns true becaue by default chi squared returns true so long as it's less than 10 items it's processed
"""
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("The quick brown fox jumped over the lazy dog")
self.assertEqual(result, True)
|
app.neuralNetworkMod.nn/NeuralNetwork.__init__ | Modified | Ciphey~Ciphey | 81e6a5c14253bd258fa1a51f80fa1e0ea28884d9 | All tests - FIXED | <3>:<add>
<del> import mathsHelper
<4>:<add> self.mh = app.mathsHelper.mathsHelper()
<del> self.mh = mathsHelper.mathsHelper()
| # module: app.neuralNetworkMod.nn
class NeuralNetwork:
def __init__(self):
<0> self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
<1> self.CATEGORIES = [1, 2, 3, 4, 5, 6]
<2> self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
<3> import mathsHelper
<4> self.mh = mathsHelper.mathsHelper()
<5>
| ===========changed ref 0===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics_german(self):
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
result = lc.checkLanguage("hallo keine lieben leute nach")
+ self.assertEqual(result, False)
- self.assertEqual(result, True)
===========changed ref 1===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics_quickbrownfox(self):
"""
This returns true becaue by default chi squared returns true so long as it's less than 10 items it's processed
"""
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("The quick brown fox jumped over the lazy dog")
self.assertEqual(result, True)
===========changed ref 2===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_addition(self):
"""
Makes sure you can add 2 lanuggae objecs together
"""
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
result = lc.checkLanguage("hello my darling")
+ lc2 = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc2 = app.LanguageChecker()
result = lc.checkLanguage("sad as dasr as s")
temp = lc.getChiScore()
temp2 = lc2.getChiScore()
temp3 = temp + temp2
lc3 = lc + lc2
self.assertAlmostEqual(lc3.getChiScore(), temp3)
|
app.Tests.test_caesarcipher_basic/TestChi.test_caesar_yes | Modified | Ciphey~Ciphey | 81e6a5c14253bd258fa1a51f80fa1e0ea28884d9 | All tests - FIXED | <2>:<add> c = app.Decryptor.basicEncryption.caesar.Caesar(lc)
<del> c = Caesar.Caesar(lc)
| <s>: app.Tests.test_caesarcipher_basic
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar"}
-
class TestChi(unittest.TestCase):
def test_caesar_yes(self):
<0> """Checks to see if it returns True (it should)"""
<1> lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
<2> c = Caesar.Caesar(lc)
<3> result = c.decrypt("uryyb zl sngure uryyb zl zbgure naq v ernyyl qb yvxr n tbbq ratyvfu oernxsnfg")
<4> self.assertEqual(result['IsPlaintext?'], True)
<5>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.caesar
Caesar(lc)
at: app.Decryptor.basicEncryption.caesar.Caesar
decrypt(message)
at: app.languageCheckerMod.LanguageChecker
LanguageChecker()
at: unittest.case.TestCase
failureException: Type[BaseException]
longMessage: bool
maxDiff: Optional[int]
_testMethodName: str
_testMethodDoc: str
assertEqual(first: Any, second: Any, msg: Any=...) -> None
===========changed ref 0===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics_german(self):
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
result = lc.checkLanguage("hallo keine lieben leute nach")
+ self.assertEqual(result, False)
- self.assertEqual(result, True)
===========changed ref 1===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics_quickbrownfox(self):
"""
This returns true becaue by default chi squared returns true so long as it's less than 10 items it's processed
"""
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("The quick brown fox jumped over the lazy dog")
self.assertEqual(result, True)
===========changed ref 2===========
# module: app.neuralNetworkMod.nn
class NeuralNetwork:
def __init__(self):
self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
self.CATEGORIES = [1, 2, 3, 4, 5, 6]
self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
+
- import mathsHelper
+ self.mh = app.mathsHelper.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
===========changed ref 3===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_addition(self):
"""
Makes sure you can add 2 lanuggae objecs together
"""
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
result = lc.checkLanguage("hello my darling")
+ lc2 = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc2 = app.LanguageChecker()
result = lc.checkLanguage("sad as dasr as s")
temp = lc.getChiScore()
temp2 = lc2.getChiScore()
temp3 = temp + temp2
lc3 = lc + lc2
self.assertAlmostEqual(lc3.getChiScore(), temp3)
|
app.Tests.test_caesarcipher_basic/TestChi.test_caesar_no | Modified | Ciphey~Ciphey | 81e6a5c14253bd258fa1a51f80fa1e0ea28884d9 | All tests - FIXED | <2>:<add> c = app.Decryptor.basicEncryption.caesar.Caesar(lc)
<del> c = Caesar.Caesar(lc)
| <s>.Tests.test_caesarcipher_basic
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar"}
-
class TestChi(unittest.TestCase):
def test_caesar_no(self):
<0> """Checks to see if it returns True (it should)"""
<1> lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
<2> c = Caesar.Caesar(lc)
<3> result = c.decrypt("o iozad iikwas")
<4> self.assertEqual(result['IsPlaintext?'], False)
<5>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.caesar
Caesar(lc)
at: app.Decryptor.basicEncryption.caesar.Caesar
decrypt(message)
at: app.languageCheckerMod.LanguageChecker
LanguageChecker()
at: unittest.case.TestCase
assertEqual(first: Any, second: Any, msg: Any=...) -> None
===========changed ref 0===========
<s>: app.Tests.test_caesarcipher_basic
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar"}
-
class TestChi(unittest.TestCase):
def test_caesar_yes(self):
"""Checks to see if it returns True (it should)"""
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
+ c = app.Decryptor.basicEncryption.caesar.Caesar(lc)
- c = Caesar.Caesar(lc)
result = c.decrypt("uryyb zl sngure uryyb zl zbgure naq v ernyyl qb yvxr n tbbq ratyvfu oernxsnfg")
self.assertEqual(result['IsPlaintext?'], True)
===========changed ref 1===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics_german(self):
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
result = lc.checkLanguage("hallo keine lieben leute nach")
+ self.assertEqual(result, False)
- self.assertEqual(result, True)
===========changed ref 2===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics_quickbrownfox(self):
"""
This returns true becaue by default chi squared returns true so long as it's less than 10 items it's processed
"""
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("The quick brown fox jumped over the lazy dog")
self.assertEqual(result, True)
===========changed ref 3===========
# module: app.neuralNetworkMod.nn
class NeuralNetwork:
def __init__(self):
self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
self.CATEGORIES = [1, 2, 3, 4, 5, 6]
self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
+
- import mathsHelper
+ self.mh = app.mathsHelper.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
===========changed ref 4===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_addition(self):
"""
Makes sure you can add 2 lanuggae objecs together
"""
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
result = lc.checkLanguage("hello my darling")
+ lc2 = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc2 = app.LanguageChecker()
result = lc.checkLanguage("sad as dasr as s")
temp = lc.getChiScore()
temp2 = lc2.getChiScore()
temp3 = temp + temp2
lc3 = lc + lc2
self.assertAlmostEqual(lc3.getChiScore(), temp3)
|
app.Tests.test_caesarcipher_basic/TestChi.test_caesar_plaintext_yes | Modified | Ciphey~Ciphey | 81e6a5c14253bd258fa1a51f80fa1e0ea28884d9 | All tests - FIXED | <4>:<add> c = app.Decryptor.basicEncryption.caesar.Caesar(lc)
<del> c = Caesar.Caesar(lc)
| <s>test_caesarcipher_basic
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar"}
-
class TestChi(unittest.TestCase):
def test_caesar_plaintext_yes(self):
<0> """Checks to see if it returns True (it should)
<1> Ok so this returns false becaues caesar only does up to 25, not 26
<2> so plaintext returns false!"""
<3> lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
<4> c = Caesar.Caesar(lc)
<5> result = c.decrypt("What about plaintext?")
<6> self.assertEqual(result['IsPlaintext?'], True)
<7>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.caesar
Caesar(lc)
at: app.Decryptor.basicEncryption.caesar.Caesar
decrypt(message)
at: app.languageCheckerMod.LanguageChecker
LanguageChecker()
at: unittest.case.TestCase
assertEqual(first: Any, second: Any, msg: Any=...) -> None
===========changed ref 0===========
<s>.Tests.test_caesarcipher_basic
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar"}
-
class TestChi(unittest.TestCase):
def test_caesar_no(self):
"""Checks to see if it returns True (it should)"""
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
+ c = app.Decryptor.basicEncryption.caesar.Caesar(lc)
- c = Caesar.Caesar(lc)
result = c.decrypt("o iozad iikwas")
self.assertEqual(result['IsPlaintext?'], False)
===========changed ref 1===========
<s>: app.Tests.test_caesarcipher_basic
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar"}
-
class TestChi(unittest.TestCase):
def test_caesar_yes(self):
"""Checks to see if it returns True (it should)"""
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
+ c = app.Decryptor.basicEncryption.caesar.Caesar(lc)
- c = Caesar.Caesar(lc)
result = c.decrypt("uryyb zl sngure uryyb zl zbgure naq v ernyyl qb yvxr n tbbq ratyvfu oernxsnfg")
self.assertEqual(result['IsPlaintext?'], True)
===========changed ref 2===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics_german(self):
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
result = lc.checkLanguage("hallo keine lieben leute nach")
+ self.assertEqual(result, False)
- self.assertEqual(result, True)
===========changed ref 3===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics_quickbrownfox(self):
"""
This returns true becaue by default chi squared returns true so long as it's less than 10 items it's processed
"""
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("The quick brown fox jumped over the lazy dog")
self.assertEqual(result, True)
===========changed ref 4===========
# module: app.neuralNetworkMod.nn
class NeuralNetwork:
def __init__(self):
self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
self.CATEGORIES = [1, 2, 3, 4, 5, 6]
self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
+
- import mathsHelper
+ self.mh = app.mathsHelper.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
===========changed ref 5===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_addition(self):
"""
Makes sure you can add 2 lanuggae objecs together
"""
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
result = lc.checkLanguage("hello my darling")
+ lc2 = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc2 = app.LanguageChecker()
result = lc.checkLanguage("sad as dasr as s")
temp = lc.getChiScore()
temp2 = lc2.getChiScore()
temp3 = temp + temp2
lc3 = lc + lc2
self.assertAlmostEqual(lc3.getChiScore(), temp3)
|
app.Tests.test_caesarcipher_basic/TestChi.test_caesar_english_comparison | Modified | Ciphey~Ciphey | 81e6a5c14253bd258fa1a51f80fa1e0ea28884d9 | All tests - FIXED | <1>:<add> c = app.Decryptor.basicEncryption.caesar.Caesar(lc)
<del> c = Caesar.Caesar(lc)
| <s>test_caesarcipher_basic
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar"}
-
class TestChi(unittest.TestCase):
def test_caesar_english_comparison(self):
<0> lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
<1> c = Caesar.Caesar(lc)
<2> result = c.decrypt("Pm ol ohk hufaopun jvumpkluaphs av zhf, ol dyval pa pu jpwoly, aoha pz, if zv johunpun aol vykly vm aol slaalyz vm aol hswohila, aoha uva h dvyk jvbsk il thkl vba.")
<3> self.assertEqual(result['IsPlaintext?'], True)
<4>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.caesar
Caesar(lc)
at: app.Decryptor.basicEncryption.caesar.Caesar
decrypt(message)
at: app.languageCheckerMod.LanguageChecker
LanguageChecker()
at: unittest.case.TestCase
assertEqual(first: Any, second: Any, msg: Any=...) -> None
===========changed ref 0===========
<s>.Tests.test_caesarcipher_basic
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar"}
-
class TestChi(unittest.TestCase):
def test_caesar_no(self):
"""Checks to see if it returns True (it should)"""
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
+ c = app.Decryptor.basicEncryption.caesar.Caesar(lc)
- c = Caesar.Caesar(lc)
result = c.decrypt("o iozad iikwas")
self.assertEqual(result['IsPlaintext?'], False)
===========changed ref 1===========
<s>test_caesarcipher_basic
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar"}
-
class TestChi(unittest.TestCase):
def test_caesar_plaintext_yes(self):
"""Checks to see if it returns True (it should)
Ok so this returns false becaues caesar only does up to 25, not 26
so plaintext returns false!"""
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
+ c = app.Decryptor.basicEncryption.caesar.Caesar(lc)
- c = Caesar.Caesar(lc)
result = c.decrypt("What about plaintext?")
self.assertEqual(result['IsPlaintext?'], True)
===========changed ref 2===========
<s>: app.Tests.test_caesarcipher_basic
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar"}
-
class TestChi(unittest.TestCase):
def test_caesar_yes(self):
"""Checks to see if it returns True (it should)"""
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
+ c = app.Decryptor.basicEncryption.caesar.Caesar(lc)
- c = Caesar.Caesar(lc)
result = c.decrypt("uryyb zl sngure uryyb zl zbgure naq v ernyyl qb yvxr n tbbq ratyvfu oernxsnfg")
self.assertEqual(result['IsPlaintext?'], True)
===========changed ref 3===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics_german(self):
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
result = lc.checkLanguage("hallo keine lieben leute nach")
+ self.assertEqual(result, False)
- self.assertEqual(result, True)
===========changed ref 4===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics_quickbrownfox(self):
"""
This returns true becaue by default chi squared returns true so long as it's less than 10 items it's processed
"""
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("The quick brown fox jumped over the lazy dog")
self.assertEqual(result, True)
===========changed ref 5===========
# module: app.neuralNetworkMod.nn
class NeuralNetwork:
def __init__(self):
self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
self.CATEGORIES = [1, 2, 3, 4, 5, 6]
self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
+
- import mathsHelper
+ self.mh = app.mathsHelper.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
===========changed ref 6===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_addition(self):
"""
Makes sure you can add 2 lanuggae objecs together
"""
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
result = lc.checkLanguage("hello my darling")
+ lc2 = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc2 = app.LanguageChecker()
result = lc.checkLanguage("sad as dasr as s")
temp = lc.getChiScore()
temp2 = lc2.getChiScore()
temp3 = temp + temp2
lc3 = lc + lc2
self.assertAlmostEqual(lc3.getChiScore(), temp3)
|
app.Tests.test_caesarcipher_basic/TestChi.test_caesar_english_comparison_yeet | Modified | Ciphey~Ciphey | 81e6a5c14253bd258fa1a51f80fa1e0ea28884d9 | All tests - FIXED | <1>:<add> c = app.Decryptor.basicEncryption.caesar.Caesar(lc)
<del> c = Caesar.Caesar(lc)
| <s>esarcipher_basic
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar"}
-
class TestChi(unittest.TestCase):
def test_caesar_english_comparison_yeet(self):
<0> lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
<1> c = Caesar.Caesar(lc)
<2> result = c.decrypt("Onrs hr mnv knbjdc enq fnnc. Sgzmj xnt zkk enq ozqshbhozshmf, zmc okdzrd bnmshmtd sn unsd enq sgd itcfdldms xnt zfqdd vhsg. Zr nsgdq trdqr gzud onhmsdc nts, sgdqd hr zcchshnmzk hmenqlzshnm sgzs NO gzr kdes nts ne sgdhq nqhfhmzk onrs sgzs sgdx gzud zccdc hm sgdhq bnlldmsr, rn okdzrd qdzc etqsgdq sn fds sgd etkk rbnod ne sgd rhstzshnm.")
<3> self.assertEqual(result['Plaintext'], "Post is now locked for good. Thank you all for participating, and please continue to vote for the judgement you agree with. As other users have pointed out, there is additional information that OP has left out of their original post that they have added in their comments, so please read further to get the full scope of the situation.".lower())
<4>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.caesar
Caesar(lc)
at: app.Decryptor.basicEncryption.caesar.Caesar
decrypt(message)
at: app.languageCheckerMod.LanguageChecker
LanguageChecker()
at: unittest.case.TestCase
assertEqual(first: Any, second: Any, msg: Any=...) -> None
===========changed ref 0===========
<s>.Tests.test_caesarcipher_basic
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar"}
-
class TestChi(unittest.TestCase):
def test_caesar_no(self):
"""Checks to see if it returns True (it should)"""
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
+ c = app.Decryptor.basicEncryption.caesar.Caesar(lc)
- c = Caesar.Caesar(lc)
result = c.decrypt("o iozad iikwas")
self.assertEqual(result['IsPlaintext?'], False)
===========changed ref 1===========
<s>test_caesarcipher_basic
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar"}
-
class TestChi(unittest.TestCase):
def test_caesar_plaintext_yes(self):
"""Checks to see if it returns True (it should)
Ok so this returns false becaues caesar only does up to 25, not 26
so plaintext returns false!"""
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
+ c = app.Decryptor.basicEncryption.caesar.Caesar(lc)
- c = Caesar.Caesar(lc)
result = c.decrypt("What about plaintext?")
self.assertEqual(result['IsPlaintext?'], True)
===========changed ref 2===========
<s>: app.Tests.test_caesarcipher_basic
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar"}
-
class TestChi(unittest.TestCase):
def test_caesar_yes(self):
"""Checks to see if it returns True (it should)"""
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
+ c = app.Decryptor.basicEncryption.caesar.Caesar(lc)
- c = Caesar.Caesar(lc)
result = c.decrypt("uryyb zl sngure uryyb zl zbgure naq v ernyyl qb yvxr n tbbq ratyvfu oernxsnfg")
self.assertEqual(result['IsPlaintext?'], True)
===========changed ref 3===========
<s>test_caesarcipher_basic
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar"}
-
class TestChi(unittest.TestCase):
def test_caesar_english_comparison(self):
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
+ c = app.Decryptor.basicEncryption.caesar.Caesar(lc)
- c = Caesar.Caesar(lc)
result = c.decrypt("Pm ol ohk hufaopun jvumpkluaphs av zhf, ol dyval pa pu jpwoly, aoha pz, if zv johunpun aol vykly vm aol slaalyz vm aol hswohila, aoha uva h dvyk jvbsk il thkl vba.")
self.assertEqual(result['IsPlaintext?'], True)
===========changed ref 4===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics_german(self):
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
result = lc.checkLanguage("hallo keine lieben leute nach")
+ self.assertEqual(result, False)
- self.assertEqual(result, True)
===========changed ref 5===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics_quickbrownfox(self):
"""
This returns true becaue by default chi squared returns true so long as it's less than 10 items it's processed
"""
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("The quick brown fox jumped over the lazy dog")
self.assertEqual(result, True)
===========changed ref 6===========
# module: app.neuralNetworkMod.nn
class NeuralNetwork:
def __init__(self):
self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
self.CATEGORIES = [1, 2, 3, 4, 5, 6]
self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
+
- import mathsHelper
+ self.mh = app.mathsHelper.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
===========changed ref 7===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_integration_addition(self):
"""
Makes sure you can add 2 lanuggae objecs together
"""
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
result = lc.checkLanguage("hello my darling")
+ lc2 = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc2 = app.LanguageChecker()
result = lc.checkLanguage("sad as dasr as s")
temp = lc.getChiScore()
temp2 = lc2.getChiScore()
temp3 = temp + temp2
lc3 = lc + lc2
self.assertAlmostEqual(lc3.getChiScore(), temp3)
|
app.Tests.test_caesarcipher_basic/TestChi.test_caesar_what_is_this | Modified | Ciphey~Ciphey | 81e6a5c14253bd258fa1a51f80fa1e0ea28884d9 | All tests - FIXED | <4>:<add> c = app.Decryptor.basicEncryption.caesar.Caesar(lc)
<del> c = Caesar.Caesar(lc)
| <s>_caesarcipher_basic
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar"}
-
class TestChi(unittest.TestCase):
def test_caesar_what_is_this(self):
<0> """Checks to see if it returns True (it should)
<1> Ok so this returns false becaues caesar only does up to 25, not 26
<2> so plaintext returns false!"""
<3> lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
<4> c = Caesar.Caesar(lc)
<5> result = c.decrypt("?")
<6> self.assertEqual(result['IsPlaintext?'], False)
<7>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.caesar
Caesar(lc)
at: app.Decryptor.basicEncryption.caesar.Caesar
decrypt(message)
at: app.languageCheckerMod.LanguageChecker
LanguageChecker()
at: unittest.case.TestCase
assertEqual(first: Any, second: Any, msg: Any=...) -> None
===========changed ref 0===========
<s>.Tests.test_caesarcipher_basic
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar"}
-
class TestChi(unittest.TestCase):
def test_caesar_no(self):
"""Checks to see if it returns True (it should)"""
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
+ c = app.Decryptor.basicEncryption.caesar.Caesar(lc)
- c = Caesar.Caesar(lc)
result = c.decrypt("o iozad iikwas")
self.assertEqual(result['IsPlaintext?'], False)
===========changed ref 1===========
<s>test_caesarcipher_basic
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar"}
-
class TestChi(unittest.TestCase):
def test_caesar_plaintext_yes(self):
"""Checks to see if it returns True (it should)
Ok so this returns false becaues caesar only does up to 25, not 26
so plaintext returns false!"""
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
+ c = app.Decryptor.basicEncryption.caesar.Caesar(lc)
- c = Caesar.Caesar(lc)
result = c.decrypt("What about plaintext?")
self.assertEqual(result['IsPlaintext?'], True)
===========changed ref 2===========
<s>: app.Tests.test_caesarcipher_basic
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar"}
-
class TestChi(unittest.TestCase):
def test_caesar_yes(self):
"""Checks to see if it returns True (it should)"""
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
+ c = app.Decryptor.basicEncryption.caesar.Caesar(lc)
- c = Caesar.Caesar(lc)
result = c.decrypt("uryyb zl sngure uryyb zl zbgure naq v ernyyl qb yvxr n tbbq ratyvfu oernxsnfg")
self.assertEqual(result['IsPlaintext?'], True)
===========changed ref 3===========
<s>test_caesarcipher_basic
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar"}
-
class TestChi(unittest.TestCase):
def test_caesar_english_comparison(self):
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
+ c = app.Decryptor.basicEncryption.caesar.Caesar(lc)
- c = Caesar.Caesar(lc)
result = c.decrypt("Pm ol ohk hufaopun jvumpkluaphs av zhf, ol dyval pa pu jpwoly, aoha pz, if zv johunpun aol vykly vm aol slaalyz vm aol hswohila, aoha uva h dvyk jvbsk il thkl vba.")
self.assertEqual(result['IsPlaintext?'], True)
===========changed ref 4===========
<s>esarcipher_basic
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
# {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar"}
-
class TestChi(unittest.TestCase):
def test_caesar_english_comparison_yeet(self):
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
+ c = app.Decryptor.basicEncryption.caesar.Caesar(lc)
- c = Caesar.Caesar(lc)
result = c.decrypt("Onrs hr mnv knbjdc enq fnnc. Sgzmj xnt zkk enq ozqshbhozshmf, zmc okdzrd bnmshmtd sn unsd enq sgd itcfdldms xnt zfqdd vhsg. Zr nsgdq trdqr gzud onhmsdc nts, sgdqd hr zcchshnmzk hmenqlzshnm sgzs NO gzr kdes nts ne sgdhq nqhfhmzk onrs sgzs sgdx gzud zccdc hm sgdhq bnlldmsr, rn okdzrd qdzc etqsgdq sn fds sgd etkk rbnod ne sgd rhstzshnm.")
self.assertEqual(result['Plaintext'], "Post is now locked for good. Thank you all for participating, and please continue to vote for the judgement you agree with. As other users have pointed out, there is additional information that OP has left out of their original post that they have added in their comments, so please read further to get the full scope of the situation.".lower())
===========changed ref 5===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics_german(self):
lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
result = lc.checkLanguage("hallo keine lieben leute nach")
+ self.assertEqual(result, False)
- self.assertEqual(result, True)
===========changed ref 6===========
# module: app.Tests.test_integration_languagechecker
# python3 -m unittest Tests.testchi_squared
# python -m unittest discover -s tests
# python3 -m unittest discover -s Tests -p test*.py
class TestLanguageChecker(unittest.TestCase):
def test_basics_quickbrownfox(self):
"""
This returns true becaue by default chi squared returns true so long as it's less than 10 items it's processed
"""
+ lc = app.languageCheckerMod.LanguageChecker.LanguageChecker()
- lc = LanguageChecker()
result = lc.checkLanguage("The quick brown fox jumped over the lazy dog")
self.assertEqual(result, True)
|
app.Decryptor.basicEncryption.viginere/Viginere.attemptHackWithKeyLength | Modified | Ciphey~Ciphey | 0dc5a5c839cba1e8cb58ad7da8b9148aa90ce0b4 | broken | <15>:<add> keyAndFreqMatchTuple = (possibleKey, Decryptor.basicEncryption.freqAnalysis.englishFreqMatchScore(decryptedText))
<del> keyAndFreqMatchTuple = (possibleKey, app.Decryptor.basicEncryption.freqAnalysis.englishFreqMatchScore(decryptedText))
| # module: app.Decryptor.basicEncryption.viginere
class Viginere:
def attemptHackWithKeyLength(self, ciphertext, mostLikelyKeyLength):
<0> # Determine the most likely letters for each letter in the key:
<1> ciphertextUp = ciphertext.upper()
<2> # allFreqScores is a list of mostLikelyKeyLength number of lists.
<3> # These inner lists are the freqScores lists.
<4> allFreqScores = []
<5> for nth in range(1, mostLikelyKeyLength + 1):
<6> nthLetters = self.getNthSubkeysLetters(nth, mostLikelyKeyLength, ciphertextUp)
<7>
<8> # freqScores is a list of tuples like:
<9> # [(<letter>, <Eng. Freq. match score>), ... ]
<10> # List is sorted by match score. Higher score means better match.
<11> # See the englishFreqMatchScore() comments in freqAnalysis.py.
<12> freqScores = []
<13> for possibleKey in self.LETTERS:
<14> decryptedText = self.decryptMessage(possibleKey, nthLetters)
<15> keyAndFreqMatchTuple = (possibleKey, app.Decryptor.basicEncryption.freqAnalysis.englishFreqMatchScore(decryptedText))
<16> freqScores.append(keyAndFreqMatchTuple)
<17> # Sort by match score:
<18> freqScores.sort(key=self.getItemAtIndexOne, reverse=True)
<19>
<20> allFreqScores.append(freqScores[:self.NUM_MOST_FREQ_LETTERS])
<21>
<22> if not self.SILENT_MODE:
<23> for i in range(len(allFreqScores)):
<24> # Use i + 1 so the first letter is not called the "0th" letter:
<25> print('Possible letters for letter %s of the key: ' % (i + 1), end='')
<26> for freqScore in allFreqScores[i]:
<27> print('%s ' % freqScore[0], end='')
</s> | ===========below chunk 0===========
# module: app.Decryptor.basicEncryption.viginere
class Viginere:
def attemptHackWithKeyLength(self, ciphertext, mostLikelyKeyLength):
# offset: 1
# Try every combination of the most likely letters for each position
# in the key:
for indexes in itertools.product(range(self.NUM_MOST_FREQ_LETTERS), repeat=mostLikelyKeyLength):
# Create a possible key from the letters in allFreqScores:
possibleKey = ''
for i in range(mostLikelyKeyLength):
possibleKey += allFreqScores[i][indexes[i]][0]
if not self.SILENT_MODE:
print('Attempting with key: %s' % (possibleKey))
decryptedText = self.decryptMessage(possibleKey, ciphertextUp)
if self.lc.checkLanguage(decryptedText):
# Set the hacked ciphertext to the original casing:
origCase = []
for i in range(len(ciphertext)):
if ciphertext[i].isupper():
origCase.append(decryptedText[i].upper())
else:
origCase.append(decryptedText[i].lower())
decryptedText = ''.join(origCase)
# Check with user to see if the key has been found:
return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": decryptedText, "Cipher": "Viginere", "Extra Information": f"The key used is {possibleKey}"}
# No English-looking decryption found, so return None:
return None
===========unchanged ref 0===========
at: Decryptor.basicEncryption.freqAnalysis
englishFreqMatchScore(message)
at: app.Decryptor.basicEncryption.viginere.Viginere
getItemAtIndexOne(items)
getNthSubkeysLetters(nth, keyLength, message)
decryptMessage(key, message)
at: app.Decryptor.basicEncryption.viginere.Viginere.__init__
self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
self.SILENT_MODE = True # If set to True, program doesn't print anything.
self.NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey.
self.lc = lc
===========unchanged ref 1===========
at: itertools
product(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], iter5: Iterable[_T5], iter6: Iterable[_T6]) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5, _T6]]
product(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]
product(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4]) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]
product(iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]
product(*iterables: Iterable[_T1], repeat: int) -> Iterator[Tuple[_T1, ...]]
product(iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]
product(*iterables: Iterable[Any], repeat: int=...) -> Iterator[Tuple[Any, ...]]
product(iter1: Iterable[Any], iter2: Iterable[Any], iter3: Iterable[Any], iter4: Iterable[Any], iter5: Iterable[Any], iter6: Iterable[Any], iter7: Iterable[Any], *iterables: Iterable[Any]) -> Iterator[Tuple[Any, ...]]
product(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], iter5: Iterable[_T5]) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]
|
app.Decryptor.basicEncryption.basic_parent/BasicParent.__init__ | Modified | Ciphey~Ciphey | 0dc5a5c839cba1e8cb58ad7da8b9148aa90ce0b4 | broken | <1>:<add> self.caesar = Decryptor.basicEncryption.caesar.Caesar(self.lc)
<del> self.caesar = app.Decryptor.basicEncryption.caesar.Caesar(self.lc)
<2>:<add> self.reverse = Decryptor.basicEncryption.reverse.Reverse(self.lc)
<del> self.reverse = app.Decryptor.basicEncryption.reverse.Reverse(self.lc)
<3>:<add> self.viginere = Decryptor.basicEncryption.viginere.Viginere(self.lc)
<del> self.viginere = app.Decryptor.basicEncryption.viginere.Viginere(self.lc)
<4>:<add> self.pig = Decryptor.basicEncryption.pigLatin.PigLatin(self.lc)
<del> self.pig = app.Decryptor.basicEncryption.pigLatin.PigLatin(self.lc)
| # module: app.Decryptor.basicEncryption.basic_parent
class BasicParent:
def __init__(self, lc):
<0> self.lc = lc
<1> self.caesar = app.Decryptor.basicEncryption.caesar.Caesar(self.lc)
<2> self.reverse = app.Decryptor.basicEncryption.reverse.Reverse(self.lc)
<3> self.viginere = app.Decryptor.basicEncryption.viginere.Viginere(self.lc)
<4> self.pig = app.Decryptor.basicEncryption.pigLatin.PigLatin(self.lc)
<5> # self.trans = Transposition(self.lc)
<6>
<7> self.list_of_objects = [self.caesar, self.reverse, self.pig]
<8>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.basic_parent.BasicParent.decrypt
self.lc = self.lc + answer["lc"]
at: app.Decryptor.basicEncryption.caesar
Caesar(lc)
at: app.Decryptor.basicEncryption.pigLatin
PigLatin(lc)
at: app.Decryptor.basicEncryption.reverse
Reverse(lc)
at: app.Decryptor.basicEncryption.viginere
Viginere(lc)
===========changed ref 0===========
# module: app.Decryptor.basicEncryption.viginere
class Viginere:
def attemptHackWithKeyLength(self, ciphertext, mostLikelyKeyLength):
# Determine the most likely letters for each letter in the key:
ciphertextUp = ciphertext.upper()
# allFreqScores is a list of mostLikelyKeyLength number of lists.
# These inner lists are the freqScores lists.
allFreqScores = []
for nth in range(1, mostLikelyKeyLength + 1):
nthLetters = self.getNthSubkeysLetters(nth, mostLikelyKeyLength, ciphertextUp)
# freqScores is a list of tuples like:
# [(<letter>, <Eng. Freq. match score>), ... ]
# List is sorted by match score. Higher score means better match.
# See the englishFreqMatchScore() comments in freqAnalysis.py.
freqScores = []
for possibleKey in self.LETTERS:
decryptedText = self.decryptMessage(possibleKey, nthLetters)
+ keyAndFreqMatchTuple = (possibleKey, Decryptor.basicEncryption.freqAnalysis.englishFreqMatchScore(decryptedText))
- keyAndFreqMatchTuple = (possibleKey, app.Decryptor.basicEncryption.freqAnalysis.englishFreqMatchScore(decryptedText))
freqScores.append(keyAndFreqMatchTuple)
# Sort by match score:
freqScores.sort(key=self.getItemAtIndexOne, reverse=True)
allFreqScores.append(freqScores[:self.NUM_MOST_FREQ_LETTERS])
if not self.SILENT_MODE:
for i in range(len(allFreqScores)):
# Use i + 1 so the first letter is not called the "0th" letter:
print('Possible letters for letter %s of the key: ' % (i + 1), end='')
for freqScore in allFreqScores[i]:
print('%s ' % freqScore[0</s>
===========changed ref 1===========
# module: app.Decryptor.basicEncryption.viginere
class Viginere:
def attemptHackWithKeyLength(self, ciphertext, mostLikelyKeyLength):
# offset: 1
<s> 1), end='')
for freqScore in allFreqScores[i]:
print('%s ' % freqScore[0], end='')
print() # Print a newline.
# Try every combination of the most likely letters for each position
# in the key:
for indexes in itertools.product(range(self.NUM_MOST_FREQ_LETTERS), repeat=mostLikelyKeyLength):
# Create a possible key from the letters in allFreqScores:
possibleKey = ''
for i in range(mostLikelyKeyLength):
possibleKey += allFreqScores[i][indexes[i]][0]
if not self.SILENT_MODE:
print('Attempting with key: %s' % (possibleKey))
decryptedText = self.decryptMessage(possibleKey, ciphertextUp)
if self.lc.checkLanguage(decryptedText):
# Set the hacked ciphertext to the original casing:
origCase = []
for i in range(len(ciphertext)):
if ciphertext[i].isupper():
origCase.append(decryptedText[i].upper())
else:
origCase.append(decryptedText[i].lower())
decryptedText = ''.join(origCase)
# Check with user to see if the key has been found:
return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": decryptedText, "Cipher": "Viginere", "Extra Information": f"The key used is {possibleKey}"}
# No English-looking decryption found, so return None:
return None
|
app.Decryptor.Encoding.morsecode/MorseCode.__init__ | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <2>:<add> self.MORSE_CODE_DICT = {
<add> "A": ".-",
<add> "B": "-...",
<add> "C": "-.-.",
<add> "D": "-..",
<add> "E": ".",
<add> "F": "..-.",
<add> "G": "--.",
<add> "H": "....",
<add> "I": "..",
<add> "J": ".---",
<add> "K": "-.-",
<add> "L": ".-..",
<add> "M": "--",
<add> "N": "-.",
<add> "O": "---",
<add> "P": ".--.",
<add> "Q": "--.-",
<add> "R": ".-.",
<add> "S": "...",
<add> "T": "-",
<add> "U": "..-",
<add> "V": "...-",
<add> "W": ".--",
<add> | # module: app.Decryptor.Encoding.morsecode
class MorseCode:
def __init__(self, lc):
<0> self.lc = lc
<1> self.ALLOWED = [".", "-", " ", "/", "\n"]
<2> self.MORSE_CODE_DICT = {'A': '.-', 'B': '-...',
<3> 'C': '-.-.', 'D': '-..', 'E': '.',
<4> 'F': '..-.', 'G': '--.', 'H': '....',
<5> 'I': '..', 'J': '.---', 'K': '-.-',
<6> 'L': '.-..', 'M': '--', 'N': '-.',
<7> 'O': '---', 'P': '.--.', 'Q': '--.-',
<8> 'R': '.-.', 'S': '...', 'T': '-',
<9> 'U': '..-', 'V': '...-', 'W': '.--',
<10> 'X': '-..-', 'Y': '-.--', 'Z': '--..',
<11> '?': '..--..', '.': '.-.-.-', ' ': '/',
<12> '0': '-----', '1': '.----', '2': '..---',
<13> '3': '...--', '4': '....-', '5': '.....',
<14> '6': '-....', '7': '--...', '8': '---..',
<15> '9': '----.', " ": "\n"
<16> }
<17>
<18> self.MORSE_CODE_DICT_INV = {v: k for k, v in self.MORSE_CODE_DICT.items()}
<19>
| ===========changed ref 0===========
+ # module: app.test_dictionary
+
+
===========changed ref 1===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 2===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 3===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 4===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 6===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_perfect(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "Archimedes famously said: “Give me a lever long enough and a fulcrum on which to place it, and I shall move the world.” But what we are talking about here is not physical leverage. It is the leverage of ideas. When you create content, people can access your knowledge without taking your time. You no longer need to sell knowledge by the hour. Your ideas are the most valuable currency in a knowledge-driven economy. Just as an investment account allows your money to grow day and night without your involvement, content does the same with your ideas. Until recently, the average person wasn’t able to publish and distribute their ideas at a reasonable cost. But on the Internet, anybody, in any corner of the world, in any time zone, can access your best thinking. 24 hours a day. 7 days a week. 365 days a year. When you publish ideas, you create your own “Serendipity Vehicle” – a magnet for ideas and people and opportunities from potentially every corner of the globe. If your ideas resonate with people, people will discover you and bring you unexpected opportunities. They’ll open doors you never knew existed.",
+ "English",
+ )
+ self.assertEqual(result, True)
+ |
app.Decryptor.Encoding.morsecode/MorseCode.decrypt | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <1>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": False,
<add> "Plaintext": None,
<add> "Cipher": "Morse Code",
<add> "Extra Information": None,
<add> }
<del> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Morse Code", "Extra Information": None}
<5>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": False,
<add> "Plaintext": None,
<add> "Cipher": "Morse Code",
<add> "Extra Information": None,
<add> }
<del> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Morse Code", "Extra Information": None}
<7>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": True,
<add> "Plaintext": result,
<add> "Cipher": "Morse Code",
<add> "Extra Information": None,
<add> }
<del>
<8>:<del> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Morse Code", "Extra Information": None}
| # module: app.Decryptor.Encoding.morsecode
class MorseCode:
def decrypt(self, text):
<0> if not self.checkIfMorse(text):
<1> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Morse Code", "Extra Information": None}
<2> try:
<3> result = self.unmorse_it(text)
<4> except TypeError as e:
<5> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Morse Code", "Extra Information": None}
<6>
<7>
<8> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Morse Code", "Extra Information": None}
<9>
| ===========changed ref 0===========
# module: app.Decryptor.Encoding.morsecode
class MorseCode:
def __init__(self, lc):
self.lc = lc
self.ALLOWED = [".", "-", " ", "/", "\n"]
+ self.MORSE_CODE_DICT = {
+ "A": ".-",
+ "B": "-...",
+ "C": "-.-.",
+ "D": "-..",
+ "E": ".",
+ "F": "..-.",
+ "G": "--.",
+ "H": "....",
+ "I": "..",
+ "J": ".---",
+ "K": "-.-",
+ "L": ".-..",
+ "M": "--",
+ "N": "-.",
+ "O": "---",
+ "P": ".--.",
+ "Q": "--.-",
+ "R": ".-.",
+ "S": "...",
+ "T": "-",
+ "U": "..-",
+ "V": "...-",
+ "W": ".--",
+ "X": "-..-",
+ "Y": "-.--",
+ "Z": "--..",
+ "?": "..--..",
+ ".": ".-.-.-",
+ " ": "/",
+ "0": "-----",
+ "1": ".----",
+ "2": "..---",
+ "3": "...--",
+ "4": "....-",
+ "5": ".....",
+ "6": "-....",
+ "7": "--...",
+ "8": "---..",
+ "9": "----.",
+ " ": "\n",
- self.MORSE_CODE_DICT = {'A': '.-', 'B': '-...',</s>
===========changed ref 1===========
# module: app.Decryptor.Encoding.morsecode
class MorseCode:
def __init__(self, lc):
# offset: 1
<s> ": "\n",
- self.MORSE_CODE_DICT = {'A': '.-', 'B': '-...',
- 'C': '-.-.', 'D': '-..', 'E': '.',
- 'F': '..-.', 'G': '--.', 'H': '....',
- 'I': '..', 'J': '.---', 'K': '-.-',
- 'L': '.-..', 'M': '--', 'N': '-.',
- 'O': '---', 'P': '.--.', 'Q': '--.-',
- 'R': '.-.', 'S': '...', 'T': '-',
- 'U': '..-', 'V': '...-', 'W': '.--',
- 'X': '-..-', 'Y': '-.--', 'Z': '--..',
- '?': '..--..', '.': '.-.-.-', ' ': '/',
- '0': '-----', '1': '.----', '2': '..---',
- '3': '...--', '4': '....-', '5': '.....',
- '6': '-....', '7': '--...', '8': '---..',
- '9': '----.', " ": "\n"
}
self.MORSE_CODE_DICT_INV = {v: k for k, v in self.MORSE_CODE_DICT.items()}
===========changed ref 2===========
+ # module: app.test_dictionary
+
+
===========changed ref 3===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 4===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 6===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 7===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 8===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_perfect(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "Archimedes famously said: “Give me a lever long enough and a fulcrum on which to place it, and I shall move the world.” But what we are talking about here is not physical leverage. It is the leverage of ideas. When you create content, people can access your knowledge without taking your time. You no longer need to sell knowledge by the hour. Your ideas are the most valuable currency in a knowledge-driven economy. Just as an investment account allows your money to grow day and night without your involvement, content does the same with your ideas. Until recently, the average person wasn’t able to publish and distribute their ideas at a reasonable cost. But on the Internet, anybody, in any corner of the world, in any time zone, can access your best thinking. 24 hours a day. 7 days a week. 365 days a year. When you publish ideas, you create your own “Serendipity Vehicle” – a magnet for ideas and people and opportunities from potentially every corner of the globe. If your ideas resonate with people, people will discover you and bring you unexpected opportunities. They’ll open doors you never knew existed.",
+ "English",
+ )
+ self.assertEqual(result, True)
+ |
app.Decryptor.basicEncryption.affine/Affine.decrypt | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <1>:<add> for key in range(len(self.SYMBOLS) ** 2):
<del> for key in range(len(self.SYMBOLS) ** 2):
<8>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": True,
<add> "Plaintext": decryptedText,
<add> "Cipher": "Affine",
<add> "Extra Information": f"The key used is {key}",
<add> }
<del> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": decryptedText, "Cipher": "Affine", "Extra Information": f"The key used is {key}"}
<10>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": False,
<add> "Plaintext": None,
<add> "Cipher": "Affine",
<add> "Extra Information": None,
<add> }
<del> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Affine", "Extra Information": None}
| # module: app.Decryptor.basicEncryption.affine
+
+
class Affine:
+
-
def decrypt(self, text):
<0> # Brute-force by looping through every possible key
<1> for key in range(len(self.SYMBOLS) ** 2):
<2> keyA = self.getKeyParts(key)[0]
<3> if self.mh.gcd(keyA, len(self.SYMBOLS)) != 1:
<4> continue
<5> decryptedText = self.decryptMessage(key, message)
<6>
<7> if self.lc.checkLanguage(decryptedText):
<8> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": decryptedText, "Cipher": "Affine", "Extra Information": f"The key used is {key}"}
<9>
<10> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Affine", "Extra Information": None}
<11>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.affine.Affine
getKeyParts(self, key)
getKeyParts(key)
decryptMessage(key, message)
at: mathsHelper
mathsHelper()
at: mathsHelper.mathsHelper
gcd(a, b)
===========changed ref 0===========
+ # module: app.test_dictionary
+
+
===========changed ref 1===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 2===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 3===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 4===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 6===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_perfect(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "Archimedes famously said: “Give me a lever long enough and a fulcrum on which to place it, and I shall move the world.” But what we are talking about here is not physical leverage. It is the leverage of ideas. When you create content, people can access your knowledge without taking your time. You no longer need to sell knowledge by the hour. Your ideas are the most valuable currency in a knowledge-driven economy. Just as an investment account allows your money to grow day and night without your involvement, content does the same with your ideas. Until recently, the average person wasn’t able to publish and distribute their ideas at a reasonable cost. But on the Internet, anybody, in any corner of the world, in any time zone, can access your best thinking. 24 hours a day. 7 days a week. 365 days a year. When you publish ideas, you create your own “Serendipity Vehicle” – a magnet for ideas and people and opportunities from potentially every corner of the globe. If your ideas resonate with people, people will discover you and bring you unexpected opportunities. They’ll open doors you never knew existed.",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 7===========
# module: app.Decryptor.Encoding.morsecode
class MorseCode:
def decrypt(self, text):
if not self.checkIfMorse(text):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": "Morse Code",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Morse Code", "Extra Information": None}
try:
result = self.unmorse_it(text)
except TypeError as e:
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": "Morse Code",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Morse Code", "Extra Information": None}
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": result,
+ "Cipher": "Morse Code",
+ "Extra Information": None,
+ }
-
- return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Morse Code", "Extra Information": None}
===========changed ref 8===========
# module: app.Decryptor.Encoding.morsecode
class MorseCode:
def __init__(self, lc):
self.lc = lc
self.ALLOWED = [".", "-", " ", "/", "\n"]
+ self.MORSE_CODE_DICT = {
+ "A": ".-",
+ "B": "-...",
+ "C": "-.-.",
+ "D": "-..",
+ "E": ".",
+ "F": "..-.",
+ "G": "--.",
+ "H": "....",
+ "I": "..",
+ "J": ".---",
+ "K": "-.-",
+ "L": ".-..",
+ "M": "--",
+ "N": "-.",
+ "O": "---",
+ "P": ".--.",
+ "Q": "--.-",
+ "R": ".-.",
+ "S": "...",
+ "T": "-",
+ "U": "..-",
+ "V": "...-",
+ "W": ".--",
+ "X": "-..-",
+ "Y": "-.--",
+ "Z": "--..",
+ "?": "..--..",
+ ".": ".-.-.-",
+ " ": "/",
+ "0": "-----",
+ "1": ".----",
+ "2": "..---",
+ "3": "...--",
+ "4": "....-",
+ "5": ".....",
+ "6": "-....",
+ "7": "--...",
+ "8": "---..",
+ "9": "----.",
+ " ": "\n",
- self.MORSE_CODE_DICT = {'A': '.-', 'B': '-...',</s> |
app.Decryptor.basicEncryption.affine/Affine.decryptMessage | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <1>:<add> self.checkKeys(keyA, keyB, "decrypt")
<del> self.checkKeys(keyA, keyB, 'decrypt')
<2>:<add> plaintext = ""
<del> plaintext = ''
<4>:<add>
<del>
<9>:<add> plaintext += self.SYMBOLS[
<add> (symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)
<del> plaintext += self.SYMBOLS[(symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)]
<10>:<add> ]
<11>:<add> plaintext += symbol # Append the symbol without decrypting.
<del> plaintext += symbol # Append the symbol without decrypting.
<12>:<add> return plaintext
<del> return plaintext
| # module: app.Decryptor.basicEncryption.affine
+
+
class Affine:
+
def decryptMessage(self, key, message):
<0> keyA, keyB = getKeyParts(key)
<1> self.checkKeys(keyA, keyB, 'decrypt')
<2> plaintext = ''
<3> modInverseOfKeyA = self.mh.findModInverse(keyA, len(SYMBOLS))
<4>
<5> for symbol in message:
<6> if symbol in self.SYMBOLS:
<7> # Decrypt the symbol:
<8> symbolIndex = self.SYMBOLS.find(symbol)
<9> plaintext += self.SYMBOLS[(symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)]
<10> else:
<11> plaintext += symbol # Append the symbol without decrypting.
<12> return plaintext
<13>
| ===========changed ref 0===========
# module: app.Decryptor.basicEncryption.affine
+
+
class Affine:
+
-
def decrypt(self, text):
# Brute-force by looping through every possible key
+ for key in range(len(self.SYMBOLS) ** 2):
- for key in range(len(self.SYMBOLS) ** 2):
keyA = self.getKeyParts(key)[0]
if self.mh.gcd(keyA, len(self.SYMBOLS)) != 1:
continue
decryptedText = self.decryptMessage(key, message)
if self.lc.checkLanguage(decryptedText):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": decryptedText,
+ "Cipher": "Affine",
+ "Extra Information": f"The key used is {key}",
+ }
- return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": decryptedText, "Cipher": "Affine", "Extra Information": f"The key used is {key}"}
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": "Affine",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Affine", "Extra Information": None}
===========changed ref 1===========
+ # module: app.test_dictionary
+
+
===========changed ref 2===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 3===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 4===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 6===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 7===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_perfect(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "Archimedes famously said: “Give me a lever long enough and a fulcrum on which to place it, and I shall move the world.” But what we are talking about here is not physical leverage. It is the leverage of ideas. When you create content, people can access your knowledge without taking your time. You no longer need to sell knowledge by the hour. Your ideas are the most valuable currency in a knowledge-driven economy. Just as an investment account allows your money to grow day and night without your involvement, content does the same with your ideas. Until recently, the average person wasn’t able to publish and distribute their ideas at a reasonable cost. But on the Internet, anybody, in any corner of the world, in any time zone, can access your best thinking. 24 hours a day. 7 days a week. 365 days a year. When you publish ideas, you create your own “Serendipity Vehicle” – a magnet for ideas and people and opportunities from potentially every corner of the globe. If your ideas resonate with people, people will discover you and bring you unexpected opportunities. They’ll open doors you never knew existed.",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 8===========
# module: app.Decryptor.Encoding.morsecode
class MorseCode:
def decrypt(self, text):
if not self.checkIfMorse(text):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": "Morse Code",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Morse Code", "Extra Information": None}
try:
result = self.unmorse_it(text)
except TypeError as e:
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": "Morse Code",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Morse Code", "Extra Information": None}
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": result,
+ "Cipher": "Morse Code",
+ "Extra Information": None,
+ }
-
- return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Morse Code", "Extra Information": None}
|
app.neuralNetworkMod.nn/NeuralNetwork.__init__ | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <2>:<add> script_dir = os.path.dirname(__file__)
<add> file_path = os.path.join(script_dir, "NeuralNetworkModel.model")
<add> self.MODEL = load_model(file_path)
<add>
<del> self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
<3>:<del>
| # module: app.neuralNetworkMod.nn
class NeuralNetwork:
+
def __init__(self):
<0> self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
<1> self.CATEGORIES = [1, 2, 3, 4, 5, 6]
<2> self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
<3>
<4> self.mh = app.mathsHelper.mathsHelper()
<5>
| ===========changed ref 0===========
+ # module: app.test_dictionary
+
+
===========changed ref 1===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 2===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 3===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 4===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 6===========
# module: app.Decryptor.basicEncryption.affine
+
+
class Affine:
+
def decryptMessage(self, key, message):
keyA, keyB = getKeyParts(key)
+ self.checkKeys(keyA, keyB, "decrypt")
- self.checkKeys(keyA, keyB, 'decrypt')
+ plaintext = ""
- plaintext = ''
modInverseOfKeyA = self.mh.findModInverse(keyA, len(SYMBOLS))
+
-
for symbol in message:
if symbol in self.SYMBOLS:
# Decrypt the symbol:
symbolIndex = self.SYMBOLS.find(symbol)
+ plaintext += self.SYMBOLS[
+ (symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)
- plaintext += self.SYMBOLS[(symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)]
+ ]
else:
+ plaintext += symbol # Append the symbol without decrypting.
- plaintext += symbol # Append the symbol without decrypting.
+ return plaintext
- return plaintext
===========changed ref 7===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_perfect(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "Archimedes famously said: “Give me a lever long enough and a fulcrum on which to place it, and I shall move the world.” But what we are talking about here is not physical leverage. It is the leverage of ideas. When you create content, people can access your knowledge without taking your time. You no longer need to sell knowledge by the hour. Your ideas are the most valuable currency in a knowledge-driven economy. Just as an investment account allows your money to grow day and night without your involvement, content does the same with your ideas. Until recently, the average person wasn’t able to publish and distribute their ideas at a reasonable cost. But on the Internet, anybody, in any corner of the world, in any time zone, can access your best thinking. 24 hours a day. 7 days a week. 365 days a year. When you publish ideas, you create your own “Serendipity Vehicle” – a magnet for ideas and people and opportunities from potentially every corner of the globe. If your ideas resonate with people, people will discover you and bring you unexpected opportunities. They’ll open doors you never knew existed.",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 8===========
# module: app.Decryptor.basicEncryption.affine
+
+
class Affine:
+
-
def decrypt(self, text):
# Brute-force by looping through every possible key
+ for key in range(len(self.SYMBOLS) ** 2):
- for key in range(len(self.SYMBOLS) ** 2):
keyA = self.getKeyParts(key)[0]
if self.mh.gcd(keyA, len(self.SYMBOLS)) != 1:
continue
decryptedText = self.decryptMessage(key, message)
if self.lc.checkLanguage(decryptedText):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": decryptedText,
+ "Cipher": "Affine",
+ "Extra Information": f"The key used is {key}",
+ }
- return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": decryptedText, "Cipher": "Affine", "Extra Information": f"The key used is {key}"}
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": "Affine",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Affine", "Extra Information": None}
===========changed ref 9===========
# module: app.Decryptor.Encoding.morsecode
class MorseCode:
def decrypt(self, text):
if not self.checkIfMorse(text):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": "Morse Code",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Morse Code", "Extra Information": None}
try:
result = self.unmorse_it(text)
except TypeError as e:
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": "Morse Code",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Morse Code", "Extra Information": None}
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": result,
+ "Cipher": "Morse Code",
+ "Extra Information": None,
+ }
-
- return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Morse Code", "Extra Information": None}
|
app.neuralNetworkMod.nn/NeuralNetwork.getLetterFreq | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <1>:<add> letterFreq = {
<add> "a": 0,
<add> "b": 0,
<add> "c": 0,
<add> "d": 0,
<add> "e": 0,
<add> "f": 0,
<add> "g": 0,
<add> "h": 0,
<add> "i": 0,
<add> "j": 0,
<add> "k": 0,
<add> "l": 0,
<add> "m": 0,
<add> "n": 0,
<add> "o": 0,
<add> "p": 0,
<add> "q": 0,
<add> "r": 0,
<add> "s": 0,
<add> "t": 0,
<add> "u": 0,
<add> "v": 0,
<add> "w": 0,
<add> "x": 0,
<add> "y": 0,
<add> "z": 0,
<add> }
<del> letterFreq = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0, 'f': 0, 'g': 0, 'h': 0, 'i': 0, 'j': 0, 'k': 0, 'l': 0, 'm': 0, 'n': 0, 'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0, 't': 0, 'u': 0, 'v': 0, 'w': 0, 'x': 0, 'y': 0, 'z': 0}
<5>:<add> | # module: app.neuralNetworkMod.nn
class NeuralNetwork:
+
def getLetterFreq(self, text):
<0> # This part creates a letter frequency of the text
<1> letterFreq = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0, 'f': 0, 'g': 0, 'h': 0, 'i': 0, 'j': 0, 'k': 0, 'l': 0, 'm': 0, 'n': 0, 'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0, 't': 0, 'u': 0, 'v': 0, 'w': 0, 'x': 0, 'y': 0, 'z': 0}
<2>
<3> for letter in text.lower():
<4> if letter in letterFreq:
<5> letterFreq[letter] +=1
<6> else:
<7> # if letter is not puncuation, but it is still ascii
<8> # it's probably a different language so add it to the dict
<9> if letter not in punctuation and self.mh.isAscii(letter):
<10> letterFreq[letter] = 1
<11> return list(letterFreq.values())
<12>
| ===========unchanged ref 0===========
at: app.neuralNetworkMod.nn.NeuralNetwork
formatData(text)
editData(data)
at: numpy.core._multiarray_umath
asarray(a, dtype=None, order=None, *, like=None, /)
===========changed ref 0===========
# module: app.neuralNetworkMod.nn
class NeuralNetwork:
+
def __init__(self):
self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
self.CATEGORIES = [1, 2, 3, 4, 5, 6]
+ script_dir = os.path.dirname(__file__)
+ file_path = os.path.join(script_dir, "NeuralNetworkModel.model")
+ self.MODEL = load_model(file_path)
+
- self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
-
self.mh = app.mathsHelper.mathsHelper()
===========changed ref 1===========
+ # module: app.test_dictionary
+
+
===========changed ref 2===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 3===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 4===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 6===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 7===========
# module: app.Decryptor.basicEncryption.affine
+
+
class Affine:
+
def decryptMessage(self, key, message):
keyA, keyB = getKeyParts(key)
+ self.checkKeys(keyA, keyB, "decrypt")
- self.checkKeys(keyA, keyB, 'decrypt')
+ plaintext = ""
- plaintext = ''
modInverseOfKeyA = self.mh.findModInverse(keyA, len(SYMBOLS))
+
-
for symbol in message:
if symbol in self.SYMBOLS:
# Decrypt the symbol:
symbolIndex = self.SYMBOLS.find(symbol)
+ plaintext += self.SYMBOLS[
+ (symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)
- plaintext += self.SYMBOLS[(symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)]
+ ]
else:
+ plaintext += symbol # Append the symbol without decrypting.
- plaintext += symbol # Append the symbol without decrypting.
+ return plaintext
- return plaintext
===========changed ref 8===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_perfect(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "Archimedes famously said: “Give me a lever long enough and a fulcrum on which to place it, and I shall move the world.” But what we are talking about here is not physical leverage. It is the leverage of ideas. When you create content, people can access your knowledge without taking your time. You no longer need to sell knowledge by the hour. Your ideas are the most valuable currency in a knowledge-driven economy. Just as an investment account allows your money to grow day and night without your involvement, content does the same with your ideas. Until recently, the average person wasn’t able to publish and distribute their ideas at a reasonable cost. But on the Internet, anybody, in any corner of the world, in any time zone, can access your best thinking. 24 hours a day. 7 days a week. 365 days a year. When you publish ideas, you create your own “Serendipity Vehicle” – a magnet for ideas and people and opportunities from potentially every corner of the globe. If your ideas resonate with people, people will discover you and bring you unexpected opportunities. They’ll open doors you never knew existed.",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 9===========
# module: app.Decryptor.basicEncryption.affine
+
+
class Affine:
+
-
def decrypt(self, text):
# Brute-force by looping through every possible key
+ for key in range(len(self.SYMBOLS) ** 2):
- for key in range(len(self.SYMBOLS) ** 2):
keyA = self.getKeyParts(key)[0]
if self.mh.gcd(keyA, len(self.SYMBOLS)) != 1:
continue
decryptedText = self.decryptMessage(key, message)
if self.lc.checkLanguage(decryptedText):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": decryptedText,
+ "Cipher": "Affine",
+ "Extra Information": f"The key used is {key}",
+ }
- return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": decryptedText, "Cipher": "Affine", "Extra Information": f"The key used is {key}"}
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": "Affine",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Affine", "Extra Information": None}
|
app.Decryptor.Encoding.hexadecimal/Hexadecimal.decrypt | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <3>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": False,
<add> "Plaintext": None,
<add> "Cipher": None,
<add> "Extra Information": None,
<del> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
<4>:<add> }
<del>
<5>:<add>
<6>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": True,
<add> "Plaintext": result,
<add> "Cipher": "Ascii to Hexadecimal encoded",
<add> "Extra Information": None,
<add> }
<del> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Ascii to Hexadecimal encoded", "Extra Information": None}
| # module: app.Decryptor.Encoding.hexadecimal
class Hexadecimal:
+
def decrypt(self, text):
<0> try:
<1> result = bytearray.fromhex(text).decode()
<2> except ValueError as e:
<3> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
<4>
<5> if self.lc.checkLanguage(result):
<6> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Ascii to Hexadecimal encoded", "Extra Information": None}
<7>
| ===========unchanged ref 0===========
at: app.Decryptor.Encoding.hexadecimal.Hexadecimal.__init__
self.lc = lc
===========changed ref 0===========
+ # module: app.test_dictionary
+
+
===========changed ref 1===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 2===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 3===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 4===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 6===========
# module: app.neuralNetworkMod.nn
class NeuralNetwork:
+
def __init__(self):
self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
self.CATEGORIES = [1, 2, 3, 4, 5, 6]
+ script_dir = os.path.dirname(__file__)
+ file_path = os.path.join(script_dir, "NeuralNetworkModel.model")
+ self.MODEL = load_model(file_path)
+
- self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
-
self.mh = app.mathsHelper.mathsHelper()
===========changed ref 7===========
# module: app.Decryptor.basicEncryption.affine
+
+
class Affine:
+
def decryptMessage(self, key, message):
keyA, keyB = getKeyParts(key)
+ self.checkKeys(keyA, keyB, "decrypt")
- self.checkKeys(keyA, keyB, 'decrypt')
+ plaintext = ""
- plaintext = ''
modInverseOfKeyA = self.mh.findModInverse(keyA, len(SYMBOLS))
+
-
for symbol in message:
if symbol in self.SYMBOLS:
# Decrypt the symbol:
symbolIndex = self.SYMBOLS.find(symbol)
+ plaintext += self.SYMBOLS[
+ (symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)
- plaintext += self.SYMBOLS[(symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)]
+ ]
else:
+ plaintext += symbol # Append the symbol without decrypting.
- plaintext += symbol # Append the symbol without decrypting.
+ return plaintext
- return plaintext
===========changed ref 8===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_perfect(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "Archimedes famously said: “Give me a lever long enough and a fulcrum on which to place it, and I shall move the world.” But what we are talking about here is not physical leverage. It is the leverage of ideas. When you create content, people can access your knowledge without taking your time. You no longer need to sell knowledge by the hour. Your ideas are the most valuable currency in a knowledge-driven economy. Just as an investment account allows your money to grow day and night without your involvement, content does the same with your ideas. Until recently, the average person wasn’t able to publish and distribute their ideas at a reasonable cost. But on the Internet, anybody, in any corner of the world, in any time zone, can access your best thinking. 24 hours a day. 7 days a week. 365 days a year. When you publish ideas, you create your own “Serendipity Vehicle” – a magnet for ideas and people and opportunities from potentially every corner of the globe. If your ideas resonate with people, people will discover you and bring you unexpected opportunities. They’ll open doors you never knew existed.",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 9===========
# module: app.Decryptor.basicEncryption.affine
+
+
class Affine:
+
-
def decrypt(self, text):
# Brute-force by looping through every possible key
+ for key in range(len(self.SYMBOLS) ** 2):
- for key in range(len(self.SYMBOLS) ** 2):
keyA = self.getKeyParts(key)[0]
if self.mh.gcd(keyA, len(self.SYMBOLS)) != 1:
continue
decryptedText = self.decryptMessage(key, message)
if self.lc.checkLanguage(decryptedText):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": decryptedText,
+ "Cipher": "Affine",
+ "Extra Information": f"The key used is {key}",
+ }
- return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": decryptedText, "Cipher": "Affine", "Extra Information": f"The key used is {key}"}
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": "Affine",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Affine", "Extra Information": None}
|
app.languageCheckerMod.chisquared/chiSquared.__init__ | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <2>:<add> # [0.0855, 0.0160, 0.0316, 0.0387, 0.1210,0.0218, 0.0209, 0.0496, 0.0733, 0.0022,0.0081, 0.0421, 0.0253, 0.0717, 0.0747,0.0207, 0.0010, 0.0633, 0.0673, 0.0894,0.0268, 0.0106, 0.0183, 0.0019, 0.0172,0.0011]
<del> #[0.0855, 0.0160, 0.0316, 0.0387, 0.1210,0.0218, 0.0209, 0.0496, 0.0733, 0.0022,0.0081, 0.0421, 0.0253, 0.0717, 0.0747,0.0207, 0.0010, 0.0633, 0.0673, 0.0894,0.0268, 0.0106, 0.0183, 0.0019, 0.0172,0.0011]
<3>:<add> # {'A': 8.12, 'B': 1.49, 'C': 2.71, 'D': 4.32, 'E': 12.02, 'F': 2.3, 'G': 2.03, 'H': 5.92, 'I': 7.31, 'J': 0.1, 'K': 0.69, 'L': 3.98, 'M': 2.61, 'N': 6.95, 'O': 7.68, 'P': 1. | # module: app.languageCheckerMod.chisquared
+
+
class chiSquared:
+
def __init__(self):
<0> self.languages = {
<1> "English":
<2> #[0.0855, 0.0160, 0.0316, 0.0387, 0.1210,0.0218, 0.0209, 0.0496, 0.0733, 0.0022,0.0081, 0.0421, 0.0253, 0.0717, 0.0747,0.0207, 0.0010, 0.0633, 0.0673, 0.0894,0.0268, 0.0106, 0.0183, 0.0019, 0.0172,0.0011]
<3> #{'A': 8.12, 'B': 1.49, 'C': 2.71, 'D': 4.32, 'E': 12.02, 'F': 2.3, 'G': 2.03, 'H': 5.92, 'I': 7.31, 'J': 0.1, 'K': 0.69, 'L': 3.98, 'M': 2.61, 'N': 6.95, 'O': 7.68, 'P': 1.82, 'Q': 0.11, 'R': 6.02, 'S': 6.28, 'T': 9.1, 'U': 2.88, 'V': 1.11, 'W': 2.09, 'X': 0.17, 'Y': 2.11, 'Z': 0.07}
<4> [0.0812, 0.0271, 0.0149, 0.1202, 0.0432, 0.0203, 0.023, 0.0731, 0.0592, 0.0069, 0.001, 0.026099999999999998, 0.0398, 0.0768, 0.0695, 0.0011, 0.0182, 0.06280000000000001, 0.0602, 0.0288, 0.091, 0.0209, 0.0111, 0.0210999999999999</s> | ===========below chunk 0===========
# module: app.languageCheckerMod.chisquared
+
+
class chiSquared:
+
def __init__(self):
# offset: 1
}
self.average = 0.0
self.totalDone = 0.0
self.oldAverage = 0.0
self.mh = app.mathsHelper.mathsHelper()
self.highestLanguage = ""
self.totalChi = 0.0
self.totalEqual = False
self.chisAsaList = []
# these are settings that may impact how the program works overall
self.chiSquaredSignificaneThreshold = 1 # how many stds you want to go below it
self.totalDoneThreshold = 10
self.standarddeviation = 0.00 # the standard deviation I use
self.oldstandarddeviation = 0.00
===========changed ref 0===========
+ # module: app.test_dictionary
+
+
===========changed ref 1===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 2===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 3===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 4===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 6===========
# module: app.neuralNetworkMod.nn
class NeuralNetwork:
+
def __init__(self):
self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
self.CATEGORIES = [1, 2, 3, 4, 5, 6]
+ script_dir = os.path.dirname(__file__)
+ file_path = os.path.join(script_dir, "NeuralNetworkModel.model")
+ self.MODEL = load_model(file_path)
+
- self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
-
self.mh = app.mathsHelper.mathsHelper()
===========changed ref 7===========
# module: app.Decryptor.Encoding.hexadecimal
class Hexadecimal:
+
def decrypt(self, text):
try:
result = bytearray.fromhex(text).decode()
except ValueError as e:
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": None,
+ "Extra Information": None,
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
+ }
-
+
if self.lc.checkLanguage(result):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": result,
+ "Cipher": "Ascii to Hexadecimal encoded",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Ascii to Hexadecimal encoded", "Extra Information": None}
===========changed ref 8===========
# module: app.Decryptor.basicEncryption.affine
+
+
class Affine:
+
def decryptMessage(self, key, message):
keyA, keyB = getKeyParts(key)
+ self.checkKeys(keyA, keyB, "decrypt")
- self.checkKeys(keyA, keyB, 'decrypt')
+ plaintext = ""
- plaintext = ''
modInverseOfKeyA = self.mh.findModInverse(keyA, len(SYMBOLS))
+
-
for symbol in message:
if symbol in self.SYMBOLS:
# Decrypt the symbol:
symbolIndex = self.SYMBOLS.find(symbol)
+ plaintext += self.SYMBOLS[
+ (symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)
- plaintext += self.SYMBOLS[(symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)]
+ ]
else:
+ plaintext += symbol # Append the symbol without decrypting.
- plaintext += symbol # Append the symbol without decrypting.
+ return plaintext
- return plaintext
===========changed ref 9===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_perfect(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "Archimedes famously said: “Give me a lever long enough and a fulcrum on which to place it, and I shall move the world.” But what we are talking about here is not physical leverage. It is the leverage of ideas. When you create content, people can access your knowledge without taking your time. You no longer need to sell knowledge by the hour. Your ideas are the most valuable currency in a knowledge-driven economy. Just as an investment account allows your money to grow day and night without your involvement, content does the same with your ideas. Until recently, the average person wasn’t able to publish and distribute their ideas at a reasonable cost. But on the Internet, anybody, in any corner of the world, in any time zone, can access your best thinking. 24 hours a day. 7 days a week. 365 days a year. When you publish ideas, you create your own “Serendipity Vehicle” – a magnet for ideas and people and opportunities from potentially every corner of the globe. If your ideas resonate with people, people will discover you and bring you unexpected opportunities. They’ll open doors you never knew existed.",
+ "English",
+ )
+ self.assertEqual(result, True)
+ |
app.languageCheckerMod.chisquared/chiSquared.getLetterFreq | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <1>:<add> letterFreq = {
<add> "a": 0,
<add> "b": 0,
<add> "c": 0,
<add> "d": 0,
<add> "e": 0,
<add> "f": 0,
<add> "g": 0,
<add> "h": 0,
<add> "i": 0,
<add> "j": 0,
<add> "k": 0,
<add> "l": 0,
<add> "m": 0,
<add> "n": 0,
<add> "o": 0,
<add> "p": 0,
<add> "q": 0,
<add> "r": 0,
<add> "s": 0,
<add> "t": 0,
<add> "u": 0,
<add> "v": 0,
<add> "w": 0,
<add> "x": 0,
<add> "y": 0,
<add> "z": 0,
<del> letterFreq = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0, 'f': 0, 'g': 0, 'h': 0, 'i': 0, 'j': 0, 'k': 0, 'l': 0, 'm': 0, 'n': 0, 'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0, 't': 0, 'u': 0, 'v': 0, 'w': 0, 'x': 0, 'y': 0, 'z': 0}
<2>:<add> }
<del>
<3>:<add>
| # module: app.languageCheckerMod.chisquared
+
+
class chiSquared:
+
def getLetterFreq(self, text):
<0> # This part creates a letter frequency of the text
<1> letterFreq = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0, 'f': 0, 'g': 0, 'h': 0, 'i': 0, 'j': 0, 'k': 0, 'l': 0, 'm': 0, 'n': 0, 'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0, 't': 0, 'u': 0, 'v': 0, 'w': 0, 'x': 0, 'y': 0, 'z': 0}
<2>
<3> for letter in text.lower():
<4> if letter in letterFreq:
<5> letterFreq[letter] +=1
<6> else:
<7> # if letter is not puncuation, but it is still ascii
<8> # it's probably a different language so add it to the dict
<9> if letter not in punctuation and self.mh.isAscii(letter) and letter not in NUMBERS:
<10> letterFreq[letter] = 1
<11> return letterFreq
<12>
| ===========unchanged ref 0===========
at: app.languageCheckerMod.chisquared
chiSquared()
at: app.languageCheckerMod.chisquared.chiSquared.__init__
self.average = 0.0
self.totalDone = 0.0
self.totalChi = 0.0
self.chisAsaList = []
at: app.languageCheckerMod.chisquared.chiSquared.chiSquared
self.totalDone += 1
self.average = (self.totalChi + maxChiSquare) / self.totalDone
===========changed ref 0===========
+ # module: app.test_dictionary
+
+
===========changed ref 1===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 2===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 3===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 4===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 6===========
# module: app.neuralNetworkMod.nn
class NeuralNetwork:
+
def __init__(self):
self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
self.CATEGORIES = [1, 2, 3, 4, 5, 6]
+ script_dir = os.path.dirname(__file__)
+ file_path = os.path.join(script_dir, "NeuralNetworkModel.model")
+ self.MODEL = load_model(file_path)
+
- self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
-
self.mh = app.mathsHelper.mathsHelper()
===========changed ref 7===========
# module: app.Decryptor.Encoding.hexadecimal
class Hexadecimal:
+
def decrypt(self, text):
try:
result = bytearray.fromhex(text).decode()
except ValueError as e:
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": None,
+ "Extra Information": None,
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
+ }
-
+
if self.lc.checkLanguage(result):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": result,
+ "Cipher": "Ascii to Hexadecimal encoded",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Ascii to Hexadecimal encoded", "Extra Information": None}
===========changed ref 8===========
# module: app.Decryptor.basicEncryption.affine
+
+
class Affine:
+
def decryptMessage(self, key, message):
keyA, keyB = getKeyParts(key)
+ self.checkKeys(keyA, keyB, "decrypt")
- self.checkKeys(keyA, keyB, 'decrypt')
+ plaintext = ""
- plaintext = ''
modInverseOfKeyA = self.mh.findModInverse(keyA, len(SYMBOLS))
+
-
for symbol in message:
if symbol in self.SYMBOLS:
# Decrypt the symbol:
symbolIndex = self.SYMBOLS.find(symbol)
+ plaintext += self.SYMBOLS[
+ (symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)
- plaintext += self.SYMBOLS[(symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)]
+ ]
else:
+ plaintext += symbol # Append the symbol without decrypting.
- plaintext += symbol # Append the symbol without decrypting.
+ return plaintext
- return plaintext
===========changed ref 9===========
# module: app.languageCheckerMod.chisquared
+
+
class chiSquared:
+
def __init__(self):
self.languages = {
"English":
+ # [0.0855, 0.0160, 0.0316, 0.0387, 0.1210,0.0218, 0.0209, 0.0496, 0.0733, 0.0022,0.0081, 0.0421, 0.0253, 0.0717, 0.0747,0.0207, 0.0010, 0.0633, 0.0673, 0.0894,0.0268, 0.0106, 0.0183, 0.0019, 0.0172,0.0011]
- #[0.0855, 0.0160, 0.0316, 0.0387, 0.1210,0.0218, 0.0209, 0.0496, 0.0733, 0.0022,0.0081, 0.0421, 0.0253, 0.0717, 0.0747,0.0207, 0.0010, 0.0633, 0.0673, 0.0894,0.0268, 0.0106, 0.0183, 0.0019, 0.0172,0.0011]
+ # {'A': 8.12, 'B': 1.49, 'C': 2.71, 'D': 4.32, 'E': 12.02, 'F': 2.3, 'G': 2.03, 'H': 5.92, 'I': 7.31, 'J': 0.1, 'K': 0.69, 'L': 3.98, 'M': 2.61, 'N': 6.95, 'O': 7.68, 'P': 1.82, 'Q': 0.11, 'R': 6.02, 'S': 6.28, 'T': 9.1, 'U': 2.88, 'V': 1.11, 'W': 2.09, 'X': 0.17, 'Y': 2.11, 'Z': 0.07</s> |
app.languageCheckerMod.chisquared/chiSquared.chiSquared | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <2>:<del>
<18>:<add> print(
<add> 'Error, you have entered an empty string :( The error is "'
<add> + str(e)
<add> + '" on line 34 of LanguageChecker.py (function chiSquared)'
<add> )
<del> print("Error, you have entered an empty string :( The error is \"" + str(e) +"\" on line 34 of LanguageChecker.py (function chiSquared)")
<20>:<add>
<del>
<26>:<add> # , list(languages[language].values())
<del> #, list(languages[language].values())
| # module: app.languageCheckerMod.chisquared
+
+
class chiSquared:
+
def chiSquared(self, text):
<0> """Creates letter frequency of text and compares that to the letter frequency of the language"""
<1>
<2>
<3> # if all items of the dictionary are the same, then it's a normal distribution
<4> # examples of this could be "the quick brown fox jumped over the lazy dog"
<5>
<6> letterFreq = self.getLetterFreq(text)
<7> self.totalEqual = self.mh.checkEqual(list(letterFreq.values()))
<8>
<9> # so we dont have to calculate len more than once
<10> # turns them into probabilities (frequency distribution)
<11> lenOfString = len(text)
<12> totalLetterFreq = 0.0
<13> for key, value in letterFreq.items():
<14> try:
<15> letterFreq[key] = value / lenOfString
<16> totalLetterFreq = totalLetterFreq + value
<17> except ZeroDivisionError as e:
<18> print("Error, you have entered an empty string :( The error is \"" + str(e) +"\" on line 34 of LanguageChecker.py (function chiSquared)")
<19> exit(1)
<20>
<21> # calculates chi squared of each language
<22> maxChiSquare = 0.00
<23> languagesChi = {}
<24>
<25> for language in self.languages:
<26> #, list(languages[language].values())
<27> temp = self.myChi(letterFreq, self.languages[language])
<28> languagesChi[language] = temp
<29> if temp > maxChiSquare:
<30> self.highestLanguage = language
<31> maxChiSquare = temp
<32> self.chisAsaList.append(maxChiSquare)
<33> # calculates running average
<34> self.oldAverage = self.average
<35> self.totalDone += 1
<36> # calculates a running average, maxChiSquare is the</s> | ===========below chunk 0===========
# module: app.languageCheckerMod.chisquared
+
+
class chiSquared:
+
def chiSquared(self, text):
# offset: 1
self.average = (self.totalChi + maxChiSquare) / self.totalDone
self.oldstandarddeviation = abs(self.standarddeviation)
self.standarddeviation = abs(std(self.chisAsaList))
return(languagesChi)
===========unchanged ref 0===========
at: app.languageCheckerMod.chisquared.chiSquared
chiSquared(text)
at: app.languageCheckerMod.chisquared.chiSquared.__init__
self.average = 0.0
self.totalDone = 0.0
self.totalEqual = False
self.chisAsaList = []
self.chiSquaredSignificaneThreshold = 1 # how many stds you want to go below it
self.totalDoneThreshold = 10
self.oldstandarddeviation = 0.00
at: app.languageCheckerMod.chisquared.chiSquared.chiSquared
self.totalEqual = self.mh.checkEqual(list(letterFreq.values()))
self.totalDone += 1
self.average = (self.totalChi + maxChiSquare) / self.totalDone
self.oldstandarddeviation = abs(self.standarddeviation)
===========changed ref 0===========
# module: app.languageCheckerMod.chisquared
+
+
class chiSquared:
+
def getLetterFreq(self, text):
# This part creates a letter frequency of the text
+ letterFreq = {
+ "a": 0,
+ "b": 0,
+ "c": 0,
+ "d": 0,
+ "e": 0,
+ "f": 0,
+ "g": 0,
+ "h": 0,
+ "i": 0,
+ "j": 0,
+ "k": 0,
+ "l": 0,
+ "m": 0,
+ "n": 0,
+ "o": 0,
+ "p": 0,
+ "q": 0,
+ "r": 0,
+ "s": 0,
+ "t": 0,
+ "u": 0,
+ "v": 0,
+ "w": 0,
+ "x": 0,
+ "y": 0,
+ "z": 0,
- letterFreq = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0, 'f': 0, 'g': 0, 'h': 0, 'i': 0, 'j': 0, 'k': 0, 'l': 0, 'm': 0, 'n': 0, 'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0, 't': 0, 'u': 0, 'v': 0, 'w': 0, 'x': 0, 'y': 0, 'z': 0}
+ }
-
+
for letter in text.lower():
if letter in letterFreq:
+ letterFreq[letter] += 1
- letterFreq[letter] +=1
else:
# if letter is not puncuation, but it is still ascii
# it's probably a</s>
===========changed ref 1===========
# module: app.languageCheckerMod.chisquared
+
+
class chiSquared:
+
def getLetterFreq(self, text):
# offset: 1
<s>
else:
# if letter is not puncuation, but it is still ascii
# it's probably a different language so add it to the dict
+ if (
+ letter not in punctuation
+ and self.mh.isAscii(letter)
+ and letter not in NUMBERS
+ ):
- if letter not in punctuation and self.mh.isAscii(letter) and letter not in NUMBERS:
letterFreq[letter] = 1
return letterFreq
===========changed ref 2===========
+ # module: app.test_dictionary
+
+
===========changed ref 3===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 4===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 6===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 7===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 8===========
# module: app.neuralNetworkMod.nn
class NeuralNetwork:
+
def __init__(self):
self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
self.CATEGORIES = [1, 2, 3, 4, 5, 6]
+ script_dir = os.path.dirname(__file__)
+ file_path = os.path.join(script_dir, "NeuralNetworkModel.model")
+ self.MODEL = load_model(file_path)
+
- self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
-
self.mh = app.mathsHelper.mathsHelper()
|
app.Decryptor.Encoding.binary/Binary.decrypt | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <3>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": False,
<add> "Plaintext": None,
<add> "Cipher": None,
<add> "Extra Information": None,
<add> }
<del> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
<5>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": False,
<add> "Plaintext": None,
<add> "Cipher": None,
<add> "Extra Information": None,
<add> }
<del> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
<8>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": True,
<add> "Plaintext": result,
<add> "Cipher": "Ascii to Binary encoded",
<add> "Extra Information": None,
<add> }
<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": False,
<add> "Plaintext": None,
<add> "Cipher": None,
<add> "Extra | # module: app.Decryptor.Encoding.binary
+
class Binary:
+
def decrypt(self, text):
<0> try:
<1> result = self.decode(text)
<2> except ValueError as e:
<3> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
<4> except TypeError as e:
<5> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
<6>
<7> if self.lc.checkLanguage(result):
<8> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Ascii to Binary encoded", "Extra Information": None}
<9> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
<10>
| ===========unchanged ref 0===========
at: app.Decryptor.Encoding.binary.Binary
decode(text)
===========changed ref 0===========
+ # module: app.test_dictionary
+
+
===========changed ref 1===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 2===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 3===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 4===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 6===========
# module: app.neuralNetworkMod.nn
class NeuralNetwork:
+
def __init__(self):
self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
self.CATEGORIES = [1, 2, 3, 4, 5, 6]
+ script_dir = os.path.dirname(__file__)
+ file_path = os.path.join(script_dir, "NeuralNetworkModel.model")
+ self.MODEL = load_model(file_path)
+
- self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
-
self.mh = app.mathsHelper.mathsHelper()
===========changed ref 7===========
# module: app.Decryptor.Encoding.hexadecimal
class Hexadecimal:
+
def decrypt(self, text):
try:
result = bytearray.fromhex(text).decode()
except ValueError as e:
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": None,
+ "Extra Information": None,
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
+ }
-
+
if self.lc.checkLanguage(result):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": result,
+ "Cipher": "Ascii to Hexadecimal encoded",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Ascii to Hexadecimal encoded", "Extra Information": None}
===========changed ref 8===========
# module: app.Decryptor.basicEncryption.affine
+
+
class Affine:
+
def decryptMessage(self, key, message):
keyA, keyB = getKeyParts(key)
+ self.checkKeys(keyA, keyB, "decrypt")
- self.checkKeys(keyA, keyB, 'decrypt')
+ plaintext = ""
- plaintext = ''
modInverseOfKeyA = self.mh.findModInverse(keyA, len(SYMBOLS))
+
-
for symbol in message:
if symbol in self.SYMBOLS:
# Decrypt the symbol:
symbolIndex = self.SYMBOLS.find(symbol)
+ plaintext += self.SYMBOLS[
+ (symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)
- plaintext += self.SYMBOLS[(symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)]
+ ]
else:
+ plaintext += symbol # Append the symbol without decrypting.
- plaintext += symbol # Append the symbol without decrypting.
+ return plaintext
- return plaintext
===========changed ref 9===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_perfect(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "Archimedes famously said: “Give me a lever long enough and a fulcrum on which to place it, and I shall move the world.” But what we are talking about here is not physical leverage. It is the leverage of ideas. When you create content, people can access your knowledge without taking your time. You no longer need to sell knowledge by the hour. Your ideas are the most valuable currency in a knowledge-driven economy. Just as an investment account allows your money to grow day and night without your involvement, content does the same with your ideas. Until recently, the average person wasn’t able to publish and distribute their ideas at a reasonable cost. But on the Internet, anybody, in any corner of the world, in any time zone, can access your best thinking. 24 hours a day. 7 days a week. 365 days a year. When you publish ideas, you create your own “Serendipity Vehicle” – a magnet for ideas and people and opportunities from potentially every corner of the globe. If your ideas resonate with people, people will discover you and bring you unexpected opportunities. They’ll open doors you never knew existed.",
+ "English",
+ )
+ self.assertEqual(result, True)
+ |
app.Decryptor.Encoding.binary/Binary.decode | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <5>:<add> text = text.encode("utf-8")
<del> text = text.encode('utf-8')
<11>:<add> text = n.to_bytes((n.bit_length() + 7) // 8, "big").decode()
<del> text = n.to_bytes((n.bit_length() + 7) // 8, 'big').decode()
<13>:<add> return text
<del> return text
| # module: app.Decryptor.Encoding.binary
+
class Binary:
+
-
def decode(self, text):
<0> """
<1> my own binary decoder lol ;p
<2> """
<3> text = text.replace(" ", "")
<4> # to a bytes string
<5> text = text.encode('utf-8')
<6>
<7> # into base 2
<8> n = int(text, 2)
<9>
<10> # into ascii
<11> text = n.to_bytes((n.bit_length() + 7) // 8, 'big').decode()
<12>
<13> return text
<14>
| ===========unchanged ref 0===========
at: app.Decryptor.Encoding.binary.Binary.__init__
self.lc = lc
at: app.Decryptor.Encoding.binary.Binary.decrypt
result = self.decode(text)
at: languageCheckerMod.LanguageChecker.LanguageChecker
checkLanguage(text)
===========changed ref 0===========
# module: app.Decryptor.Encoding.binary
+
class Binary:
+
def decrypt(self, text):
try:
result = self.decode(text)
except ValueError as e:
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": None,
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
except TypeError as e:
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": None,
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
if self.lc.checkLanguage(result):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": result,
+ "Cipher": "Ascii to Binary encoded",
+ "Extra Information": None,
+ }
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": None,
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Ascii to Binary encoded", "Extra Information": None}
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
===========changed ref 1===========
+ # module: app.test_dictionary
+
+
===========changed ref 2===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 3===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 4===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 6===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 7===========
# module: app.neuralNetworkMod.nn
class NeuralNetwork:
+
def __init__(self):
self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
self.CATEGORIES = [1, 2, 3, 4, 5, 6]
+ script_dir = os.path.dirname(__file__)
+ file_path = os.path.join(script_dir, "NeuralNetworkModel.model")
+ self.MODEL = load_model(file_path)
+
- self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
-
self.mh = app.mathsHelper.mathsHelper()
===========changed ref 8===========
# module: app.Decryptor.Encoding.hexadecimal
class Hexadecimal:
+
def decrypt(self, text):
try:
result = bytearray.fromhex(text).decode()
except ValueError as e:
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": None,
+ "Extra Information": None,
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
+ }
-
+
if self.lc.checkLanguage(result):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": result,
+ "Cipher": "Ascii to Hexadecimal encoded",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Ascii to Hexadecimal encoded", "Extra Information": None}
===========changed ref 9===========
# module: app.Decryptor.basicEncryption.affine
+
+
class Affine:
+
def decryptMessage(self, key, message):
keyA, keyB = getKeyParts(key)
+ self.checkKeys(keyA, keyB, "decrypt")
- self.checkKeys(keyA, keyB, 'decrypt')
+ plaintext = ""
- plaintext = ''
modInverseOfKeyA = self.mh.findModInverse(keyA, len(SYMBOLS))
+
-
for symbol in message:
if symbol in self.SYMBOLS:
# Decrypt the symbol:
symbolIndex = self.SYMBOLS.find(symbol)
+ plaintext += self.SYMBOLS[
+ (symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)
- plaintext += self.SYMBOLS[(symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)]
+ ]
else:
+ plaintext += symbol # Append the symbol without decrypting.
- plaintext += symbol # Append the symbol without decrypting.
+ return plaintext
- return plaintext
|
app.Decryptor.Encoding.ascii/Ascii.decrypt | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <3>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": False,
<add> "Plaintext": None,
<add> "Cipher": None,
<add> "Extra Information": None,
<add> }
<del> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
<5>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": False,
<add> "Plaintext": None,
<add> "Cipher": None,
<add> "Extra Information": None,
<add> }
<del> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
<6>:<del>
<9>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": True,
<add> "Plaintext": result,
<add> "Cipher": "Ascii to Ascii number encoded",
<add> "Extra Information": None,
<add> }
<del> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Ascii to Ascii number encoded", "Extra Information": None}
| # module: app.Decryptor.Encoding.ascii
class Ascii:
+
def decrypt(self, text):
<0> try:
<1> result = self.deascii(text)
<2> except ValueError as e:
<3> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
<4> except TypeError as e:
<5> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
<6>
<7>
<8> if self.lc.checkLanguage(result):
<9> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Ascii to Ascii number encoded", "Extra Information": None}
<10>
| ===========unchanged ref 0===========
at: app.Decryptor.Encoding.ascii.Ascii
deascii(text)
===========changed ref 0===========
+ # module: app.test_dictionary
+
+
===========changed ref 1===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 2===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 3===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 4===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 6===========
# module: app.Decryptor.Encoding.binary
+
class Binary:
+
-
def decode(self, text):
"""
my own binary decoder lol ;p
"""
text = text.replace(" ", "")
# to a bytes string
+ text = text.encode("utf-8")
- text = text.encode('utf-8')
# into base 2
n = int(text, 2)
# into ascii
+ text = n.to_bytes((n.bit_length() + 7) // 8, "big").decode()
- text = n.to_bytes((n.bit_length() + 7) // 8, 'big').decode()
+ return text
- return text
===========changed ref 7===========
# module: app.neuralNetworkMod.nn
class NeuralNetwork:
+
def __init__(self):
self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
self.CATEGORIES = [1, 2, 3, 4, 5, 6]
+ script_dir = os.path.dirname(__file__)
+ file_path = os.path.join(script_dir, "NeuralNetworkModel.model")
+ self.MODEL = load_model(file_path)
+
- self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
-
self.mh = app.mathsHelper.mathsHelper()
===========changed ref 8===========
# module: app.Decryptor.Encoding.hexadecimal
class Hexadecimal:
+
def decrypt(self, text):
try:
result = bytearray.fromhex(text).decode()
except ValueError as e:
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": None,
+ "Extra Information": None,
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
+ }
-
+
if self.lc.checkLanguage(result):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": result,
+ "Cipher": "Ascii to Hexadecimal encoded",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Ascii to Hexadecimal encoded", "Extra Information": None}
===========changed ref 9===========
# module: app.Decryptor.basicEncryption.affine
+
+
class Affine:
+
def decryptMessage(self, key, message):
keyA, keyB = getKeyParts(key)
+ self.checkKeys(keyA, keyB, "decrypt")
- self.checkKeys(keyA, keyB, 'decrypt')
+ plaintext = ""
- plaintext = ''
modInverseOfKeyA = self.mh.findModInverse(keyA, len(SYMBOLS))
+
-
for symbol in message:
if symbol in self.SYMBOLS:
# Decrypt the symbol:
symbolIndex = self.SYMBOLS.find(symbol)
+ plaintext += self.SYMBOLS[
+ (symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)
- plaintext += self.SYMBOLS[(symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)]
+ ]
else:
+ plaintext += symbol # Append the symbol without decrypting.
- plaintext += symbol # Append the symbol without decrypting.
+ return plaintext
- return plaintext
===========changed ref 10===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_perfect(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "Archimedes famously said: “Give me a lever long enough and a fulcrum on which to place it, and I shall move the world.” But what we are talking about here is not physical leverage. It is the leverage of ideas. When you create content, people can access your knowledge without taking your time. You no longer need to sell knowledge by the hour. Your ideas are the most valuable currency in a knowledge-driven economy. Just as an investment account allows your money to grow day and night without your involvement, content does the same with your ideas. Until recently, the average person wasn’t able to publish and distribute their ideas at a reasonable cost. But on the Internet, anybody, in any corner of the world, in any time zone, can access your best thinking. 24 hours a day. 7 days a week. 365 days a year. When you publish ideas, you create your own “Serendipity Vehicle” – a magnet for ideas and people and opportunities from potentially every corner of the globe. If your ideas resonate with people, people will discover you and bring you unexpected opportunities. They’ll open doors you never knew existed.",
+ "English",
+ )
+ self.assertEqual(result, True)
+ |
app.Decryptor.Encoding.base64/Base64.decrypt | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <0>:<add>
<del>
<4>:<add> result = result.decode("utf-8")
<del> result = result.decode("utf-8")
<6>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": False,
<add> "Plaintext": None,
<add> "Cipher": None,
<add> "Extra Information": None,
<add> }
<del> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
<8>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": False,
<add> "Plaintext": None,
<add> "Cipher": None,
<add> "Extra Information": None,
<add> }
<del> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
<10>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": True,
<add> "Plaintext": result,
<add> "Cipher": "Base64 encoded",
<add> "Extra Information": None,
<add> }
<del> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Base64 encoded", "Extra Information": None}
<12>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": False,
| # module: app.Decryptor.Encoding.base64
+
+
class Base64:
+
def decrypt(self, text):
<0>
<1> try:
<2> result = base64.b64decode(text)
<3> # yeet turning b strings into normal stringy bois
<4> result = result.decode("utf-8")
<5> except UnicodeDecodeError as e:
<6> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
<7> except binascii.Error as e:
<8> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
<9> if self.lc.checkLanguage(result):
<10> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Base64 encoded", "Extra Information": None}
<11> else:
<12> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
<13>
| ===========unchanged ref 0===========
at: base64
b64decode(s: _decodable, altchars: Optional[bytes]=..., validate: bool=...) -> bytes
===========changed ref 0===========
+ # module: app.test_dictionary
+
+
===========changed ref 1===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 2===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 3===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 4===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 6===========
# module: app.Decryptor.Encoding.binary
+
class Binary:
+
-
def decode(self, text):
"""
my own binary decoder lol ;p
"""
text = text.replace(" ", "")
# to a bytes string
+ text = text.encode("utf-8")
- text = text.encode('utf-8')
# into base 2
n = int(text, 2)
# into ascii
+ text = n.to_bytes((n.bit_length() + 7) // 8, "big").decode()
- text = n.to_bytes((n.bit_length() + 7) // 8, 'big').decode()
+ return text
- return text
===========changed ref 7===========
# module: app.neuralNetworkMod.nn
class NeuralNetwork:
+
def __init__(self):
self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
self.CATEGORIES = [1, 2, 3, 4, 5, 6]
+ script_dir = os.path.dirname(__file__)
+ file_path = os.path.join(script_dir, "NeuralNetworkModel.model")
+ self.MODEL = load_model(file_path)
+
- self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
-
self.mh = app.mathsHelper.mathsHelper()
===========changed ref 8===========
# module: app.Decryptor.Encoding.hexadecimal
class Hexadecimal:
+
def decrypt(self, text):
try:
result = bytearray.fromhex(text).decode()
except ValueError as e:
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": None,
+ "Extra Information": None,
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
+ }
-
+
if self.lc.checkLanguage(result):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": result,
+ "Cipher": "Ascii to Hexadecimal encoded",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Ascii to Hexadecimal encoded", "Extra Information": None}
===========changed ref 9===========
# module: app.Decryptor.basicEncryption.affine
+
+
class Affine:
+
def decryptMessage(self, key, message):
keyA, keyB = getKeyParts(key)
+ self.checkKeys(keyA, keyB, "decrypt")
- self.checkKeys(keyA, keyB, 'decrypt')
+ plaintext = ""
- plaintext = ''
modInverseOfKeyA = self.mh.findModInverse(keyA, len(SYMBOLS))
+
-
for symbol in message:
if symbol in self.SYMBOLS:
# Decrypt the symbol:
symbolIndex = self.SYMBOLS.find(symbol)
+ plaintext += self.SYMBOLS[
+ (symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)
- plaintext += self.SYMBOLS[(symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)]
+ ]
else:
+ plaintext += symbol # Append the symbol without decrypting.
- plaintext += symbol # Append the symbol without decrypting.
+ return plaintext
- return plaintext
===========changed ref 10===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_perfect(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "Archimedes famously said: “Give me a lever long enough and a fulcrum on which to place it, and I shall move the world.” But what we are talking about here is not physical leverage. It is the leverage of ideas. When you create content, people can access your knowledge without taking your time. You no longer need to sell knowledge by the hour. Your ideas are the most valuable currency in a knowledge-driven economy. Just as an investment account allows your money to grow day and night without your involvement, content does the same with your ideas. Until recently, the average person wasn’t able to publish and distribute their ideas at a reasonable cost. But on the Internet, anybody, in any corner of the world, in any time zone, can access your best thinking. 24 hours a day. 7 days a week. 365 days a year. When you publish ideas, you create your own “Serendipity Vehicle” – a magnet for ideas and people and opportunities from potentially every corner of the globe. If your ideas resonate with people, people will discover you and bring you unexpected opportunities. They’ll open doors you never knew existed.",
+ "English",
+ )
+ self.assertEqual(result, True)
+ |
app.Decryptor.Encoding.encodingParent/EncodingParent.decrypt | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <9>:<add> from multiprocessing.dummy import Pool as ThreadPool
<del> from multiprocessing.dummy import Pool as ThreadPool
<10>:<add>
<add> pool = ThreadPool(4)
<del> pool = ThreadPool(4)
<12>:<add>
<del>
<18>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": False,
<add> "Plaintext": None,
<add> "Cipher": None,
<add> "Extra Information": None,
<add> }
<del> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
| # module: app.Decryptor.Encoding.encodingParent
+
class EncodingParent:
+
def decrypt(self, text):
<0> self.text = text
<1> torun = [self.base64, self.binary, self.hex, self.ascii, self.morse]
<2> """
<3> ok so I have an array of functions
<4> and I want to apply each function to some text
<5> (text, function)
<6> but the way it works is you apply text to every item in the array (function)
<7>
<8> """
<9> from multiprocessing.dummy import Pool as ThreadPool
<10> pool = ThreadPool(4)
<11> answers = pool.map(self.callDecrypt, torun)
<12>
<13> for answer in answers:
<14> # adds the LC objects together
<15> self.lc = self.lc + answer["lc"]
<16> if answer["IsPlaintext?"]:
<17> return answer
<18> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
<19>
| ===========unchanged ref 0===========
at: app.Decryptor.Encoding.encodingParent.EncodingParent
callDecrypt(obj)
at: app.Decryptor.Encoding.encodingParent.EncodingParent.__init__
self.base64 = Base64(self.lc)
self.binary = Binary(self.lc)
self.hex = Hexadecimal(self.lc)
self.ascii = Ascii(self.lc)
self.morse = MorseCode(self.lc)
at: multiprocessing.dummy
Pool(processes: Optional[int]=..., initializer: Optional[Callable[..., Any]]=..., initargs: Iterable[Any]=...) -> Any
===========changed ref 0===========
+ # module: app.test_dictionary
+
+
===========changed ref 1===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 2===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 3===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 4===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 6===========
# module: app.Decryptor.Encoding.binary
+
class Binary:
+
-
def decode(self, text):
"""
my own binary decoder lol ;p
"""
text = text.replace(" ", "")
# to a bytes string
+ text = text.encode("utf-8")
- text = text.encode('utf-8')
# into base 2
n = int(text, 2)
# into ascii
+ text = n.to_bytes((n.bit_length() + 7) // 8, "big").decode()
- text = n.to_bytes((n.bit_length() + 7) // 8, 'big').decode()
+ return text
- return text
===========changed ref 7===========
# module: app.neuralNetworkMod.nn
class NeuralNetwork:
+
def __init__(self):
self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
self.CATEGORIES = [1, 2, 3, 4, 5, 6]
+ script_dir = os.path.dirname(__file__)
+ file_path = os.path.join(script_dir, "NeuralNetworkModel.model")
+ self.MODEL = load_model(file_path)
+
- self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
-
self.mh = app.mathsHelper.mathsHelper()
===========changed ref 8===========
# module: app.Decryptor.Encoding.hexadecimal
class Hexadecimal:
+
def decrypt(self, text):
try:
result = bytearray.fromhex(text).decode()
except ValueError as e:
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": None,
+ "Extra Information": None,
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
+ }
-
+
if self.lc.checkLanguage(result):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": result,
+ "Cipher": "Ascii to Hexadecimal encoded",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Ascii to Hexadecimal encoded", "Extra Information": None}
===========changed ref 9===========
# module: app.Decryptor.basicEncryption.affine
+
+
class Affine:
+
def decryptMessage(self, key, message):
keyA, keyB = getKeyParts(key)
+ self.checkKeys(keyA, keyB, "decrypt")
- self.checkKeys(keyA, keyB, 'decrypt')
+ plaintext = ""
- plaintext = ''
modInverseOfKeyA = self.mh.findModInverse(keyA, len(SYMBOLS))
+
-
for symbol in message:
if symbol in self.SYMBOLS:
# Decrypt the symbol:
symbolIndex = self.SYMBOLS.find(symbol)
+ plaintext += self.SYMBOLS[
+ (symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)
- plaintext += self.SYMBOLS[(symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)]
+ ]
else:
+ plaintext += symbol # Append the symbol without decrypting.
- plaintext += symbol # Append the symbol without decrypting.
+ return plaintext
- return plaintext
|
app.Decryptor.basicEncryption.reverse/Reverse.decrypt | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <5>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": True,
<add> "Plaintext": message,
<add> "Cipher": "Reverse",
<add> "Extra Information": None,
<add> }
<del> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": message, "Cipher": "Reverse", "Extra Information": None}
<7>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": False,
<add> "Plaintext": None,
<add> "Cipher": "Reverse",
<add> "Extra Information": None,
<add> }
<del> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Reverse", "Extra Information": None}
| # module: app.Decryptor.basicEncryption.reverse
class Reverse:
def decrypt(self, message):
<0> message = self.mh.stripPuncuation(message)
<1>
<2> message = message[::-1]
<3> result = self.lc.checkLanguage(message)
<4> if result:
<5> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": message, "Cipher": "Reverse", "Extra Information": None}
<6> else:
<7> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Reverse", "Extra Information": None}
<8>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.reverse.Reverse.__init__
self.lc = lc
self.mh = app.mathsHelper.mathsHelper()
at: app.mathsHelper.mathsHelper
stripPuncuation(text)
at: languageCheckerMod.LanguageChecker.LanguageChecker
checkLanguage(text)
===========changed ref 0===========
+ # module: app.test_dictionary
+
+
===========changed ref 1===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 2===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 3===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 4===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 6===========
# module: app.Decryptor.Encoding.binary
+
class Binary:
+
-
def decode(self, text):
"""
my own binary decoder lol ;p
"""
text = text.replace(" ", "")
# to a bytes string
+ text = text.encode("utf-8")
- text = text.encode('utf-8')
# into base 2
n = int(text, 2)
# into ascii
+ text = n.to_bytes((n.bit_length() + 7) // 8, "big").decode()
- text = n.to_bytes((n.bit_length() + 7) // 8, 'big').decode()
+ return text
- return text
===========changed ref 7===========
# module: app.neuralNetworkMod.nn
class NeuralNetwork:
+
def __init__(self):
self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
self.CATEGORIES = [1, 2, 3, 4, 5, 6]
+ script_dir = os.path.dirname(__file__)
+ file_path = os.path.join(script_dir, "NeuralNetworkModel.model")
+ self.MODEL = load_model(file_path)
+
- self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
-
self.mh = app.mathsHelper.mathsHelper()
===========changed ref 8===========
# module: app.Decryptor.Encoding.hexadecimal
class Hexadecimal:
+
def decrypt(self, text):
try:
result = bytearray.fromhex(text).decode()
except ValueError as e:
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": None,
+ "Extra Information": None,
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
+ }
-
+
if self.lc.checkLanguage(result):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": result,
+ "Cipher": "Ascii to Hexadecimal encoded",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Ascii to Hexadecimal encoded", "Extra Information": None}
===========changed ref 9===========
# module: app.Decryptor.basicEncryption.affine
+
+
class Affine:
+
def decryptMessage(self, key, message):
keyA, keyB = getKeyParts(key)
+ self.checkKeys(keyA, keyB, "decrypt")
- self.checkKeys(keyA, keyB, 'decrypt')
+ plaintext = ""
- plaintext = ''
modInverseOfKeyA = self.mh.findModInverse(keyA, len(SYMBOLS))
+
-
for symbol in message:
if symbol in self.SYMBOLS:
# Decrypt the symbol:
symbolIndex = self.SYMBOLS.find(symbol)
+ plaintext += self.SYMBOLS[
+ (symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)
- plaintext += self.SYMBOLS[(symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)]
+ ]
else:
+ plaintext += symbol # Append the symbol without decrypting.
- plaintext += symbol # Append the symbol without decrypting.
+ return plaintext
- return plaintext
===========changed ref 10===========
# module: app.Decryptor.Encoding.encodingParent
+
class EncodingParent:
+
def decrypt(self, text):
self.text = text
torun = [self.base64, self.binary, self.hex, self.ascii, self.morse]
"""
ok so I have an array of functions
and I want to apply each function to some text
(text, function)
but the way it works is you apply text to every item in the array (function)
"""
+ from multiprocessing.dummy import Pool as ThreadPool
- from multiprocessing.dummy import Pool as ThreadPool
+
+ pool = ThreadPool(4)
- pool = ThreadPool(4)
answers = pool.map(self.callDecrypt, torun)
+
-
for answer in answers:
# adds the LC objects together
self.lc = self.lc + answer["lc"]
if answer["IsPlaintext?"]:
return answer
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": None,
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
|
app.mathsHelper/mathsHelper.findModInverse | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <2>:<add>
<del>
<4>:<add> return None # No mod inverse exists if a & m aren't relatively prime.
<del> return None # No mod inverse exists if a & m aren't relatively prime.
<5>:<add>
<del>
<10>:<add> q = u3 // v3 # Note that // is the integer division operator
<del> q = u3 // v3 # Note that // is the integer division operator
<11>:<add> v1, v2, v3, u1, u2, u3 = (
<add> (u1 - q * v1),
<add> (u2 - q * v2),
<add> (u3 - q * v3),
<add> v1,
<add> v2,
<add> v3,
<add> )
<del> v1, v2, v3, u1, u2, u3 = (u1 - q * v1), (u2 - q * v2), (u3 - q * v3), v1, v2, v3
| # module: app.mathsHelper
+
class mathsHelper:
+
def findModInverse(self, a, m):
<0> # Return the modular inverse of a % m, which is
<1> # the number x such that a*x % m = 1
<2>
<3> if gcd(a, m) != 1:
<4> return None # No mod inverse exists if a & m aren't relatively prime.
<5>
<6> # Calculate using the Extended Euclidean Algorithm:
<7> u1, u2, u3 = 1, 0, a
<8> v1, v2, v3 = 0, 1, m
<9> while v3 != 0:
<10> q = u3 // v3 # Note that // is the integer division operator
<11> v1, v2, v3, u1, u2, u3 = (u1 - q * v1), (u2 - q * v2), (u3 - q * v3), v1, v2, v3
<12> return u1 % m
<13>
| ===========changed ref 0===========
+ # module: app.test_dictionary
+
+
===========changed ref 1===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 2===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 3===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 4===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 6===========
# module: app.Decryptor.Encoding.binary
+
class Binary:
+
-
def decode(self, text):
"""
my own binary decoder lol ;p
"""
text = text.replace(" ", "")
# to a bytes string
+ text = text.encode("utf-8")
- text = text.encode('utf-8')
# into base 2
n = int(text, 2)
# into ascii
+ text = n.to_bytes((n.bit_length() + 7) // 8, "big").decode()
- text = n.to_bytes((n.bit_length() + 7) // 8, 'big').decode()
+ return text
- return text
===========changed ref 7===========
# module: app.neuralNetworkMod.nn
class NeuralNetwork:
+
def __init__(self):
self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
self.CATEGORIES = [1, 2, 3, 4, 5, 6]
+ script_dir = os.path.dirname(__file__)
+ file_path = os.path.join(script_dir, "NeuralNetworkModel.model")
+ self.MODEL = load_model(file_path)
+
- self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
-
self.mh = app.mathsHelper.mathsHelper()
===========changed ref 8===========
# module: app.Decryptor.Encoding.hexadecimal
class Hexadecimal:
+
def decrypt(self, text):
try:
result = bytearray.fromhex(text).decode()
except ValueError as e:
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": None,
+ "Extra Information": None,
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
+ }
-
+
if self.lc.checkLanguage(result):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": result,
+ "Cipher": "Ascii to Hexadecimal encoded",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Ascii to Hexadecimal encoded", "Extra Information": None}
===========changed ref 9===========
# module: app.Decryptor.basicEncryption.reverse
class Reverse:
def decrypt(self, message):
message = self.mh.stripPuncuation(message)
message = message[::-1]
result = self.lc.checkLanguage(message)
if result:
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": message,
+ "Cipher": "Reverse",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": message, "Cipher": "Reverse", "Extra Information": None}
else:
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": "Reverse",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Reverse", "Extra Information": None}
===========changed ref 10===========
# module: app.Decryptor.basicEncryption.affine
+
+
class Affine:
+
def decryptMessage(self, key, message):
keyA, keyB = getKeyParts(key)
+ self.checkKeys(keyA, keyB, "decrypt")
- self.checkKeys(keyA, keyB, 'decrypt')
+ plaintext = ""
- plaintext = ''
modInverseOfKeyA = self.mh.findModInverse(keyA, len(SYMBOLS))
+
-
for symbol in message:
if symbol in self.SYMBOLS:
# Decrypt the symbol:
symbolIndex = self.SYMBOLS.find(symbol)
+ plaintext += self.SYMBOLS[
+ (symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)
- plaintext += self.SYMBOLS[(symbolIndex - keyB) * modInverseOfKeyA % len(self.SYMBOLS)]
+ ]
else:
+ plaintext += symbol # Append the symbol without decrypting.
- plaintext += symbol # Append the symbol without decrypting.
+ return plaintext
- return plaintext
|
app.mathsHelper/mathsHelper.getAllLetters | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <1>:<add> letterFreq = {
<add> "a": 0,
<add> "b": 0,
<add> "c": 0,
<add> "d": 0,
<add> "e": 0,
<add> "f": 0,
<add> "g": 0,
<add> "h": 0,
<add> "i": 0,
<add> "j": 0,
<add> "k": 0,
<add> "l": 0,
<add> "m": 0,
<add> "n": 0,
<add> "o": 0,
<add> "p": 0,
<add> "q": 0,
<add> "r": 0,
<add> "s": 0,
<add> "t": 0,
<add> "u": 0,
<add> "v": 0,
<add> "w": 0,
<add> "x": 0,
<add> "y": 0,
<add> "z": 0,
<del> letterFreq = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0, 'f': 0, 'g': 0, 'h': 0, 'i': 0, 'j': 0, 'k': 0, 'l': 0, 'm': 0, 'n': 0, 'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0, 't': 0, 'u': 0, 'v': 0, 'w': 0, 'x': 0, 'y': 0, 'z': 0}
<2>:<add> }
<del>
<3>:<add>
| # module: app.mathsHelper
+
class mathsHelper:
+
def getAllLetters(self, text):
<0> # This part creates a letter frequency of the text
<1> letterFreq = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0, 'f': 0, 'g': 0, 'h': 0, 'i': 0, 'j': 0, 'k': 0, 'l': 0, 'm': 0, 'n': 0, 'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0, 't': 0, 'u': 0, 'v': 0, 'w': 0, 'x': 0, 'y': 0, 'z': 0}
<2>
<3> for letter in text.lower():
<4> if letter in letterFreq:
<5> letterFreq[letter] +=1
<6> else:
<7> # if letter is not puncuation, but it is still ascii
<8> # it's probably a different language so add it to the dict
<9> if letter not in punctuation and self.mh.isAscii(letter) :
<10> letterFreq[letter] = 1
<11> return letterFreq
<12>
| ===========unchanged ref 0===========
at: string
punctuation = r"""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""
===========changed ref 0===========
# module: app.mathsHelper
+
class mathsHelper:
+
def findModInverse(self, a, m):
# Return the modular inverse of a % m, which is
# the number x such that a*x % m = 1
+
-
if gcd(a, m) != 1:
+ return None # No mod inverse exists if a & m aren't relatively prime.
- return None # No mod inverse exists if a & m aren't relatively prime.
+
-
# Calculate using the Extended Euclidean Algorithm:
u1, u2, u3 = 1, 0, a
v1, v2, v3 = 0, 1, m
while v3 != 0:
+ q = u3 // v3 # Note that // is the integer division operator
- q = u3 // v3 # Note that // is the integer division operator
+ v1, v2, v3, u1, u2, u3 = (
+ (u1 - q * v1),
+ (u2 - q * v2),
+ (u3 - q * v3),
+ v1,
+ v2,
+ v3,
+ )
- v1, v2, v3, u1, u2, u3 = (u1 - q * v1), (u2 - q * v2), (u3 - q * v3), v1, v2, v3
return u1 % m
===========changed ref 1===========
+ # module: app.test_dictionary
+
+
===========changed ref 2===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 3===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 4===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 6===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 7===========
# module: app.Decryptor.Encoding.binary
+
class Binary:
+
-
def decode(self, text):
"""
my own binary decoder lol ;p
"""
text = text.replace(" ", "")
# to a bytes string
+ text = text.encode("utf-8")
- text = text.encode('utf-8')
# into base 2
n = int(text, 2)
# into ascii
+ text = n.to_bytes((n.bit_length() + 7) // 8, "big").decode()
- text = n.to_bytes((n.bit_length() + 7) // 8, 'big').decode()
+ return text
- return text
===========changed ref 8===========
# module: app.neuralNetworkMod.nn
class NeuralNetwork:
+
def __init__(self):
self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
self.CATEGORIES = [1, 2, 3, 4, 5, 6]
+ script_dir = os.path.dirname(__file__)
+ file_path = os.path.join(script_dir, "NeuralNetworkModel.model")
+ self.MODEL = load_model(file_path)
+
- self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
-
self.mh = app.mathsHelper.mathsHelper()
===========changed ref 9===========
# module: app.Decryptor.Encoding.hexadecimal
class Hexadecimal:
+
def decrypt(self, text):
try:
result = bytearray.fromhex(text).decode()
except ValueError as e:
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": None,
+ "Extra Information": None,
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
+ }
-
+
if self.lc.checkLanguage(result):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": result,
+ "Cipher": "Ascii to Hexadecimal encoded",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Ascii to Hexadecimal encoded", "Extra Information": None}
===========changed ref 10===========
# module: app.Decryptor.basicEncryption.reverse
class Reverse:
def decrypt(self, message):
message = self.mh.stripPuncuation(message)
message = message[::-1]
result = self.lc.checkLanguage(message)
if result:
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": message,
+ "Cipher": "Reverse",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": message, "Cipher": "Reverse", "Extra Information": None}
else:
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": "Reverse",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Reverse", "Extra Information": None}
|
app.mathsHelper/mathsHelper.getLetterCount | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <2>:<add> letterCount = {
<add> "A": 0,
<add> "B": 0,
<add> "C": 0,
<add> "D": 0,
<add> "E": 0,
<add> "F": 0,
<add> "G": 0,
<add> "H": 0,
<add> "I": 0,
<add> "J": 0,
<add> "K": 0,
<add> "L": 0,
<add> "M": 0,
<add> "N": 0,
<add> "O": 0,
<add> "P": 0,
<add> "Q": 0,
<add> "R": 0,
<add> "S": 0,
<add> "T": 0,
<add> "U": 0,
<add> "V": 0,
<add> "W": 0,
<add> "X": 0,
<add> "Y": 0,
<add> "Z": 0,
<add> }
<add>
<del> letterCount = {'A': 0, 'B': 0, 'C': 0, 'D': 0, 'E': 0, 'F': 0, 'G': 0, 'H': 0, 'I': 0, 'J': 0, 'K': 0, 'L': 0, 'M': 0, 'N': 0, 'O': 0, 'P': 0, 'Q': 0, 'R': 0, 'S': 0, 'T': 0, 'U': 0, 'V': 0, 'W': 0, 'X': 0, 'Y': 0, 'Z': 0}
<3>:<del>
| # module: app.mathsHelper
+
class mathsHelper:
def getLetterCount(self, message):
<0> # Returns a dictionary with keys of single letters and values of the
<1> # count of how many times they appear in the message parameter:
<2> letterCount = {'A': 0, 'B': 0, 'C': 0, 'D': 0, 'E': 0, 'F': 0, 'G': 0, 'H': 0, 'I': 0, 'J': 0, 'K': 0, 'L': 0, 'M': 0, 'N': 0, 'O': 0, 'P': 0, 'Q': 0, 'R': 0, 'S': 0, 'T': 0, 'U': 0, 'V': 0, 'W': 0, 'X': 0, 'Y': 0, 'Z': 0}
<3>
<4> for letter in message.upper():
<5> if letter in self.LETTERS:
<6> letterCount[letter] += 1
<7>
<8> return letterCount
<9>
| ===========unchanged ref 0===========
at: app.mathsHelper.mathsHelper.__init__
self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
===========changed ref 0===========
# module: app.mathsHelper
+
class mathsHelper:
+
def findModInverse(self, a, m):
# Return the modular inverse of a % m, which is
# the number x such that a*x % m = 1
+
-
if gcd(a, m) != 1:
+ return None # No mod inverse exists if a & m aren't relatively prime.
- return None # No mod inverse exists if a & m aren't relatively prime.
+
-
# Calculate using the Extended Euclidean Algorithm:
u1, u2, u3 = 1, 0, a
v1, v2, v3 = 0, 1, m
while v3 != 0:
+ q = u3 // v3 # Note that // is the integer division operator
- q = u3 // v3 # Note that // is the integer division operator
+ v1, v2, v3, u1, u2, u3 = (
+ (u1 - q * v1),
+ (u2 - q * v2),
+ (u3 - q * v3),
+ v1,
+ v2,
+ v3,
+ )
- v1, v2, v3, u1, u2, u3 = (u1 - q * v1), (u2 - q * v2), (u3 - q * v3), v1, v2, v3
return u1 % m
===========changed ref 1===========
# module: app.mathsHelper
+
class mathsHelper:
+
def getAllLetters(self, text):
# This part creates a letter frequency of the text
+ letterFreq = {
+ "a": 0,
+ "b": 0,
+ "c": 0,
+ "d": 0,
+ "e": 0,
+ "f": 0,
+ "g": 0,
+ "h": 0,
+ "i": 0,
+ "j": 0,
+ "k": 0,
+ "l": 0,
+ "m": 0,
+ "n": 0,
+ "o": 0,
+ "p": 0,
+ "q": 0,
+ "r": 0,
+ "s": 0,
+ "t": 0,
+ "u": 0,
+ "v": 0,
+ "w": 0,
+ "x": 0,
+ "y": 0,
+ "z": 0,
- letterFreq = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0, 'f': 0, 'g': 0, 'h': 0, 'i': 0, 'j': 0, 'k': 0, 'l': 0, 'm': 0, 'n': 0, 'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0, 't': 0, 'u': 0, 'v': 0, 'w': 0, 'x': 0, 'y': 0, 'z': 0}
+ }
-
+
for letter in text.lower():
if letter in letterFreq:
+ letterFreq[letter] += 1
- letterFreq[letter] +=1
else:
# if letter is not puncuation, but it is still ascii
# it's probably a different language so add</s>
===========changed ref 2===========
# module: app.mathsHelper
+
class mathsHelper:
+
def getAllLetters(self, text):
# offset: 1
<s>:
# if letter is not puncuation, but it is still ascii
# it's probably a different language so add it to the dict
+ if letter not in punctuation and self.mh.isAscii(letter):
- if letter not in punctuation and self.mh.isAscii(letter) :
letterFreq[letter] = 1
return letterFreq
===========changed ref 3===========
+ # module: app.test_dictionary
+
+
===========changed ref 4===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 6===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 7===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 8===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 9===========
# module: app.Decryptor.Encoding.binary
+
class Binary:
+
-
def decode(self, text):
"""
my own binary decoder lol ;p
"""
text = text.replace(" ", "")
# to a bytes string
+ text = text.encode("utf-8")
- text = text.encode('utf-8')
# into base 2
n = int(text, 2)
# into ascii
+ text = n.to_bytes((n.bit_length() + 7) // 8, "big").decode()
- text = n.to_bytes((n.bit_length() + 7) // 8, 'big').decode()
+ return text
- return text
===========changed ref 10===========
# module: app.neuralNetworkMod.nn
class NeuralNetwork:
+
def __init__(self):
self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
self.CATEGORIES = [1, 2, 3, 4, 5, 6]
+ script_dir = os.path.dirname(__file__)
+ file_path = os.path.join(script_dir, "NeuralNetworkModel.model")
+ self.MODEL = load_model(file_path)
+
- self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
-
self.mh = app.mathsHelper.mathsHelper()
|
app.mathsHelper/mathsHelper.getFrequencyOrder | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <2>:<add>
<del>
<5>:<add>
<del>
<14>:<add>
<del>
<19>:<add> freqToLetter[freq] = "".join(freqToLetter[freq])
<del> freqToLetter[freq] = ''.join(freqToLetter[freq])
<20>:<add>
<del>
<25>:<add>
<del>
<31>:<add>
<del>
<32>:<add> return "".join(freqOrder)
<del> return ''.join(freqOrder)
| # module: app.mathsHelper
+
class mathsHelper:
-
-
+
def getFrequencyOrder(self, message):
<0> # Returns a string of the alphabet letters arranged in order of most
<1> # frequently occurring in the message parameter.
<2>
<3> # First, get a dictionary of each letter and its frequency count:
<4> letterToFreq = self.getLetterCount(message)
<5>
<6> # Second, make a dictionary of each frequency count to each letter(s)
<7> # with that frequency:
<8> freqToLetter = {}
<9> for letter in self.LETTERS:
<10> if letterToFreq[letter] not in freqToLetter:
<11> freqToLetter[letterToFreq[letter]] = [letter]
<12> else:
<13> freqToLetter[letterToFreq[letter]].append(letter)
<14>
<15> # Third, put each list of letters in reverse "self.self.ETAOIN" order, and then
<16> # convert it to a string:
<17> for freq in freqToLetter:
<18> freqToLetter[freq].sort(key=self.ETAOIN.find, reverse=True)
<19> freqToLetter[freq] = ''.join(freqToLetter[freq])
<20>
<21> # Fourth, convert the freqToLetter dictionary to a list of
<22> # tuple pairs (key, value), then sort them:
<23> freqPairs = list(freqToLetter.items())
<24> freqPairs.sort(key=self.getItemAtIndexZero, reverse=True)
<25>
<26> # Fifth, now that the letters are ordered by frequency, extract all
<27> # the letters for the final string:
<28> freqOrder = []
<29> for freqPair in freqPairs:
<30> freqOrder.append(freqPair[1])
<31>
<32> return ''.join(freqOrder)
<33>
| ===========unchanged ref 0===========
at: app.mathsHelper.mathsHelper
getLetterCount(self, message)
getLetterCount(message)
getItemAtIndexZero(items)
at: app.mathsHelper.mathsHelper.__init__
self.ETAOIN = 'ETAOINSHRDLCUMWFGYPBVKJXQZ'
self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
===========changed ref 0===========
# module: app.mathsHelper
+
class mathsHelper:
def getLetterCount(self, message):
# Returns a dictionary with keys of single letters and values of the
# count of how many times they appear in the message parameter:
+ letterCount = {
+ "A": 0,
+ "B": 0,
+ "C": 0,
+ "D": 0,
+ "E": 0,
+ "F": 0,
+ "G": 0,
+ "H": 0,
+ "I": 0,
+ "J": 0,
+ "K": 0,
+ "L": 0,
+ "M": 0,
+ "N": 0,
+ "O": 0,
+ "P": 0,
+ "Q": 0,
+ "R": 0,
+ "S": 0,
+ "T": 0,
+ "U": 0,
+ "V": 0,
+ "W": 0,
+ "X": 0,
+ "Y": 0,
+ "Z": 0,
+ }
+
- letterCount = {'A': 0, 'B': 0, 'C': 0, 'D': 0, 'E': 0, 'F': 0, 'G': 0, 'H': 0, 'I': 0, 'J': 0, 'K': 0, 'L': 0, 'M': 0, 'N': 0, 'O': 0, 'P': 0, 'Q': 0, 'R': 0, 'S': 0, 'T': 0, 'U': 0, 'V': 0, 'W': 0, 'X': 0, 'Y': 0, 'Z': 0}
-
for letter in message.upper():
if letter in self.LETTERS:
letterCount[letter] += 1
+
-
return letterCount
===========changed ref 1===========
# module: app.mathsHelper
+
class mathsHelper:
+
def findModInverse(self, a, m):
# Return the modular inverse of a % m, which is
# the number x such that a*x % m = 1
+
-
if gcd(a, m) != 1:
+ return None # No mod inverse exists if a & m aren't relatively prime.
- return None # No mod inverse exists if a & m aren't relatively prime.
+
-
# Calculate using the Extended Euclidean Algorithm:
u1, u2, u3 = 1, 0, a
v1, v2, v3 = 0, 1, m
while v3 != 0:
+ q = u3 // v3 # Note that // is the integer division operator
- q = u3 // v3 # Note that // is the integer division operator
+ v1, v2, v3, u1, u2, u3 = (
+ (u1 - q * v1),
+ (u2 - q * v2),
+ (u3 - q * v3),
+ v1,
+ v2,
+ v3,
+ )
- v1, v2, v3, u1, u2, u3 = (u1 - q * v1), (u2 - q * v2), (u3 - q * v3), v1, v2, v3
return u1 % m
===========changed ref 2===========
# module: app.mathsHelper
+
class mathsHelper:
+
def getAllLetters(self, text):
# This part creates a letter frequency of the text
+ letterFreq = {
+ "a": 0,
+ "b": 0,
+ "c": 0,
+ "d": 0,
+ "e": 0,
+ "f": 0,
+ "g": 0,
+ "h": 0,
+ "i": 0,
+ "j": 0,
+ "k": 0,
+ "l": 0,
+ "m": 0,
+ "n": 0,
+ "o": 0,
+ "p": 0,
+ "q": 0,
+ "r": 0,
+ "s": 0,
+ "t": 0,
+ "u": 0,
+ "v": 0,
+ "w": 0,
+ "x": 0,
+ "y": 0,
+ "z": 0,
- letterFreq = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0, 'f': 0, 'g': 0, 'h': 0, 'i': 0, 'j': 0, 'k': 0, 'l': 0, 'm': 0, 'n': 0, 'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0, 't': 0, 'u': 0, 'v': 0, 'w': 0, 'x': 0, 'y': 0, 'z': 0}
+ }
-
+
for letter in text.lower():
if letter in letterFreq:
+ letterFreq[letter] += 1
- letterFreq[letter] +=1
else:
# if letter is not puncuation, but it is still ascii
# it's probably a different language so add</s>
===========changed ref 3===========
# module: app.mathsHelper
+
class mathsHelper:
+
def getAllLetters(self, text):
# offset: 1
<s>:
# if letter is not puncuation, but it is still ascii
# it's probably a different language so add it to the dict
+ if letter not in punctuation and self.mh.isAscii(letter):
- if letter not in punctuation and self.mh.isAscii(letter) :
letterFreq[letter] = 1
return letterFreq
===========changed ref 4===========
+ # module: app.test_dictionary
+
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 6===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 7===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+ |
app.mathsHelper/mathsHelper.englishFreqMatchScore | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <6>:<add>
<del>
<16>:<add>
<del>
<17>:<add> return matchScore
<del> return matchScore
| # module: app.mathsHelper
+
class mathsHelper:
-
-
+
def englishFreqMatchScore(self, message):
<0> # Return the number of matches that the string in the message
<1> # parameter has when its letter frequency is compared to English
<2> # letter frequency. A "match" is how many of its six most frequent
<3> # and six least frequent letters is among the six most frequent and
<4> # six least frequent letters for English.
<5> freqOrder = self.getFrequencyOrder(message)
<6>
<7> matchScore = 0
<8> # Find how many matches for the six most common letters there are:
<9> for commonLetter in self.ETAOIN[:6]:
<10> if commonLetter in freqOrder[:6]:
<11> matchScore += 1
<12> # Find how many matches for the six least common letters there are:
<13> for uncommonLetter in self.ETAOIN[-6:]:
<14> if uncommonLetter in freqOrder[-6:]:
<15> matchScore += 1
<16>
<17> return matchScore
<18>
| ===========unchanged ref 0===========
at: app.mathsHelper.mathsHelper
getFrequencyOrder(self, message)
getFrequencyOrder(message)
at: app.mathsHelper.mathsHelper.__init__
self.ETAOIN = 'ETAOINSHRDLCUMWFGYPBVKJXQZ'
===========changed ref 0===========
# module: app.mathsHelper
+
class mathsHelper:
-
-
+
def getFrequencyOrder(self, message):
# Returns a string of the alphabet letters arranged in order of most
# frequently occurring in the message parameter.
+
-
# First, get a dictionary of each letter and its frequency count:
letterToFreq = self.getLetterCount(message)
+
-
# Second, make a dictionary of each frequency count to each letter(s)
# with that frequency:
freqToLetter = {}
for letter in self.LETTERS:
if letterToFreq[letter] not in freqToLetter:
freqToLetter[letterToFreq[letter]] = [letter]
else:
freqToLetter[letterToFreq[letter]].append(letter)
+
-
# Third, put each list of letters in reverse "self.self.ETAOIN" order, and then
# convert it to a string:
for freq in freqToLetter:
freqToLetter[freq].sort(key=self.ETAOIN.find, reverse=True)
+ freqToLetter[freq] = "".join(freqToLetter[freq])
- freqToLetter[freq] = ''.join(freqToLetter[freq])
+
-
# Fourth, convert the freqToLetter dictionary to a list of
# tuple pairs (key, value), then sort them:
freqPairs = list(freqToLetter.items())
freqPairs.sort(key=self.getItemAtIndexZero, reverse=True)
+
-
# Fifth, now that the letters are ordered by frequency, extract all
# the letters for the final string:
freqOrder = []
for freqPair in freqPairs:
freqOrder.append(freqPair[1])
+
-
+ return "".join(freqOrder)
- return ''.join(freqOrder)
===========changed ref 1===========
# module: app.mathsHelper
+
class mathsHelper:
-
-
+
def getFrequencyOrder(self, message):
# offset: 1
<s>
+
-
+ return "".join(freqOrder)
- return ''.join(freqOrder)
===========changed ref 2===========
# module: app.mathsHelper
+
class mathsHelper:
+
def findModInverse(self, a, m):
# Return the modular inverse of a % m, which is
# the number x such that a*x % m = 1
+
-
if gcd(a, m) != 1:
+ return None # No mod inverse exists if a & m aren't relatively prime.
- return None # No mod inverse exists if a & m aren't relatively prime.
+
-
# Calculate using the Extended Euclidean Algorithm:
u1, u2, u3 = 1, 0, a
v1, v2, v3 = 0, 1, m
while v3 != 0:
+ q = u3 // v3 # Note that // is the integer division operator
- q = u3 // v3 # Note that // is the integer division operator
+ v1, v2, v3, u1, u2, u3 = (
+ (u1 - q * v1),
+ (u2 - q * v2),
+ (u3 - q * v3),
+ v1,
+ v2,
+ v3,
+ )
- v1, v2, v3, u1, u2, u3 = (u1 - q * v1), (u2 - q * v2), (u3 - q * v3), v1, v2, v3
return u1 % m
===========changed ref 3===========
# module: app.mathsHelper
+
class mathsHelper:
def getLetterCount(self, message):
# Returns a dictionary with keys of single letters and values of the
# count of how many times they appear in the message parameter:
+ letterCount = {
+ "A": 0,
+ "B": 0,
+ "C": 0,
+ "D": 0,
+ "E": 0,
+ "F": 0,
+ "G": 0,
+ "H": 0,
+ "I": 0,
+ "J": 0,
+ "K": 0,
+ "L": 0,
+ "M": 0,
+ "N": 0,
+ "O": 0,
+ "P": 0,
+ "Q": 0,
+ "R": 0,
+ "S": 0,
+ "T": 0,
+ "U": 0,
+ "V": 0,
+ "W": 0,
+ "X": 0,
+ "Y": 0,
+ "Z": 0,
+ }
+
- letterCount = {'A': 0, 'B': 0, 'C': 0, 'D': 0, 'E': 0, 'F': 0, 'G': 0, 'H': 0, 'I': 0, 'J': 0, 'K': 0, 'L': 0, 'M': 0, 'N': 0, 'O': 0, 'P': 0, 'Q': 0, 'R': 0, 'S': 0, 'T': 0, 'U': 0, 'V': 0, 'W': 0, 'X': 0, 'Y': 0, 'Z': 0}
-
for letter in message.upper():
if letter in self.LETTERS:
letterCount[letter] += 1
+
-
return letterCount
|
app.Decryptor.basicEncryption.basic_parent/BasicParent.decrypt | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <1>:<add> from multiprocessing.dummy import Pool as ThreadPool
<del> from multiprocessing.dummy import Pool as ThreadPool
<2>:<add>
<add> pool = ThreadPool(4)
<del> pool = ThreadPool(4)
<13>:<add>
<del>
<14>:<add> # so viginere runs ages
<del> # so viginere runs ages
<20>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": False,
<add> "Plaintext": None,
<add> "Cipher": None,
<add> "Extra Information": None,
<add> }
<del> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
| # module: app.Decryptor.basicEncryption.basic_parent
+
class BasicParent:
def decrypt(self, text):
<0> self.text = text
<1> from multiprocessing.dummy import Pool as ThreadPool
<2> pool = ThreadPool(4)
<3> answers = pool.map(self.callDecrypt, self.list_of_objects)
<4>
<5> """for item in self.list_of_objects:
<6> result = item.decrypt(text)
<7> answers.append(result)"""
<8> for answer in answers:
<9> # adds the LC objects together
<10> self.lc = self.lc + answer["lc"]
<11> if answer["IsPlaintext?"]:
<12> return answer
<13>
<14> # so viginere runs ages
<15> # and you cant kill threads in a pool
<16> # so i just run it last lol
<17> result = self.callDecrypt(self.viginere)
<18> if result["IsPlaintext?"]:
<19> return result
<20> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None}
<21>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.basic_parent.BasicParent
callDecrypt(obj)
at: app.Decryptor.basicEncryption.basic_parent.BasicParent.__init__
self.lc = lc
self.viginere = Decryptor.basicEncryption.viginere.Viginere(self.lc)
self.list_of_objects = [self.caesar, self.reverse, self.pig]
at: multiprocessing.dummy
Pool(processes: Optional[int]=..., initializer: Optional[Callable[..., Any]]=..., initargs: Iterable[Any]=...) -> Any
===========changed ref 0===========
+ # module: app.test_encoding
+
+
===========changed ref 1===========
+ # module: app.test_dictionary
+
+
===========changed ref 2===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 3===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_english_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("eW91ciB0ZXh0")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 4===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 6===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 7===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 8===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_ascii(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ a = "68 65 6C 6C 6F 20 64 6F 67"
+ result = ep.decrypt(a)
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 9===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_base64_spaces_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("SGVsbG8gSSBsaWtlIGRvZ3MgYW5kIGNhdHM=")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 10===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_morse(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ a = ".... . .-.. .-.. --- / -- -.-- / -. .- -- . / .. ... / -... .-. .- -. -.. --- -."
+ result = ep.decrypt(a)
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 11===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_hex_spaces_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ a = "68656c6c6f206f 6c 69 76 69 61 20 69 20 72 65 61 6c 6c 79 20 6c 69 6b 65 20 79 6f 75 72 20 64 6f 67"
+ a = a.replace(" ", "")
+ result = ep.decrypt(a)
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 12===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_binary_spaces_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt(
+ "01001000 01100101 01101100 01101100 01101111 00100000 01001001 00100000 01101100 01101001 01101011 01100101 00100000 01100100 01101111 01100111 01110011 00100000 01100001 01101110 01100100 00100000 01100011 01100001 01110100 01110011"
+ )
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 13===========
# module: app.Decryptor.Encoding.binary
+
class Binary:
+
-
def decode(self, text):
"""
my own binary decoder lol ;p
"""
text = text.replace(" ", "")
# to a bytes string
+ text = text.encode("utf-8")
- text = text.encode('utf-8')
# into base 2
n = int(text, 2)
# into ascii
+ text = n.to_bytes((n.bit_length() + 7) // 8, "big").decode()
- text = n.to_bytes((n.bit_length() + 7) // 8, 'big').decode()
+ return text
- return text
===========changed ref 14===========
# module: app.neuralNetworkMod.nn
class NeuralNetwork:
+
def __init__(self):
self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
self.CATEGORIES = [1, 2, 3, 4, 5, 6]
+ script_dir = os.path.dirname(__file__)
+ file_path = os.path.join(script_dir, "NeuralNetworkModel.model")
+ self.MODEL = load_model(file_path)
+
- self.MODEL = load_model("app/neuralNetworkMod/NeuralNetworkModel.model")
-
self.mh = app.mathsHelper.mathsHelper()
|
app.__main__/Ciphey.__init__ | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <0>:<add> # general purpose modules
<del> # general purpose modules
| # module: app.__main__
+
class Ciphey:
def __init__(self, text, cipher):
<0> # general purpose modules
<1> self.ai = NeuralNetwork()
<2> self.lc = LanguageChecker.LanguageChecker()
<3> self.mh = mathsHelper.mathsHelper()
<4>
<5> # the one bit of text given to us to decrypt
<6> self.text = text
<7>
<8> # the decryptor components
<9> self.basic = BasicParent(self.lc)
<10> self.hash = HashParent()
<11> self.encoding = EncodingParent(self.lc)
<12>
<13> self.level = 1
<14> self.sickomode = False
<15> self.cipher = cipher
<16>
| ===========unchanged ref 0===========
at: Decryptor.Encoding.encodingParent
EncodingParent(lc)
at: Decryptor.Hash.hashParent
HashParent()
at: Decryptor.basicEncryption.basic_parent
BasicParent(lc)
at: languageCheckerMod.LanguageChecker
LanguageChecker()
at: mathsHelper
mathsHelper()
at: neuralNetworkMod.nn
NeuralNetwork()
===========changed ref 0===========
+ # module: app.test_neuralNetwork
+
+
===========changed ref 1===========
+ # module: app.test_encoding
+
+
===========changed ref 2===========
+ # module: app.test_dictionary
+
+
===========changed ref 3===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 4===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_english_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("eW91ciB0ZXh0")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 6===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 7===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 8===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 9===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_ascii(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ a = "68 65 6C 6C 6F 20 64 6F 67"
+ result = ep.decrypt(a)
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 10===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_base64_spaces_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("SGVsbG8gSSBsaWtlIGRvZ3MgYW5kIGNhdHM=")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 11===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_md5_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("5d41402abc4b2a76b9719d911017c592")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 1)
+
===========changed ref 12===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_caesar_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("bcpvu up qvu ifs cpplt bxbz, cvu jotufbe tif qvmmfe")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 4)
+
===========changed ref 13===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_sha1_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("6D32263A85C7846D70439026B75758C9FC31A9B7")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 0)
+
===========changed ref 14===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_morse(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ a = ".... . .-.. .-.. --- / -- -.-- / -. .- -- . / .. ... / -... .-. .- -. -.. --- -."
+ result = ep.decrypt(a)
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 15===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_english_yes(self):
+ """Checks to see if it returns True (it should)"""
+ model = NeuralNetwork()
+ result = model.predictnn("bcpvu up qvu ifs cpplt bxbz, cvu jotufbe tif qvmmfe")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 4)
+
===========changed ref 16===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_hex_spaces_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ a = "68656c6c6f206f 6c 69 76 69 61 20 69 20 72 65 61 6c 6c 79 20 6c 69 6b 65 20 79 6f 75 72 20 64 6f 67"
+ a = a.replace(" ", "")
+ result = ep.decrypt(a)
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 17===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_sha512_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn(
+ "9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043"
+ )
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 3)
+ |
app.__main__/Ciphey.one_level_of_decryption | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <5>:<add> if ret["IsPlaintext?"]:
<del> if ret['IsPlaintext?']:
<6>:<add> print(ret["Plaintext"])
<del> print(ret['Plaintext'])
<8>:<add> if ret["Extra Information"] != None:
<del> if ret['Extra Information'] != None:
<9>:<add> print(
<add> "The cipher used is",
<add> ret["Cipher"] + ".",
<add> ret["Extra Information"] + ".",
<add> )
<del> print("The cipher used is", ret['Cipher'] + ".", ret['Extra Information'] + ".")
<11>:<add> print(ret["Cipher"])
<del> print(ret['Cipher'])
<16>:<add>
| # module: app.__main__
+
class Ciphey:
def one_level_of_decryption(self, file=None, sickomode=None):
<0> for key, val in self.whatToChoose.items():
<1> # https://stackoverflow.com/questions/4843173/how-to-check-if-type-of-a-variable-is-string
<2> if not isinstance(key, str):
<3> key.setProbTable(val)
<4> ret = key.decrypt(self.text)
<5> if ret['IsPlaintext?']:
<6> print(ret['Plaintext'])
<7> if self.cipher:
<8> if ret['Extra Information'] != None:
<9> print("The cipher used is", ret['Cipher'] + ".", ret['Extra Information'] + ".")
<10> else:
<11> print(ret['Cipher'])
<12>
<13> return ret
<14> print("No encryption found. Here's the probabilities we calculated")
<15> import pprint
<16> pprint.pprint(self.whatToChoose)
<17>
| ===========unchanged ref 0===========
at: Decryptor.Encoding.encodingParent.EncodingParent
setProbTable(table)
decrypt(text)
at: Decryptor.Hash.hashParent.HashParent
decrypt(text)
setProbTable(val)
at: Decryptor.basicEncryption.basic_parent.BasicParent
decrypt(text)
setProbTable(prob)
at: app.__main__.Ciphey.__init__
self.text = text
self.cipher = cipher
at: app.__main__.Ciphey.decrypt
self.whatToChoose = new_dict
self.whatToChoose = {self.hash:
{
"sha1": self.probabilityDistribution[0],
"md5": self.probabilityDistribution[1],
"sha256": self.probabilityDistribution[2],
"sha512": self.probabilityDistribution[3]
},
self.basic: {
"caesar": self.probabilityDistribution[4]
},
"plaintext": {
"plaintext": self.probabilityDistribution[5]
},
self.encoding:{
"reverse": self.probabilityDistribution[6],
"base64": self.probabilityDistribution[7],
"binary": self.probabilityDistribution[8],
"hexadecimal": self.probabilityDistribution[9],
"ascii": self.probabilityDistribution[10],
"morse": self.probabilityDistribution[11]
}
}
at: collections.OrderedDict
update = __update = _collections_abc.MutableMapping.update
update = __update = _collections_abc.MutableMapping.update
items() -> _OrderedDictItemsView[_KT, _VT]
__ne__ = _collections_abc.MutableMapping.__ne__
__marker = object()
at: pprint
pprint(object: object, stream: Optional[IO[str]]=..., indent: int=..., width: int=..., depth: Optional[int]=..., *, compact: bool=...) -> None
===========changed ref 0===========
# module: app.__main__
+
class Ciphey:
def __init__(self, text, cipher):
+ # general purpose modules
- # general purpose modules
self.ai = NeuralNetwork()
self.lc = LanguageChecker.LanguageChecker()
self.mh = mathsHelper.mathsHelper()
# the one bit of text given to us to decrypt
self.text = text
# the decryptor components
self.basic = BasicParent(self.lc)
self.hash = HashParent()
self.encoding = EncodingParent(self.lc)
self.level = 1
self.sickomode = False
self.cipher = cipher
===========changed ref 1===========
+ # module: app.test_neuralNetwork
+
+
===========changed ref 2===========
+ # module: app.test_encoding
+
+
===========changed ref 3===========
+ # module: app.test_dictionary
+
+
===========changed ref 4===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 5===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_english_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("eW91ciB0ZXh0")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 6===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 7===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 8===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 9===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 10===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_ascii(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ a = "68 65 6C 6C 6F 20 64 6F 67"
+ result = ep.decrypt(a)
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 11===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_base64_spaces_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("SGVsbG8gSSBsaWtlIGRvZ3MgYW5kIGNhdHM=")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 12===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_md5_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("5d41402abc4b2a76b9719d911017c592")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 1)
+
===========changed ref 13===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_caesar_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("bcpvu up qvu ifs cpplt bxbz, cvu jotufbe tif qvmmfe")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 4)
+
===========changed ref 14===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_sha1_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("6D32263A85C7846D70439026B75758C9FC31A9B7")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 0)
+ |
app.languageCheckerMod.dictionaryChecker/dictionaryChecker.checkDictionary | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <7>:<add> text = list(set(text)) # removes duplicate words
<del> text = list(set(text)) # removes duplicate words
<11>:<add>
<add> # https://stackoverflow.com/questions/7165749/open-file-in-a-relative-location-in-python
<add> script_dir = os.path.dirname(__file__)
<add> file_path = os.path.join(script_dir, "English.txt")
<add> file = open(file_path, "r")
<del> file = open("app/languageCheckerMod/English.txt", "r")
| # module: app.languageCheckerMod.dictionaryChecker
+
+
class dictionaryChecker:
def checkDictionary(self, text, language):
<0> """Compares a word with
<1> The dictionary is sorted and the text is sorted"""
<2> # reads through most common words / passwords
<3> # and calculates how much of that is in language
<4> text = text.lower()
<5> text = self.mh.stripPuncuation(text)
<6> text = text.split(" ")
<7> text = list(set(text)) # removes duplicate words
<8> text.sort()
<9> # can dynamically use languages then
<10> language = str(language) + ".txt"
<11> file = open("app/languageCheckerMod/English.txt", "r")
<12> f = file.readlines()
<13> file.close()
<14> f = [x.strip().lower() for x in f]
<15> # dictionary is "word\n" so I remove the "\n"
<16>
<17> # so this should loop until it gets to the point in the @staticmethod
<18> # that equals the word :)
<19>
<20> """
<21> for every single word in main dictionary
<22> if that word == text[0] then +1 to counter
<23> then +1 to text[0 + i]
<24> so say the dict is ordered
<25> we just loop through dict
<26> and eventually we'll reach a point where word in dict = word in text
<27> at that point, we move to the next text point
<28> both text and dict are sorted
<29> so we only loop once, we can do this in O(n log n) time
<30> """
<31> counter = 0
<32> counter_percent = 0
<33>
<34> for dictLengthCounter, word in enumerate(f):
<35> # if there is more words counted than there is text
<36> # it is 100%, sometimes it goes over
<37> # so this stops that
<38> if counter >= len(text):
<39> break</s> | ===========below chunk 0===========
# module: app.languageCheckerMod.dictionaryChecker
+
+
class dictionaryChecker:
def checkDictionary(self, text, language):
# offset: 1
# if the dictionary word is contained in the text somewhere
# counter + 1
if word in text:
counter = counter + 1
counter_percent = counter_percent + 1
self.languageWordsCounter = counter
self.languagePercentage = self.mh.percentage(float(self.languageWordsCounter), float(len(text)))
return counter
===========unchanged ref 0===========
at: app.languageCheckerMod.dictionaryChecker.dictionaryChecker.checkDictionary
self.languageWordsCounter = counter
self.languagePercentage = self.mh.percentage(
float(self.languageWordsCounter), float(len(text))
)
at: app.mathsHelper
mathsHelper()
===========changed ref 0===========
+ # module: app.test_neuralNetwork
+
+
===========changed ref 1===========
+ # module: app.test_encoding
+
+
===========changed ref 2===========
+ # module: app.test_dictionary
+
+
===========changed ref 3===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 4===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_english_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("eW91ciB0ZXh0")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 6===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 7===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 8===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 9===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_ascii(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ a = "68 65 6C 6C 6F 20 64 6F 67"
+ result = ep.decrypt(a)
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 10===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_base64_spaces_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("SGVsbG8gSSBsaWtlIGRvZ3MgYW5kIGNhdHM=")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 11===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_md5_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("5d41402abc4b2a76b9719d911017c592")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 1)
+
===========changed ref 12===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_caesar_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("bcpvu up qvu ifs cpplt bxbz, cvu jotufbe tif qvmmfe")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 4)
+
===========changed ref 13===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_sha1_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("6D32263A85C7846D70439026B75758C9FC31A9B7")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 0)
+
===========changed ref 14===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_morse(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ a = ".... . .-.. .-.. --- / -- -.-- / -. .- -- . / .. ... / -... .-. .- -. -.. --- -."
+ result = ep.decrypt(a)
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 15===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_english_yes(self):
+ """Checks to see if it returns True (it should)"""
+ model = NeuralNetwork()
+ result = model.predictnn("bcpvu up qvu ifs cpplt bxbz, cvu jotufbe tif qvmmfe")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 4)
+
===========changed ref 16===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_hex_spaces_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ a = "68656c6c6f206f 6c 69 76 69 61 20 69 20 72 65 61 6c 6c 79 20 6c 69 6b 65 20 79 6f 75 72 20 64 6f 67"
+ a = a.replace(" ", "")
+ result = ep.decrypt(a)
+ self.assertEqual(result["IsPlaintext?"], True)
+ |
app.Decryptor.basicEncryption.caesar/Caesar.decrypt | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <5>:<add> SYMBOLS = "abcdefghijklmnopqrstuvwxyz"
<del> SYMBOLS = 'abcdefghijklmnopqrstuvwxyz'
<29>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": True,
<add> "Plaintext": translated,
<add> "Cipher": "Caesar",
<add> "Extra Information": f"The rotation used is {counter}",
<add> }
<del> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar", "Extra Information": f"The rotation used is {counter}"}
<31>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": False,
<add> "Plaintext": None,
<add> "Cipher": "Caesar",
<add> "Extra Information": None,
<add> }
<del> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Caesar", "Extra Information": None}
| # module: app.Decryptor.basicEncryption.caesar
+
class Caesar:
def decrypt(self, message):
<0> """ Simple python program to bruteforce a caesar cipher"""
<1>
<2> # Example string
<3> message = message.lower()
<4> # Everything we can encrypt
<5> SYMBOLS = 'abcdefghijklmnopqrstuvwxyz'
<6>
<7> for counter, key in enumerate(range(len(SYMBOLS))):
<8> # try again with each key attempt
<9> translated = ""
<10>
<11> for character in message:
<12> if character in SYMBOLS:
<13> symbolIndex = SYMBOLS.find(character)
<14> translatedIndex = symbolIndex - key
<15>
<16> # In the event of wraparound
<17> if translatedIndex < 0:
<18> translatedIndex += len(SYMBOLS)
<19>
<20> translated += SYMBOLS[translatedIndex]
<21>
<22> else:
<23> # Append the symbol without encrypting or decrypting
<24> translated += character
<25>
<26> # Output each attempt
<27> result = self.lc.checkLanguage(translated)
<28> if result:
<29> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar", "Extra Information": f"The rotation used is {counter}"}
<30> # if none of them match English, return false!
<31> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Caesar", "Extra Information": None}
<32>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.caesar.Caesar.__init__
self.lc = lc
===========changed ref 0===========
+ # module: app.test_chi_squared
+
+
===========changed ref 1===========
+ # module: app.test_basicparent
+
+
===========changed ref 2===========
+ # module: app.test_neuralNetwork
+
+
===========changed ref 3===========
+ # module: app.test_encoding
+
+
===========changed ref 4===========
+ # module: app.test_dictionary
+
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 6===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_english_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("eW91ciB0ZXh0")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 7===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 8===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def tests_english_no_words(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("!!!!!!!!!!!!!!!!!!!")
+ self.assertEqual(result, True)
+
===========changed ref 9===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 10===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 11===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 12===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_ascii(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ a = "68 65 6C 6C 6F 20 64 6F 67"
+ result = ep.decrypt(a)
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 13===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_base64_spaces_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("SGVsbG8gSSBsaWtlIGRvZ3MgYW5kIGNhdHM=")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 14===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def test_chi_english_caps(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("Hello My NaME IS BraNdOnnn And I LOVE You!")
+ self.assertEqual(result, True)
+
===========changed ref 15===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_md5_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("5d41402abc4b2a76b9719d911017c592")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 1)
+
===========changed ref 16===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_caesar_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("bcpvu up qvu ifs cpplt bxbz, cvu jotufbe tif qvmmfe")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 4)
+
===========changed ref 17===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_sha1_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("6D32263A85C7846D70439026B75758C9FC31A9B7")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 0)
+
===========changed ref 18===========
+ # module: app.test_basicparent
+ class TestBasicParent(unittest.TestCase):
+ def test_basic_parent_reverse_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ bp = BasicParent(lc)
+ result = bp.decrypt(
+ "tsafkaerb hsilgne doog a ekil od yllaer i dna rehtom ym olleh rehtaf ym olleh"
+ )
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 19===========
+ # module: app.test_basicparent
+ class TestBasicParent(unittest.TestCase):
+ def test_basic_parent_reverse_yes_2(self):
+ lc = LanguageChecker.LanguageChecker()
+ bp = BasicParent(lc)
+ result = bp.decrypt(
+ "sevom ylpmis rac eht ciffart ruoy lla gnillenut si hcihw redivorp NPV a ekilnU"
+ )
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 20===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def test_chi_english_yes(self):
+ """Checks to see if it returns True (it should)"""
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi(
+ "Hello my name is Brandon and I'm a top secret message"
+ )
+ self.assertEqual(result, True)
+ |
app.Decryptor.basicEncryption.viginere/Viginere.__init__ | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <0>:<add> self.LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
<del> self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
<1>:<add> self.SILENT_MODE = True # If set to True, program doesn't print anything.
<del> self.SILENT_MODE = True # If set to True, program doesn't print anything.
<2>:<add> self.NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey.
<del> self.NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey.
<3>:<add> self.MAX_KEY_LENGTH = 16 # Will not attempt keys longer than this.
<del> self.MAX_KEY_LENGTH = 16 # Will not attempt keys longer than this.
<4>:<add> self.NONLETTERS_PATTERN = re.compile("[^A-Z]")
<del> self.NONLETTERS_PATTERN = re.compile('[^A-Z]')
| # module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
def __init__(self, lc):
<0> self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
<1> self.SILENT_MODE = True # If set to True, program doesn't print anything.
<2> self.NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey.
<3> self.MAX_KEY_LENGTH = 16 # Will not attempt keys longer than this.
<4> self.NONLETTERS_PATTERN = re.compile('[^A-Z]')
<5>
<6> self.lc = lc
<7>
| ===========unchanged ref 0===========
at: re
compile(pattern: AnyStr, flags: _FlagsType=...) -> Pattern[AnyStr]
compile(pattern: Pattern[AnyStr], flags: _FlagsType=...) -> Pattern[AnyStr]
===========changed ref 0===========
+ # module: app.test_chi_squared
+
+
===========changed ref 1===========
+ # module: app.test_basicparent
+
+
===========changed ref 2===========
+ # module: app.test_neuralNetwork
+
+
===========changed ref 3===========
+ # module: app.test_encoding
+
+
===========changed ref 4===========
+ # module: app.test_dictionary
+
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 6===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_english_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("eW91ciB0ZXh0")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 7===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 8===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def tests_english_no_words(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("!!!!!!!!!!!!!!!!!!!")
+ self.assertEqual(result, True)
+
===========changed ref 9===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 10===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 11===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 12===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_ascii(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ a = "68 65 6C 6C 6F 20 64 6F 67"
+ result = ep.decrypt(a)
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 13===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_base64_spaces_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("SGVsbG8gSSBsaWtlIGRvZ3MgYW5kIGNhdHM=")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 14===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def test_chi_english_caps(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("Hello My NaME IS BraNdOnnn And I LOVE You!")
+ self.assertEqual(result, True)
+
===========changed ref 15===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_md5_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("5d41402abc4b2a76b9719d911017c592")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 1)
+
===========changed ref 16===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_caesar_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("bcpvu up qvu ifs cpplt bxbz, cvu jotufbe tif qvmmfe")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 4)
+
===========changed ref 17===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_sha1_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("6D32263A85C7846D70439026B75758C9FC31A9B7")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 0)
+
===========changed ref 18===========
+ # module: app.test_basicparent
+ class TestBasicParent(unittest.TestCase):
+ def test_basic_parent_reverse_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ bp = BasicParent(lc)
+ result = bp.decrypt(
+ "tsafkaerb hsilgne doog a ekil od yllaer i dna rehtom ym olleh rehtaf ym olleh"
+ )
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 19===========
+ # module: app.test_basicparent
+ class TestBasicParent(unittest.TestCase):
+ def test_basic_parent_reverse_yes_2(self):
+ lc = LanguageChecker.LanguageChecker()
+ bp = BasicParent(lc)
+ result = bp.decrypt(
+ "sevom ylpmis rac eht ciffart ruoy lla gnillenut si hcihw redivorp NPV a ekilnU"
+ )
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 20===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def test_chi_english_yes(self):
+ """Checks to see if it returns True (it should)"""
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi(
+ "Hello my name is Brandon and I'm a top secret message"
+ )
+ self.assertEqual(result, True)
+ |
app.Decryptor.basicEncryption.viginere/Viginere.main | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | # module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def main(self):
<0> # Instead of typing this ciphertext out, you can copy & paste it
<1> # from https://www.nostarch.com/crackingcodes/.
<2> ciphertext = """Adiz Avtzqeci Tmzubb wsa m Pmilqev halpqavtakuoi, lgouqdaf, kdmktsvmztsl, izr xoexghzr kkusitaaf. Vz wsa twbhdg ubalmmzhdad qz hce vmhsgohuqbo ox kaakulmd gxiwvos, krgdurdny i rcmmstugvtawz ca tzm ocicwxfg jf "stscmilpy" oid "uwydptsbuci" wabt hce Lcdwig eiovdnw. Bgfdny qe kddwtk qjnkqpsmev ba pz tzm roohwz at xoexghzr kkusicw izr vrlqrwxist uboedtuuznum. Pimifo Icmlv Emf DI, Lcdwig owdyzd xwd hce Ywhsmnemzh Xovm mby Cqxtsm Supacg (GUKE) oo Bdmfqclwg Bomk, Tzuhvif'a ocyetzqofifo ositjm. Rcm a lqys ce oie vzav wr Vpt 8, lpq gzclqab mekxabnittq tjr Ymdavn fihog cjgbhvnstkgds. Zm psqikmp o iuejqf jf lmoviiicqg aoj jdsvkavs Uzreiz qdpzmdg, dnutgrdny bts helpar jf lpq pjmtm, mb zlwkffjmwktoiiuix avczqzs ohsb ocplv nuby swbfwigk naf ohw Mzwbms umqcifm. Mtoej bts ra</s> | ===========below chunk 0===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def main(self):
# offset: 1
hackedMessage = self.hackVigenere(ciphertext)
if hackedMessage != None:
print('Copying hacked message to clipboard:')
print(hackedMessage)
else:
print('Failed to hack encryption.')
===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.viginere.Viginere
hackVigenere(self, ciphertext)
hackVigenere(ciphertext)
===========changed ref 0===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
def __init__(self, lc):
+ self.LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ self.SILENT_MODE = True # If set to True, program doesn't print anything.
- self.SILENT_MODE = True # If set to True, program doesn't print anything.
+ self.NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey.
- self.NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey.
+ self.MAX_KEY_LENGTH = 16 # Will not attempt keys longer than this.
- self.MAX_KEY_LENGTH = 16 # Will not attempt keys longer than this.
+ self.NONLETTERS_PATTERN = re.compile("[^A-Z]")
- self.NONLETTERS_PATTERN = re.compile('[^A-Z]')
self.lc = lc
===========changed ref 1===========
+ # module: app.test_chi_squared
+
+
===========changed ref 2===========
+ # module: app.test_basicparent
+
+
===========changed ref 3===========
+ # module: app.test_neuralNetwork
+
+
===========changed ref 4===========
+ # module: app.test_encoding
+
+
===========changed ref 5===========
+ # module: app.test_dictionary
+
+
===========changed ref 6===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 7===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_english_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("eW91ciB0ZXh0")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 8===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 9===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def tests_english_no_words(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("!!!!!!!!!!!!!!!!!!!")
+ self.assertEqual(result, True)
+
===========changed ref 10===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 11===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 12===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 13===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_ascii(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ a = "68 65 6C 6C 6F 20 64 6F 67"
+ result = ep.decrypt(a)
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 14===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_base64_spaces_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("SGVsbG8gSSBsaWtlIGRvZ3MgYW5kIGNhdHM=")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 15===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def test_chi_english_caps(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("Hello My NaME IS BraNdOnnn And I LOVE You!")
+ self.assertEqual(result, True)
+
===========changed ref 16===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_md5_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("5d41402abc4b2a76b9719d911017c592")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 1)
+
===========changed ref 17===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_caesar_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("bcpvu up qvu ifs cpplt bxbz, cvu jotufbe tif qvmmfe")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 4)
+
===========changed ref 18===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_sha1_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("6D32263A85C7846D70439026B75758C9FC31A9B7")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 0)
+ |
|
app.Decryptor.basicEncryption.viginere/Viginere.findRepeatSequencesSpacings | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <5>:<add> message = self.NONLETTERS_PATTERN.sub("", message.upper())
<del> message = self.NONLETTERS_PATTERN.sub('', message.upper())
<8>:<add> seqSpacings = {} # Keys are sequences, values are lists of int spacings.
<del> seqSpacings = {} # Keys are sequences, values are lists of int spacings.
<12>:<add> seq = message[seqStart : seqStart + seqLen]
<del> seq = message[seqStart:seqStart + seqLen]
<16>:<add> if message[i : i + seqLen] == seq:
<del> if message[i:i + seqLen] == seq:
<19>:<add> seqSpacings[seq] = [] # Initialize a blank list.
<del> seqSpacings[seq] = [] # Initialize a blank list.
| # module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def findRepeatSequencesSpacings(self, message):
<0> # Goes through the message and finds any 3 to 5 letter sequences
<1> # that are repeated. Returns a dict with the keys of the sequence and
<2> # values of a list of spacings (num of letters between the repeats).
<3>
<4> # Use a regular expression to remove non-letters from the message:
<5> message = self.NONLETTERS_PATTERN.sub('', message.upper())
<6>
<7> # Compile a list of seqLen-letter sequences found in the message:
<8> seqSpacings = {} # Keys are sequences, values are lists of int spacings.
<9> for seqLen in range(3, 6):
<10> for seqStart in range(len(message) - seqLen):
<11> # Determine what the sequence is, and store it in seq:
<12> seq = message[seqStart:seqStart + seqLen]
<13>
<14> # Look for this sequence in the rest of the message:
<15> for i in range(seqStart + seqLen, len(message) - seqLen):
<16> if message[i:i + seqLen] == seq:
<17> # Found a repeated sequence.
<18> if seq not in seqSpacings:
<19> seqSpacings[seq] = [] # Initialize a blank list.
<20>
<21> # Append the spacing distance between the repeated
<22> # sequence and the original sequence:
<23> seqSpacings[seq].append(i - seqStart)
<24> return seqSpacings
<25>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.viginere.Viginere.__init__
self.NONLETTERS_PATTERN = re.compile('[^A-Z]')
at: typing.Pattern
flags: int
groupindex: Mapping[str, int]
groups: int
pattern: AnyStr
sub(repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int=...) -> AnyStr
sub(repl: AnyStr, string: AnyStr, count: int=...) -> AnyStr
===========changed ref 0===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
def __init__(self, lc):
+ self.LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ self.SILENT_MODE = True # If set to True, program doesn't print anything.
- self.SILENT_MODE = True # If set to True, program doesn't print anything.
+ self.NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey.
- self.NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey.
+ self.MAX_KEY_LENGTH = 16 # Will not attempt keys longer than this.
- self.MAX_KEY_LENGTH = 16 # Will not attempt keys longer than this.
+ self.NONLETTERS_PATTERN = re.compile("[^A-Z]")
- self.NONLETTERS_PATTERN = re.compile('[^A-Z]')
self.lc = lc
===========changed ref 1===========
+ # module: app.test_chi_squared
+
+
===========changed ref 2===========
+ # module: app.test_basicparent
+
+
===========changed ref 3===========
+ # module: app.test_neuralNetwork
+
+
===========changed ref 4===========
+ # module: app.test_encoding
+
+
===========changed ref 5===========
+ # module: app.test_dictionary
+
+
===========changed ref 6===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 7===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_english_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("eW91ciB0ZXh0")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 8===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 9===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def tests_english_no_words(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("!!!!!!!!!!!!!!!!!!!")
+ self.assertEqual(result, True)
+
===========changed ref 10===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 11===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 12===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 13===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_ascii(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ a = "68 65 6C 6C 6F 20 64 6F 67"
+ result = ep.decrypt(a)
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 14===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_base64_spaces_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("SGVsbG8gSSBsaWtlIGRvZ3MgYW5kIGNhdHM=")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 15===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def test_chi_english_caps(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("Hello My NaME IS BraNdOnnn And I LOVE You!")
+ self.assertEqual(result, True)
+
===========changed ref 16===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_md5_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("5d41402abc4b2a76b9719d911017c592")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 1)
+
===========changed ref 17===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_caesar_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("bcpvu up qvu ifs cpplt bxbz, cvu jotufbe tif qvmmfe")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 4)
+
===========changed ref 18===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_sha1_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("6D32263A85C7846D70439026B75758C9FC31A9B7")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 0)
+ |
app.Decryptor.basicEncryption.viginere/Viginere.getUsefulFactors | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <5>:<add> return [] # Numbers less than 2 have no useful factors.
<del> return [] # Numbers less than 2 have no useful factors.
<7>:<add> factors = [] # The list of factors found.
<del> factors = [] # The list of factors found.
<11>:<add> for i in range(2, self.MAX_KEY_LENGTH + 1): # Don't test 1: it's not useful.
<del> for i in range(2, self.MAX_KEY_LENGTH + 1): # Don't test 1: it's not useful.
<17>:<add> return list(set(factors)) # Remove duplicate factors.
<del> return list(set(factors)) # Remove duplicate factors.
| # module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def getUsefulFactors(self, num):
<0> # Returns a list of useful factors of num. By "useful" we mean factors
<1> # less than MAX_KEY_LENGTH + 1 and not 1. For example,
<2> # getUsefulFactors(144) returns [2, 3, 4, 6, 8, 9, 12, 16]
<3>
<4> if num < 2:
<5> return [] # Numbers less than 2 have no useful factors.
<6>
<7> factors = [] # The list of factors found.
<8>
<9> # When finding factors, you only need to check the integers up to
<10> # MAX_KEY_LENGTH.
<11> for i in range(2, self.MAX_KEY_LENGTH + 1): # Don't test 1: it's not useful.
<12> if num % i == 0:
<13> factors.append(i)
<14> otherFactor = int(num / i)
<15> if otherFactor < self.MAX_KEY_LENGTH + 1 and otherFactor != 1:
<16> factors.append(otherFactor)
<17> return list(set(factors)) # Remove duplicate factors.
<18>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.viginere.Viginere.__init__
self.MAX_KEY_LENGTH = 16 # Will not attempt keys longer than this.
===========changed ref 0===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
def __init__(self, lc):
+ self.LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ self.SILENT_MODE = True # If set to True, program doesn't print anything.
- self.SILENT_MODE = True # If set to True, program doesn't print anything.
+ self.NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey.
- self.NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey.
+ self.MAX_KEY_LENGTH = 16 # Will not attempt keys longer than this.
- self.MAX_KEY_LENGTH = 16 # Will not attempt keys longer than this.
+ self.NONLETTERS_PATTERN = re.compile("[^A-Z]")
- self.NONLETTERS_PATTERN = re.compile('[^A-Z]')
self.lc = lc
===========changed ref 1===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def findRepeatSequencesSpacings(self, message):
# Goes through the message and finds any 3 to 5 letter sequences
# that are repeated. Returns a dict with the keys of the sequence and
# values of a list of spacings (num of letters between the repeats).
# Use a regular expression to remove non-letters from the message:
+ message = self.NONLETTERS_PATTERN.sub("", message.upper())
- message = self.NONLETTERS_PATTERN.sub('', message.upper())
# Compile a list of seqLen-letter sequences found in the message:
+ seqSpacings = {} # Keys are sequences, values are lists of int spacings.
- seqSpacings = {} # Keys are sequences, values are lists of int spacings.
for seqLen in range(3, 6):
for seqStart in range(len(message) - seqLen):
# Determine what the sequence is, and store it in seq:
+ seq = message[seqStart : seqStart + seqLen]
- seq = message[seqStart:seqStart + seqLen]
# Look for this sequence in the rest of the message:
for i in range(seqStart + seqLen, len(message) - seqLen):
+ if message[i : i + seqLen] == seq:
- if message[i:i + seqLen] == seq:
# Found a repeated sequence.
if seq not in seqSpacings:
+ seqSpacings[seq] = [] # Initialize a blank list.
- seqSpacings[seq] = [] # Initialize a blank list.
# Append the spacing distance between the repeated
# sequence and the original sequence:
seqSpacings[seq].append(i - seqStart)
return seqSpacings
===========changed ref 2===========
+ # module: app.test_chi_squared
+
+
===========changed ref 3===========
+ # module: app.test_basicparent
+
+
===========changed ref 4===========
+ # module: app.test_neuralNetwork
+
+
===========changed ref 5===========
+ # module: app.test_encoding
+
+
===========changed ref 6===========
+ # module: app.test_dictionary
+
+
===========changed ref 7===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 8===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_english_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("eW91ciB0ZXh0")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 9===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 10===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def tests_english_no_words(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("!!!!!!!!!!!!!!!!!!!")
+ self.assertEqual(result, True)
+
===========changed ref 11===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 12===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 13===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 14===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_ascii(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ a = "68 65 6C 6C 6F 20 64 6F 67"
+ result = ep.decrypt(a)
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 15===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_base64_spaces_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("SGVsbG8gSSBsaWtlIGRvZ3MgYW5kIGNhdHM=")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 16===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def test_chi_english_caps(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("Hello My NaME IS BraNdOnnn And I LOVE You!")
+ self.assertEqual(result, True)
+ |
app.Decryptor.basicEncryption.viginere/Viginere.getMostCommonFactors | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <1>:<add> factorCounts = {} # Key is a factor, value is how often it occurs.
<del> factorCounts = {} # Key is a factor, value is how often it occurs.
<21>:<add> factorsByCount.append((factor, factorCounts[factor]))
<del> factorsByCount.append( (factor, factorCounts[factor]) )
| # module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def getMostCommonFactors(self, seqFactors):
<0> # First, get a count of how many times a factor occurs in seqFactors:
<1> factorCounts = {} # Key is a factor, value is how often it occurs.
<2>
<3> # seqFactors keys are sequences, values are lists of factors of the
<4> # spacings. seqFactors has a value like: {'GFD': [2, 3, 4, 6, 9, 12,
<5> # 18, 23, 36, 46, 69, 92, 138, 207], 'ALW': [2, 3, 4, 6, ...], ...}
<6> for seq in seqFactors:
<7> factorList = seqFactors[seq]
<8> for factor in factorList:
<9> if factor not in factorCounts:
<10> factorCounts[factor] = 0
<11> factorCounts[factor] += 1
<12>
<13> # Second, put the factor and its count into a tuple, and make a list
<14> # of these tuples so we can sort them:
<15> factorsByCount = []
<16> for factor in factorCounts:
<17> # Exclude factors larger than MAX_KEY_LENGTH:
<18> if factor <= self.MAX_KEY_LENGTH:
<19> # factorsByCount is a list of tuples: (factor, factorCount)
<20> # factorsByCount has a value like: [(3, 497), (2, 487), ...]
<21> factorsByCount.append( (factor, factorCounts[factor]) )
<22>
<23> # Sort the list by the factor count:
<24> factorsByCount.sort(key=self.getItemAtIndexOne, reverse=True)
<25>
<26> return factorsByCount
<27>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.viginere.Viginere
getItemAtIndexOne(items)
at: app.Decryptor.basicEncryption.viginere.Viginere.__init__
self.MAX_KEY_LENGTH = 16 # Will not attempt keys longer than this.
===========changed ref 0===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
def __init__(self, lc):
+ self.LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ self.SILENT_MODE = True # If set to True, program doesn't print anything.
- self.SILENT_MODE = True # If set to True, program doesn't print anything.
+ self.NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey.
- self.NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey.
+ self.MAX_KEY_LENGTH = 16 # Will not attempt keys longer than this.
- self.MAX_KEY_LENGTH = 16 # Will not attempt keys longer than this.
+ self.NONLETTERS_PATTERN = re.compile("[^A-Z]")
- self.NONLETTERS_PATTERN = re.compile('[^A-Z]')
self.lc = lc
===========changed ref 1===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def getUsefulFactors(self, num):
# Returns a list of useful factors of num. By "useful" we mean factors
# less than MAX_KEY_LENGTH + 1 and not 1. For example,
# getUsefulFactors(144) returns [2, 3, 4, 6, 8, 9, 12, 16]
if num < 2:
+ return [] # Numbers less than 2 have no useful factors.
- return [] # Numbers less than 2 have no useful factors.
+ factors = [] # The list of factors found.
- factors = [] # The list of factors found.
# When finding factors, you only need to check the integers up to
# MAX_KEY_LENGTH.
+ for i in range(2, self.MAX_KEY_LENGTH + 1): # Don't test 1: it's not useful.
- for i in range(2, self.MAX_KEY_LENGTH + 1): # Don't test 1: it's not useful.
if num % i == 0:
factors.append(i)
otherFactor = int(num / i)
if otherFactor < self.MAX_KEY_LENGTH + 1 and otherFactor != 1:
factors.append(otherFactor)
+ return list(set(factors)) # Remove duplicate factors.
- return list(set(factors)) # Remove duplicate factors.
===========changed ref 2===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def findRepeatSequencesSpacings(self, message):
# Goes through the message and finds any 3 to 5 letter sequences
# that are repeated. Returns a dict with the keys of the sequence and
# values of a list of spacings (num of letters between the repeats).
# Use a regular expression to remove non-letters from the message:
+ message = self.NONLETTERS_PATTERN.sub("", message.upper())
- message = self.NONLETTERS_PATTERN.sub('', message.upper())
# Compile a list of seqLen-letter sequences found in the message:
+ seqSpacings = {} # Keys are sequences, values are lists of int spacings.
- seqSpacings = {} # Keys are sequences, values are lists of int spacings.
for seqLen in range(3, 6):
for seqStart in range(len(message) - seqLen):
# Determine what the sequence is, and store it in seq:
+ seq = message[seqStart : seqStart + seqLen]
- seq = message[seqStart:seqStart + seqLen]
# Look for this sequence in the rest of the message:
for i in range(seqStart + seqLen, len(message) - seqLen):
+ if message[i : i + seqLen] == seq:
- if message[i:i + seqLen] == seq:
# Found a repeated sequence.
if seq not in seqSpacings:
+ seqSpacings[seq] = [] # Initialize a blank list.
- seqSpacings[seq] = [] # Initialize a blank list.
# Append the spacing distance between the repeated
# sequence and the original sequence:
seqSpacings[seq].append(i - seqStart)
return seqSpacings
===========changed ref 3===========
+ # module: app.test_chi_squared
+
+
===========changed ref 4===========
+ # module: app.test_basicparent
+
+
===========changed ref 5===========
+ # module: app.test_neuralNetwork
+
+
===========changed ref 6===========
+ # module: app.test_encoding
+
+
===========changed ref 7===========
+ # module: app.test_dictionary
+
+
===========changed ref 8===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 9===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_english_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("eW91ciB0ZXh0")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 10===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 11===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def tests_english_no_words(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("!!!!!!!!!!!!!!!!!!!")
+ self.assertEqual(result, True)
+
===========changed ref 12===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 13===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+ |
app.Decryptor.basicEncryption.viginere/Viginere.getNthSubkeysLetters | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <7>:<add> message = self.NONLETTERS_PATTERN.sub("", message)
<del> message = self.NONLETTERS_PATTERN.sub('', message)
<14>:<add> return "".join(letters)
<del> return ''.join(letters)
| # module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def getNthSubkeysLetters(self, nth, keyLength, message):
<0> # Returns every nth letter for each keyLength set of letters in text.
<1> # E.g. getNthSubkeysLetters(1, 3, 'ABCABCABC') returns 'AAA'
<2> # getNthSubkeysLetters(2, 3, 'ABCABCABC') returns 'BBB'
<3> # getNthSubkeysLetters(3, 3, 'ABCABCABC') returns 'CCC'
<4> # getNthSubkeysLetters(1, 5, 'ABCDEFGHI') returns 'AF'
<5>
<6> # Use a regular expression to remove non-letters from the message:
<7> message = self.NONLETTERS_PATTERN.sub('', message)
<8>
<9> i = nth - 1
<10> letters = []
<11> while i < len(message):
<12> letters.append(message[i])
<13> i += keyLength
<14> return ''.join(letters)
<15>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.viginere.Viginere.__init__
self.NONLETTERS_PATTERN = re.compile('[^A-Z]')
at: typing.Pattern
sub(repl: Callable[[Match[AnyStr]], AnyStr], string: AnyStr, count: int=...) -> AnyStr
sub(repl: AnyStr, string: AnyStr, count: int=...) -> AnyStr
===========changed ref 0===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
def __init__(self, lc):
+ self.LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ self.SILENT_MODE = True # If set to True, program doesn't print anything.
- self.SILENT_MODE = True # If set to True, program doesn't print anything.
+ self.NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey.
- self.NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey.
+ self.MAX_KEY_LENGTH = 16 # Will not attempt keys longer than this.
- self.MAX_KEY_LENGTH = 16 # Will not attempt keys longer than this.
+ self.NONLETTERS_PATTERN = re.compile("[^A-Z]")
- self.NONLETTERS_PATTERN = re.compile('[^A-Z]')
self.lc = lc
===========changed ref 1===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def getUsefulFactors(self, num):
# Returns a list of useful factors of num. By "useful" we mean factors
# less than MAX_KEY_LENGTH + 1 and not 1. For example,
# getUsefulFactors(144) returns [2, 3, 4, 6, 8, 9, 12, 16]
if num < 2:
+ return [] # Numbers less than 2 have no useful factors.
- return [] # Numbers less than 2 have no useful factors.
+ factors = [] # The list of factors found.
- factors = [] # The list of factors found.
# When finding factors, you only need to check the integers up to
# MAX_KEY_LENGTH.
+ for i in range(2, self.MAX_KEY_LENGTH + 1): # Don't test 1: it's not useful.
- for i in range(2, self.MAX_KEY_LENGTH + 1): # Don't test 1: it's not useful.
if num % i == 0:
factors.append(i)
otherFactor = int(num / i)
if otherFactor < self.MAX_KEY_LENGTH + 1 and otherFactor != 1:
factors.append(otherFactor)
+ return list(set(factors)) # Remove duplicate factors.
- return list(set(factors)) # Remove duplicate factors.
===========changed ref 2===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def getMostCommonFactors(self, seqFactors):
# First, get a count of how many times a factor occurs in seqFactors:
+ factorCounts = {} # Key is a factor, value is how often it occurs.
- factorCounts = {} # Key is a factor, value is how often it occurs.
# seqFactors keys are sequences, values are lists of factors of the
# spacings. seqFactors has a value like: {'GFD': [2, 3, 4, 6, 9, 12,
# 18, 23, 36, 46, 69, 92, 138, 207], 'ALW': [2, 3, 4, 6, ...], ...}
for seq in seqFactors:
factorList = seqFactors[seq]
for factor in factorList:
if factor not in factorCounts:
factorCounts[factor] = 0
factorCounts[factor] += 1
# Second, put the factor and its count into a tuple, and make a list
# of these tuples so we can sort them:
factorsByCount = []
for factor in factorCounts:
# Exclude factors larger than MAX_KEY_LENGTH:
if factor <= self.MAX_KEY_LENGTH:
# factorsByCount is a list of tuples: (factor, factorCount)
# factorsByCount has a value like: [(3, 497), (2, 487), ...]
+ factorsByCount.append((factor, factorCounts[factor]))
- factorsByCount.append( (factor, factorCounts[factor]) )
# Sort the list by the factor count:
factorsByCount.sort(key=self.getItemAtIndexOne, reverse=True)
return factorsByCount
===========changed ref 3===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def findRepeatSequencesSpacings(self, message):
# Goes through the message and finds any 3 to 5 letter sequences
# that are repeated. Returns a dict with the keys of the sequence and
# values of a list of spacings (num of letters between the repeats).
# Use a regular expression to remove non-letters from the message:
+ message = self.NONLETTERS_PATTERN.sub("", message.upper())
- message = self.NONLETTERS_PATTERN.sub('', message.upper())
# Compile a list of seqLen-letter sequences found in the message:
+ seqSpacings = {} # Keys are sequences, values are lists of int spacings.
- seqSpacings = {} # Keys are sequences, values are lists of int spacings.
for seqLen in range(3, 6):
for seqStart in range(len(message) - seqLen):
# Determine what the sequence is, and store it in seq:
+ seq = message[seqStart : seqStart + seqLen]
- seq = message[seqStart:seqStart + seqLen]
# Look for this sequence in the rest of the message:
for i in range(seqStart + seqLen, len(message) - seqLen):
+ if message[i : i + seqLen] == seq:
- if message[i:i + seqLen] == seq:
# Found a repeated sequence.
if seq not in seqSpacings:
+ seqSpacings[seq] = [] # Initialize a blank list.
- seqSpacings[seq] = [] # Initialize a blank list.
# Append the spacing distance between the repeated
# sequence and the original sequence:
seqSpacings[seq].append(i - seqStart)
return seqSpacings
===========changed ref 4===========
+ # module: app.test_chi_squared
+
+
===========changed ref 5===========
+ # module: app.test_basicparent
+
+
===========changed ref 6===========
+ # module: app.test_neuralNetwork
+
+
===========changed ref 7===========
+ # module: app.test_encoding
+
+
===========changed ref 8===========
+ # module: app.test_dictionary
+
+
===========changed ref 9===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 10===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_english_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("eW91ciB0ZXh0")
+ self.assertEqual(result["IsPlaintext?"], True)
+ |
app.Decryptor.basicEncryption.viginere/Viginere.attemptHackWithKeyLength | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <6>:<add> nthLetters = self.getNthSubkeysLetters(
<add> nth, mostLikelyKeyLength, ciphertextUp
<add> )
<del> nthLetters = self.getNthSubkeysLetters(nth, mostLikelyKeyLength, ciphertextUp)
<15>:<add> keyAndFreqMatchTuple = (
<add> possibleKey,
<add> Decryptor.basicEncryption.freqAnalysis.englishFreqMatchScore(
<del> keyAndFreqMatchTuple = (possibleKey, Decryptor.basicEncryption.freqAnalysis.englishFreqMatchScore(decryptedText))
<16>:<add> decryptedText
<add> ),
<add> )
<20>:<add> allFreqScores.append(freqScores[: self.NUM_MOST_FREQ_LETTERS])
<del> allFreqScores.append(freqScores[:self.NUM_MOST_FREQ_LETTERS])
<25>:<add> print("Possible letters for letter %s of the key: " % (i + 1), end="")
<del> print('Possible letters for letter %s of the key: ' % (i + 1), end='')
<27>:<add> print("%s " % freqScore[0], end="")
<del> print('%s ' % freqScore[0],
| # module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def attemptHackWithKeyLength(self, ciphertext, mostLikelyKeyLength):
<0> # Determine the most likely letters for each letter in the key:
<1> ciphertextUp = ciphertext.upper()
<2> # allFreqScores is a list of mostLikelyKeyLength number of lists.
<3> # These inner lists are the freqScores lists.
<4> allFreqScores = []
<5> for nth in range(1, mostLikelyKeyLength + 1):
<6> nthLetters = self.getNthSubkeysLetters(nth, mostLikelyKeyLength, ciphertextUp)
<7>
<8> # freqScores is a list of tuples like:
<9> # [(<letter>, <Eng. Freq. match score>), ... ]
<10> # List is sorted by match score. Higher score means better match.
<11> # See the englishFreqMatchScore() comments in freqAnalysis.py.
<12> freqScores = []
<13> for possibleKey in self.LETTERS:
<14> decryptedText = self.decryptMessage(possibleKey, nthLetters)
<15> keyAndFreqMatchTuple = (possibleKey, Decryptor.basicEncryption.freqAnalysis.englishFreqMatchScore(decryptedText))
<16> freqScores.append(keyAndFreqMatchTuple)
<17> # Sort by match score:
<18> freqScores.sort(key=self.getItemAtIndexOne, reverse=True)
<19>
<20> allFreqScores.append(freqScores[:self.NUM_MOST_FREQ_LETTERS])
<21>
<22> if not self.SILENT_MODE:
<23> for i in range(len(allFreqScores)):
<24> # Use i + 1 so the first letter is not called the "0th" letter:
<25> print('Possible letters for letter %s of the key: ' % (i + 1), end='')
<26> for freqScore in allFreqScores[i]:
<27> print('%s ' % freqScore[0],</s> | ===========below chunk 0===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def attemptHackWithKeyLength(self, ciphertext, mostLikelyKeyLength):
# offset: 1
print() # Print a newline.
# Try every combination of the most likely letters for each position
# in the key:
for indexes in itertools.product(range(self.NUM_MOST_FREQ_LETTERS), repeat=mostLikelyKeyLength):
# Create a possible key from the letters in allFreqScores:
possibleKey = ''
for i in range(mostLikelyKeyLength):
possibleKey += allFreqScores[i][indexes[i]][0]
if not self.SILENT_MODE:
print('Attempting with key: %s' % (possibleKey))
decryptedText = self.decryptMessage(possibleKey, ciphertextUp)
if self.lc.checkLanguage(decryptedText):
# Set the hacked ciphertext to the original casing:
origCase = []
for i in range(len(ciphertext)):
if ciphertext[i].isupper():
origCase.append(decryptedText[i].upper())
else:
origCase.append(decryptedText[i].lower())
decryptedText = ''.join(origCase)
# Check with user to see if the key has been found:
return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": decryptedText, "Cipher": "Viginere", "Extra Information": f"The key used is {possibleKey}"}
# No English-looking decryption found, so return None:
return None
===========unchanged ref 0===========
at: Decryptor.basicEncryption.freqAnalysis
englishFreqMatchScore(message)
at: app.Decryptor.basicEncryption.viginere.Viginere
getItemAtIndexOne(items)
getNthSubkeysLetters(nth, keyLength, message)
getNthSubkeysLetters(self, nth, keyLength, message)
decryptMessage(key, message)
at: app.Decryptor.basicEncryption.viginere.Viginere.__init__
self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
self.SILENT_MODE = True # If set to True, program doesn't print anything.
self.NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey.
self.lc = lc
===========unchanged ref 1===========
at: itertools
product(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], iter5: Iterable[_T5], iter6: Iterable[_T6]) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5, _T6]]
product(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]
product(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4]) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]
product(iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]
product(*iterables: Iterable[_T1], repeat: int) -> Iterator[Tuple[_T1, ...]]
product(iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]
product(*iterables: Iterable[Any], repeat: int=...) -> Iterator[Tuple[Any, ...]]
product(iter1: Iterable[Any], iter2: Iterable[Any], iter3: Iterable[Any], iter4: Iterable[Any], iter5: Iterable[Any], iter6: Iterable[Any], iter7: Iterable[Any], *iterables: Iterable[Any]) -> Iterator[Tuple[Any, ...]]
product(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], iter5: Iterable[_T5]) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]
===========changed ref 0===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def getNthSubkeysLetters(self, nth, keyLength, message):
# Returns every nth letter for each keyLength set of letters in text.
# E.g. getNthSubkeysLetters(1, 3, 'ABCABCABC') returns 'AAA'
# getNthSubkeysLetters(2, 3, 'ABCABCABC') returns 'BBB'
# getNthSubkeysLetters(3, 3, 'ABCABCABC') returns 'CCC'
# getNthSubkeysLetters(1, 5, 'ABCDEFGHI') returns 'AF'
# Use a regular expression to remove non-letters from the message:
+ message = self.NONLETTERS_PATTERN.sub("", message)
- message = self.NONLETTERS_PATTERN.sub('', message)
i = nth - 1
letters = []
while i < len(message):
letters.append(message[i])
i += keyLength
+ return "".join(letters)
- return ''.join(letters)
===========changed ref 1===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
def __init__(self, lc):
+ self.LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ self.SILENT_MODE = True # If set to True, program doesn't print anything.
- self.SILENT_MODE = True # If set to True, program doesn't print anything.
+ self.NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey.
- self.NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey.
+ self.MAX_KEY_LENGTH = 16 # Will not attempt keys longer than this.
- self.MAX_KEY_LENGTH = 16 # Will not attempt keys longer than this.
+ self.NONLETTERS_PATTERN = re.compile("[^A-Z]")
- self.NONLETTERS_PATTERN = re.compile('[^A-Z]')
self.lc = lc
|
app.Decryptor.basicEncryption.viginere/Viginere.hackVigenere | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <4>:<add> keyLengthStr = ""
<del> keyLengthStr = ''
<6>:<add> keyLengthStr += "%s " % (keyLength)
<del> keyLengthStr += '%s ' % (keyLength)
<7>:<add> print(
<add> "Kasiski Examination results say the most likely key lengths are: "
<del> print('Kasiski Examination results say the most likely key lengths are: ' + keyLengthStr + '\n')
<8>:<add> + keyLengthStr
<add> + "\n"
<add> )
<11>:<add> print(
<add> "Attempting hack with key length %s (%s possible keys)..."
<add> % (keyLength, self.NUM_MOST_FREQ_LETTERS ** keyLength)
<add> )
<del> print('Attempting hack with key length %s (%s possible keys)...' % (keyLength, self.NUM_MOST_FREQ_LETTERS ** keyLength))
<20>:<add> print(
<add> "Unable to hack message with likely key length(s). Brute forcing key length..."
<del> print('Unable to hack message with likely key length(s). Brute forcing key length...')
<21>:<add> )
<25>:<add> print(
<add> "Attempting hack with key length %s (%s possible keys)..."
<add> % (keyLength, self.NUM_MOST_FREQ_LETTERS ** keyLength)
<add> )
<del> print('Attempting hack with key length %s (%s possible keys)...' % (keyLength, self.NUM_MOST_FREQ_LETTERS ** keyLength))
| # module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def hackVigenere(self, ciphertext):
<0> # First, we need to do Kasiski Examination to figure out what the
<1> # length of the ciphertext's encryption key is:
<2> allLikelyKeyLengths = self.kasiskiExamination(ciphertext)
<3> if not self.SILENT_MODE:
<4> keyLengthStr = ''
<5> for keyLength in allLikelyKeyLengths:
<6> keyLengthStr += '%s ' % (keyLength)
<7> print('Kasiski Examination results say the most likely key lengths are: ' + keyLengthStr + '\n')
<8> hackedMessage = None
<9> for keyLength in allLikelyKeyLengths:
<10> if not self.SILENT_MODE:
<11> print('Attempting hack with key length %s (%s possible keys)...' % (keyLength, self.NUM_MOST_FREQ_LETTERS ** keyLength))
<12> hackedMessage = self.attemptHackWithKeyLength(ciphertext, keyLength)
<13> if hackedMessage != None:
<14> break
<15>
<16> # If none of the key lengths we found using Kasiski Examination
<17> # worked, start brute-forcing through key lengths:
<18> if hackedMessage == None:
<19> if not self.SILENT_MODE:
<20> print('Unable to hack message with likely key length(s). Brute forcing key length...')
<21> for keyLength in range(1, self.MAX_KEY_LENGTH + 1):
<22> # Don't re-check key lengths already tried from Kasiski:
<23> if keyLength not in allLikelyKeyLengths:
<24> if not self.SILENT_MODE:
<25> print('Attempting hack with key length %s (%s possible keys)...' % (keyLength, self.NUM_MOST_FREQ_LETTERS ** keyLength))
<26> hackedMessage = self.attemptH</s> | ===========below chunk 0===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def hackVigenere(self, ciphertext):
# offset: 1
if hackedMessage != None:
break
return hackedMessage
===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.viginere.Viginere
kasiskiExamination(ciphertext)
attemptHackWithKeyLength(self, ciphertext, mostLikelyKeyLength)
attemptHackWithKeyLength(ciphertext, mostLikelyKeyLength)
at: app.Decryptor.basicEncryption.viginere.Viginere.__init__
self.SILENT_MODE = True # If set to True, program doesn't print anything.
self.NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey.
self.MAX_KEY_LENGTH = 16 # Will not attempt keys longer than this.
===========changed ref 0===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def attemptHackWithKeyLength(self, ciphertext, mostLikelyKeyLength):
# Determine the most likely letters for each letter in the key:
ciphertextUp = ciphertext.upper()
# allFreqScores is a list of mostLikelyKeyLength number of lists.
# These inner lists are the freqScores lists.
allFreqScores = []
for nth in range(1, mostLikelyKeyLength + 1):
+ nthLetters = self.getNthSubkeysLetters(
+ nth, mostLikelyKeyLength, ciphertextUp
+ )
- nthLetters = self.getNthSubkeysLetters(nth, mostLikelyKeyLength, ciphertextUp)
# freqScores is a list of tuples like:
# [(<letter>, <Eng. Freq. match score>), ... ]
# List is sorted by match score. Higher score means better match.
# See the englishFreqMatchScore() comments in freqAnalysis.py.
freqScores = []
for possibleKey in self.LETTERS:
decryptedText = self.decryptMessage(possibleKey, nthLetters)
+ keyAndFreqMatchTuple = (
+ possibleKey,
+ Decryptor.basicEncryption.freqAnalysis.englishFreqMatchScore(
- keyAndFreqMatchTuple = (possibleKey, Decryptor.basicEncryption.freqAnalysis.englishFreqMatchScore(decryptedText))
+ decryptedText
+ ),
+ )
freqScores.append(keyAndFreqMatchTuple)
# Sort by match score:
freqScores.sort(key=self.getItemAtIndexOne, reverse=True)
+ allFreqScores.append(freqScores[: self.NUM_MOST_FREQ_LETTERS])
- allFreqScores.append(freqScores[:self.NUM_MOST_FREQ_LETTERS])
if not self.SI</s>
===========changed ref 1===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def attemptHackWithKeyLength(self, ciphertext, mostLikelyKeyLength):
# offset: 1
<s>.append(freqScores[:self.NUM_MOST_FREQ_LETTERS])
if not self.SILENT_MODE:
for i in range(len(allFreqScores)):
# Use i + 1 so the first letter is not called the "0th" letter:
+ print("Possible letters for letter %s of the key: " % (i + 1), end="")
- print('Possible letters for letter %s of the key: ' % (i + 1), end='')
for freqScore in allFreqScores[i]:
+ print("%s " % freqScore[0], end="")
- print('%s ' % freqScore[0], end='')
+ print() # Print a newline.
- print() # Print a newline.
# Try every combination of the most likely letters for each position
# in the key:
+ for indexes in itertools.product(
+ range(self.NUM_MOST_FREQ_LETTERS), repeat=mostLikelyKeyLength
- for indexes in itertools.product(range(self.NUM_MOST_FREQ_LETTERS), repeat=mostLikelyKeyLength):
+ ):
# Create a possible key from the letters in allFreqScores:
+ possibleKey = ""
- possibleKey = ''
for i in range(mostLikelyKeyLength):
possibleKey += allFreqScores[i][indexes[i]][0]
if not self.SILENT_MODE:
+ print("Attempting with key: %s" % (possibleKey))
- print('Attempting with key: %s' % (possibleKey))
</s>
===========changed ref 2===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def attemptHackWithKeyLength(self, ciphertext, mostLikelyKeyLength):
# offset: 2
<s> = self.decryptMessage(possibleKey, ciphertextUp)
if self.lc.checkLanguage(decryptedText):
# Set the hacked ciphertext to the original casing:
origCase = []
for i in range(len(ciphertext)):
if ciphertext[i].isupper():
origCase.append(decryptedText[i].upper())
else:
origCase.append(decryptedText[i].lower())
+ decryptedText = "".join(origCase)
- decryptedText = ''.join(origCase)
# Check with user to see if the key has been found:
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": decryptedText,
+ "Cipher": "Viginere",
+ "Extra Information": f"The key used is {possibleKey}",
+ }
- return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": decryptedText, "Cipher": "Viginere", "Extra Information": f"The key used is {possibleKey}"}
# No English-looking decryption found, so return None:
return None
===========changed ref 3===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def getNthSubkeysLetters(self, nth, keyLength, message):
# Returns every nth letter for each keyLength set of letters in text.
# E.g. getNthSubkeysLetters(1, 3, 'ABCABCABC') returns 'AAA'
# getNthSubkeysLetters(2, 3, 'ABCABCABC') returns 'BBB'
# getNthSubkeysLetters(3, 3, 'ABCABCABC') returns 'CCC'
# getNthSubkeysLetters(1, 5, 'ABCDEFGHI') returns 'AF'
# Use a regular expression to remove non-letters from the message:
+ message = self.NONLETTERS_PATTERN.sub("", message)
- message = self.NONLETTERS_PATTERN.sub('', message)
i = nth - 1
letters = []
while i < len(message):
letters.append(message[i])
i += keyLength
+ return "".join(letters)
- return ''.join(letters)
|
app.Decryptor.basicEncryption.viginere/Viginere.translateMessage | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <0>:<add> translated = [] # Stores the encrypted/decrypted message string.
<del> translated = [] # Stores the encrypted/decrypted message string.
<1>:<add>
<del>
<4>:<add>
<del>
<5>:<add> for symbol in message: # Loop through each symbol in message.
<del> for symbol in message: # Loop through each symbol in message.
<7>:<add> if num != -1: # -1 means symbol.upper() was not found in LETTERS.
<del> if num != -1: # -1 means symbol.upper() was not found in LETTERS.
<8>:<add> if mode == "encrypt":
<del> if mode == 'encrypt':
<9>:<add> num += self.LETTERS.find(key[keyIndex]) # Add if encrypting.
<del> num += self.LETTERS.find(key[keyIndex]) # Add if encrypting.
<10>:<add> elif mode == "decrypt":
<del> elif mode == 'decrypt':
<11>:<add> num -= self.LETTERS.find(key[keyIndex]) # Subtract if decrypting.
<del> num -= self.LETTERS.find(key[keyIndex]) # Subtract if decrypting.
<12>:<add>
<del>
<13>:<add> num %= len(self.LETTERS) # Handle any wraparound.
<del> num %= len(self.LETTERS) # Handle any wraparound.
<14>:<add>
<del>
<20>:<add>
<del>
<21>:<add> keyIndex += 1 # Move to the next letter in the key.
<del> keyIndex += 1 # Move to the next letter in the key.
<27>:<add>
<del>
<28>:<add> return "".join(translated)
<del> return ''.join(translated)
| # module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
-
+
def translateMessage(self, key, message, mode):
<0> translated = [] # Stores the encrypted/decrypted message string.
<1>
<2> keyIndex = 0
<3> key = key.upper()
<4>
<5> for symbol in message: # Loop through each symbol in message.
<6> num = self.LETTERS.find(symbol.upper())
<7> if num != -1: # -1 means symbol.upper() was not found in LETTERS.
<8> if mode == 'encrypt':
<9> num += self.LETTERS.find(key[keyIndex]) # Add if encrypting.
<10> elif mode == 'decrypt':
<11> num -= self.LETTERS.find(key[keyIndex]) # Subtract if decrypting.
<12>
<13> num %= len(self.LETTERS) # Handle any wraparound.
<14>
<15> # Add the encrypted/decrypted symbol to the end of translated:
<16> if symbol.isupper():
<17> translated.append(self.LETTERS[num])
<18> elif symbol.islower():
<19> translated.append(self.LETTERS[num].lower())
<20>
<21> keyIndex += 1 # Move to the next letter in the key.
<22> if keyIndex == len(key):
<23> keyIndex = 0
<24> else:
<25> # Append the symbol without encrypting/decrypting.
<26> translated.append(symbol)
<27>
<28> return ''.join(translated)
<29>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.viginere.Viginere.__init__
self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
===========changed ref 0===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def getNthSubkeysLetters(self, nth, keyLength, message):
# Returns every nth letter for each keyLength set of letters in text.
# E.g. getNthSubkeysLetters(1, 3, 'ABCABCABC') returns 'AAA'
# getNthSubkeysLetters(2, 3, 'ABCABCABC') returns 'BBB'
# getNthSubkeysLetters(3, 3, 'ABCABCABC') returns 'CCC'
# getNthSubkeysLetters(1, 5, 'ABCDEFGHI') returns 'AF'
# Use a regular expression to remove non-letters from the message:
+ message = self.NONLETTERS_PATTERN.sub("", message)
- message = self.NONLETTERS_PATTERN.sub('', message)
i = nth - 1
letters = []
while i < len(message):
letters.append(message[i])
i += keyLength
+ return "".join(letters)
- return ''.join(letters)
===========changed ref 1===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
def __init__(self, lc):
+ self.LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ self.SILENT_MODE = True # If set to True, program doesn't print anything.
- self.SILENT_MODE = True # If set to True, program doesn't print anything.
+ self.NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey.
- self.NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey.
+ self.MAX_KEY_LENGTH = 16 # Will not attempt keys longer than this.
- self.MAX_KEY_LENGTH = 16 # Will not attempt keys longer than this.
+ self.NONLETTERS_PATTERN = re.compile("[^A-Z]")
- self.NONLETTERS_PATTERN = re.compile('[^A-Z]')
self.lc = lc
===========changed ref 2===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def getUsefulFactors(self, num):
# Returns a list of useful factors of num. By "useful" we mean factors
# less than MAX_KEY_LENGTH + 1 and not 1. For example,
# getUsefulFactors(144) returns [2, 3, 4, 6, 8, 9, 12, 16]
if num < 2:
+ return [] # Numbers less than 2 have no useful factors.
- return [] # Numbers less than 2 have no useful factors.
+ factors = [] # The list of factors found.
- factors = [] # The list of factors found.
# When finding factors, you only need to check the integers up to
# MAX_KEY_LENGTH.
+ for i in range(2, self.MAX_KEY_LENGTH + 1): # Don't test 1: it's not useful.
- for i in range(2, self.MAX_KEY_LENGTH + 1): # Don't test 1: it's not useful.
if num % i == 0:
factors.append(i)
otherFactor = int(num / i)
if otherFactor < self.MAX_KEY_LENGTH + 1 and otherFactor != 1:
factors.append(otherFactor)
+ return list(set(factors)) # Remove duplicate factors.
- return list(set(factors)) # Remove duplicate factors.
===========changed ref 3===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def getMostCommonFactors(self, seqFactors):
# First, get a count of how many times a factor occurs in seqFactors:
+ factorCounts = {} # Key is a factor, value is how often it occurs.
- factorCounts = {} # Key is a factor, value is how often it occurs.
# seqFactors keys are sequences, values are lists of factors of the
# spacings. seqFactors has a value like: {'GFD': [2, 3, 4, 6, 9, 12,
# 18, 23, 36, 46, 69, 92, 138, 207], 'ALW': [2, 3, 4, 6, ...], ...}
for seq in seqFactors:
factorList = seqFactors[seq]
for factor in factorList:
if factor not in factorCounts:
factorCounts[factor] = 0
factorCounts[factor] += 1
# Second, put the factor and its count into a tuple, and make a list
# of these tuples so we can sort them:
factorsByCount = []
for factor in factorCounts:
# Exclude factors larger than MAX_KEY_LENGTH:
if factor <= self.MAX_KEY_LENGTH:
# factorsByCount is a list of tuples: (factor, factorCount)
# factorsByCount has a value like: [(3, 497), (2, 487), ...]
+ factorsByCount.append((factor, factorCounts[factor]))
- factorsByCount.append( (factor, factorCounts[factor]) )
# Sort the list by the factor count:
factorsByCount.sort(key=self.getItemAtIndexOne, reverse=True)
return factorsByCount
===========changed ref 4===========
# module: app.Decryptor.basicEncryption.viginere
+
+
class Viginere:
-
def findRepeatSequencesSpacings(self, message):
# Goes through the message and finds any 3 to 5 letter sequences
# that are repeated. Returns a dict with the keys of the sequence and
# values of a list of spacings (num of letters between the repeats).
# Use a regular expression to remove non-letters from the message:
+ message = self.NONLETTERS_PATTERN.sub("", message.upper())
- message = self.NONLETTERS_PATTERN.sub('', message.upper())
# Compile a list of seqLen-letter sequences found in the message:
+ seqSpacings = {} # Keys are sequences, values are lists of int spacings.
- seqSpacings = {} # Keys are sequences, values are lists of int spacings.
for seqLen in range(3, 6):
for seqStart in range(len(message) - seqLen):
# Determine what the sequence is, and store it in seq:
+ seq = message[seqStart : seqStart + seqLen]
- seq = message[seqStart:seqStart + seqLen]
# Look for this sequence in the rest of the message:
for i in range(seqStart + seqLen, len(message) - seqLen):
+ if message[i : i + seqLen] == seq:
- if message[i:i + seqLen] == seq:
# Found a repeated sequence.
if seq not in seqSpacings:
+ seqSpacings[seq] = [] # Initialize a blank list.
- seqSpacings[seq] = [] # Initialize a blank list.
# Append the spacing distance between the repeated
# sequence and the original sequence:
seqSpacings[seq].append(i - seqStart)
return seqSpacings
|
app.Decryptor.basicEncryption.pigLatin/PigLatin.decrypt | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <3>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": False,
<add> "Plaintext": None,
<add> "Cipher": "Pig Latin",
<add> "Extra Information": None,
<del> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Pig Latin", "Extra Information": None}
<4>:<add> }
<del>
<5>:<add>
<8>:<add> messagePIGAY = message[0 : len(message) - 2]
<del> messagePIGAY = message[0:len(message) - 2]
<12>:<add> messagePIGAY = messagePIGAY[0 : len(messagePIGAY) - 1]
<del> messagePIGAY = messagePIGAY[0:len(messagePIGAY) - 1]
<17>:<add>
<del>
<18>:<add> messagePIGWAY1 = messagePIGWAY[0 : len(messagePIGWAY) - 3]
<del> messagePIGWAY1 = messagePIGWAY[0:len(messagePIGWAY) - 3]
<24>:<add> messagePIGWAY1 = messagePIGWAY1[0 : len(messagePIGWAY1) - 1]
<del> messagePIGWAY1 = messagePIGWAY1[0:len(messagePIGWAY1) - 1]
| # module: app.Decryptor.basicEncryption.pigLatin
class PigLatin:
+
def decrypt(self, message):
<0> # If the message is less than or equal to 3 charecters, it's impossible to perform
<1> # a pig latin cipher on it unless the word was one letter long
<2> if len(message) <= 3:
<3> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Pig Latin", "Extra Information": None}
<4>
<5> else:
<6> messagePIGWAY = message
<7>
<8> messagePIGAY = message[0:len(message) - 2]
<9> # takes the last 2 letters of message
<10> message2AY = messagePIGAY[-1]
<11> # takes last letter of word and puts it into a variable
<12> messagePIGAY = messagePIGAY[0:len(messagePIGAY) - 1]
<13> # removes the last letter of the word
<14> message3AY = message2AY + messagePIGAY
<15> # creates a varaible which has the previous last letter as the first and
<16> # the rest of the word as the rest of it. This is one way to do Pig Latin.
<17>
<18> messagePIGWAY1 = messagePIGWAY[0:len(messagePIGWAY) - 3]
<19> # takes the last 3 letters of message
<20> message2WAY = messagePIGWAY1
<21> # copies varaibles
<22> message2WAY = message2WAY[-1]
<23> # takes last letter of word and puts it into a variable
<24> messagePIGWAY1 = messagePIGWAY1[0:len(messagePIGWAY1) - 1]
<25> # removes the last letter of the word
<26> messagepigWAY = message2WAY + messagePIGWAY1
<27> # creates a varaible which has the previous last letter as the first and
<28> # the rest of the word as the rest of it. This is one</s> | ===========below chunk 0===========
# module: app.Decryptor.basicEncryption.pigLatin
class PigLatin:
+
def decrypt(self, message):
# offset: 1
#TODO find a way to return 2 variables
# this returns 2 variables in a tuple
if self.lc.checkLanguage(message3AY):
return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": message3AY, "Cipher": "Pig Latin", "Extra Information": None}
elif self.lc.checkLanguage(messagepigWAY):
return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": messagepigWAY, "Cipher": "Pig Latin", "Extra Information": None}
else:
return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Pig Latin", "Extra Information": None}
===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.pigLatin.PigLatin.__init__
self.lc = lc
at: languageCheckerMod.LanguageChecker.LanguageChecker
checkLanguage(text)
===========changed ref 0===========
+ # module: app.test_chi_squared
+
+
===========changed ref 1===========
+ # module: app.test_basicparent
+
+
===========changed ref 2===========
+ # module: app.test_neuralNetwork
+
+
===========changed ref 3===========
+ # module: app.test_encoding
+
+
===========changed ref 4===========
+ # module: app.test_dictionary
+
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 6===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_english_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("eW91ciB0ZXh0")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 7===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 8===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def tests_english_no_words(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("!!!!!!!!!!!!!!!!!!!")
+ self.assertEqual(result, True)
+
===========changed ref 9===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 10===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 11===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 12===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_ascii(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ a = "68 65 6C 6C 6F 20 64 6F 67"
+ result = ep.decrypt(a)
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 13===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_base64_spaces_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("SGVsbG8gSSBsaWtlIGRvZ3MgYW5kIGNhdHM=")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 14===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def test_chi_english_caps(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("Hello My NaME IS BraNdOnnn And I LOVE You!")
+ self.assertEqual(result, True)
+
===========changed ref 15===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_md5_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("5d41402abc4b2a76b9719d911017c592")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 1)
+
===========changed ref 16===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_caesar_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("bcpvu up qvu ifs cpplt bxbz, cvu jotufbe tif qvmmfe")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 4)
+
===========changed ref 17===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_sha1_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("6D32263A85C7846D70439026B75758C9FC31A9B7")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 0)
+
===========changed ref 18===========
+ # module: app.test_basicparent
+ class TestBasicParent(unittest.TestCase):
+ def test_basic_parent_reverse_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ bp = BasicParent(lc)
+ result = bp.decrypt(
+ "tsafkaerb hsilgne doog a ekil od yllaer i dna rehtom ym olleh rehtaf ym olleh"
+ )
+ self.assertEqual(result["IsPlaintext?"], True)
+ |
app.Decryptor.basicEncryption.transposition/Transposition.main | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | # module: app.Decryptor.basicEncryption.transposition
+
class Transposition:
+
def main(self):
<0> myMessage = """Cb b rssti aieih rooaopbrtnsceee er es no npfgcwu plri
<1>
<2> ch nitaalr eiuengiteehb(e1 hilincegeoamn fubehgtarndcstudmd nM eu eacBoltaetee
<3>
<4> oinebcdkyremdteghn.aa2r81a condari fmps" tad l t oisn sit u1rnd stara nvhn fs
<5>
<6> edbh ee,n e necrg6 8nmisv l nc muiftegiitm tutmg cm shSs9fcie ebintcaets h a
<7>
<8> ihda cctrhe ele 1O7 aaoem waoaatdahretnhechaopnooeapece9etfncdbgsoeb uuteitgna.
<9>
<10> rteoh add e,D7c1Etnpneehtn beete" evecoal lsfmcrl iu1cifgo ai. sl1rchdnheev sh
<11>
<12> meBd ies e9t)nh,htcnoecplrrh ,ide hmtlme. pheaLem,toeinfgn t e9yce da' eN eMp a
<13>
<14> ffn Fc1o ge eohg dere.eec s nfap yox hla yon. lnrnsreaBoa t,e eitsw il ulpbdofg
<15>
<16> BRe bwlmprraio po droB wtinue r Pieno nc ayieeto'lulcih sfnc ownaSserbereiaSm
<17>
<18> -eaiah, nnrttgcC maciiritvledastinideI nn rms iehn tsigaBmuoetcetias rn"""</s> | ===========below chunk 0===========
# module: app.Decryptor.basicEncryption.transposition
+
class Transposition:
+
def main(self):
# offset: 1
hackedMessage = self.hackTransposition(myMessage)
===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.transposition.Transposition
hackTransposition(self, message)
hackTransposition(message)
===========changed ref 0===========
+ # module: app.test_chi_squared
+
+
===========changed ref 1===========
+ # module: app.test_basicparent
+
+
===========changed ref 2===========
+ # module: app.test_neuralNetwork
+
+
===========changed ref 3===========
+ # module: app.test_encoding
+
+
===========changed ref 4===========
+ # module: app.test_dictionary
+
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 6===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_english_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("eW91ciB0ZXh0")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 7===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 8===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def tests_english_no_words(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("!!!!!!!!!!!!!!!!!!!")
+ self.assertEqual(result, True)
+
===========changed ref 9===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 10===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 11===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 12===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_ascii(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ a = "68 65 6C 6C 6F 20 64 6F 67"
+ result = ep.decrypt(a)
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 13===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_base64_spaces_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("SGVsbG8gSSBsaWtlIGRvZ3MgYW5kIGNhdHM=")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 14===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def test_chi_english_caps(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("Hello My NaME IS BraNdOnnn And I LOVE You!")
+ self.assertEqual(result, True)
+
===========changed ref 15===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_md5_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("5d41402abc4b2a76b9719d911017c592")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 1)
+
===========changed ref 16===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_caesar_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("bcpvu up qvu ifs cpplt bxbz, cvu jotufbe tif qvmmfe")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 4)
+
===========changed ref 17===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_sha1_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("6D32263A85C7846D70439026B75758C9FC31A9B7")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 0)
+
===========changed ref 18===========
+ # module: app.test_basicparent
+ class TestBasicParent(unittest.TestCase):
+ def test_basic_parent_reverse_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ bp = BasicParent(lc)
+ result = bp.decrypt(
+ "tsafkaerb hsilgne doog a ekil od yllaer i dna rehtom ym olleh rehtaf ym olleh"
+ )
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 19===========
+ # module: app.test_basicparent
+ class TestBasicParent(unittest.TestCase):
+ def test_basic_parent_reverse_yes_2(self):
+ lc = LanguageChecker.LanguageChecker()
+ bp = BasicParent(lc)
+ result = bp.decrypt(
+ "sevom ylpmis rac eht ciffart ruoy lla gnillenut si hcihw redivorp NPV a ekilnU"
+ )
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 20===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def test_chi_english_yes(self):
+ """Checks to see if it returns True (it should)"""
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi(
+ "Hello my name is Brandon and I'm a top secret message"
+ )
+ self.assertEqual(result, True)
+ |
|
app.Decryptor.basicEncryption.transposition/Transposition.hackTransposition | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <0>:<add> print("Hacking...")
<del> print('Hacking...')
<1>:<add>
<del>
<4>:<add>
<del>
<7>:<add>
<del>
<9>:<add>
<del>
<10>:<add> # if self.lc.checkLanguage(decryptedText):
<del> #if self.lc.checkLanguage(decryptedText):
<11>:<add> # Check with user to see if the decrypted key has been found.
<del> # Check with user to see if the decrypted key has been found.
<13>:<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": True,
<add> "Plaintext": decryptedText,
<add> "Cipher": "Transposition",
<add> "Extra Information": f"The key is {key}",
<add> }
<add> return {
<add> "lc": self.lc,
<add> "IsPlaintext?": False,
<add> "Plaintext": None,
<add> "Cipher": "Transposition",
<add> "Extra Information": None,
<add> }
<del> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": decryptedText, "Cipher": "Transposition", "Extra Information": f"The key is {key}"}
<14>:<del> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Transposition", "Extra Information": None}
| # module: app.Decryptor.basicEncryption.transposition
+
class Transposition:
+
def hackTransposition(self, message):
<0> print('Hacking...')
<1>
<2> # Python programs can be stopped at any time by pressing Ctrl-C (on
<3> # Windows) or Ctrl-D (on Mac and Linux)
<4>
<5> # brute-force by looping through every possible key
<6> for key in range(1, len(message)):
<7>
<8> decryptedText = self.transpositionDecrypt.decryptMessage(key, message)
<9>
<10> #if self.lc.checkLanguage(decryptedText):
<11> # Check with user to see if the decrypted key has been found.
<12> if self.lc.checkLanguage(decryptedText):
<13> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": decryptedText, "Cipher": "Transposition", "Extra Information": f"The key is {key}"}
<14> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Transposition", "Extra Information": None}
<15>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.transposition.Transposition.__init__
self.lc = lc
===========changed ref 0===========
# module: app.Decryptor.basicEncryption.transposition
+
class Transposition:
+
def main(self):
myMessage = """Cb b rssti aieih rooaopbrtnsceee er es no npfgcwu plri
ch nitaalr eiuengiteehb(e1 hilincegeoamn fubehgtarndcstudmd nM eu eacBoltaetee
oinebcdkyremdteghn.aa2r81a condari fmps" tad l t oisn sit u1rnd stara nvhn fs
edbh ee,n e necrg6 8nmisv l nc muiftegiitm tutmg cm shSs9fcie ebintcaets h a
ihda cctrhe ele 1O7 aaoem waoaatdahretnhechaopnooeapece9etfncdbgsoeb uuteitgna.
rteoh add e,D7c1Etnpneehtn beete" evecoal lsfmcrl iu1cifgo ai. sl1rchdnheev sh
meBd ies e9t)nh,htcnoecplrrh ,ide hmtlme. pheaLem,toeinfgn t e9yce da' eN eMp a
ffn Fc1o ge eohg dere.eec s nfap yox hla yon. lnrnsreaBoa t,e eitsw il ulpbdofg
BRe bwlmprraio po droB wtinue r Pieno nc ayieeto'lulcih sfnc ownaSserbereiaSm
-eaiah, nnrttgcC maciiritvledastinideI nn rms iehn tsigaBmuoetcetias rn"""
+
-
hackedMessage = self.hackTrans</s>
===========changed ref 1===========
# module: app.Decryptor.basicEncryption.transposition
+
class Transposition:
+
def main(self):
# offset: 1
<s> tsigaBmuoetcetias rn"""
+
-
hackedMessage = self.hackTransposition(myMessage)
===========changed ref 2===========
+ # module: app.test_chi_squared
+
+
===========changed ref 3===========
+ # module: app.test_basicparent
+
+
===========changed ref 4===========
+ # module: app.test_neuralNetwork
+
+
===========changed ref 5===========
+ # module: app.test_encoding
+
+
===========changed ref 6===========
+ # module: app.test_dictionary
+
+
===========changed ref 7===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 8===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_english_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("eW91ciB0ZXh0")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 9===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 10===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def tests_english_no_words(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("!!!!!!!!!!!!!!!!!!!")
+ self.assertEqual(result, True)
+
===========changed ref 11===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 12===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 13===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 14===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_ascii(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ a = "68 65 6C 6C 6F 20 64 6F 67"
+ result = ep.decrypt(a)
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 15===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_base64_spaces_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("SGVsbG8gSSBsaWtlIGRvZ3MgYW5kIGNhdHM=")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 16===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def test_chi_english_caps(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("Hello My NaME IS BraNdOnnn And I LOVE You!")
+ self.assertEqual(result, True)
+
===========changed ref 17===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_md5_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("5d41402abc4b2a76b9719d911017c592")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 1)
+
===========changed ref 18===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_caesar_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("bcpvu up qvu ifs cpplt bxbz, cvu jotufbe tif qvmmfe")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 4)
+ |
app.Decryptor.basicEncryption.transposition/Transposition.decryptMessage | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <3>:<add>
<del>
<10>:<add>
<del>
<12>:<add> plaintext = [""] * numOfColumns
<del> plaintext = [''] * numOfColumns
<13>:<add>
<del>
<18>:<add>
<del>
<21>:<add> col += 1 # point to next column
<del> col += 1 # point to next column
<22>:<add>
<del>
<25>:<add> if (col == numOfColumns) or (
<add> col == numOfColumns - 1 and row >= numOfRows - numOfShadedBoxes
<del> if (col == numOfColumns) or (col == numOfColumns - 1 and row >= numOfRows - numOfShadedBoxes):
<26>:<add> ):
<28>:<add>
<del>
<29>:<add> return "".join(plaintext)
<del> return ''.join(plaintext)
| # module: app.Decryptor.basicEncryption.transposition
+
class Transposition:
+
def decryptMessage(self, key, message):
<0> # The transposition decrypt function will simulate the "columns" and
<1> # "rows" of the grid that the plaintext is written on by using a list
<2> # of strings. First, we need to calculate a few values.
<3>
<4> # The number of "columns" in our transposition grid:
<5> numOfColumns = math.ceil(len(message) / key)
<6> # The number of "rows" in our grid will need:
<7> numOfRows = key
<8> # The number of "shaded boxes" in the last "column" of the grid:
<9> numOfShadedBoxes = (numOfColumns * numOfRows) - len(message)
<10>
<11> # Each string in plaintext represents a column in the grid.
<12> plaintext = [''] * numOfColumns
<13>
<14> # The col and row variables point to where in the grid the next
<15> # character in the encrypted message will go.
<16> col = 0
<17> row = 0
<18>
<19> for symbol in message:
<20> plaintext[col] += symbol
<21> col += 1 # point to next column
<22>
<23> # If there are no more columns OR we're at a shaded box, go back to
<24> # the first column and the next row.
<25> if (col == numOfColumns) or (col == numOfColumns - 1 and row >= numOfRows - numOfShadedBoxes):
<26> col = 0
<27> row += 1
<28>
<29> return ''.join(plaintext)
<30>
| ===========unchanged ref 0===========
at: math
ceil(x: SupportsFloat, /) -> int
===========changed ref 0===========
# module: app.Decryptor.basicEncryption.transposition
+
class Transposition:
+
def hackTransposition(self, message):
+ print("Hacking...")
- print('Hacking...')
+
-
# Python programs can be stopped at any time by pressing Ctrl-C (on
# Windows) or Ctrl-D (on Mac and Linux)
+
-
# brute-force by looping through every possible key
for key in range(1, len(message)):
+
-
decryptedText = self.transpositionDecrypt.decryptMessage(key, message)
+
-
+ # if self.lc.checkLanguage(decryptedText):
- #if self.lc.checkLanguage(decryptedText):
+ # Check with user to see if the decrypted key has been found.
- # Check with user to see if the decrypted key has been found.
if self.lc.checkLanguage(decryptedText):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": decryptedText,
+ "Cipher": "Transposition",
+ "Extra Information": f"The key is {key}",
+ }
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": "Transposition",
+ "Extra Information": None,
+ }
- return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": decryptedText, "Cipher": "Transposition", "Extra Information": f"The key is {key}"}
- return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Transposition", "Extra Information": None}
===========changed ref 1===========
# module: app.Decryptor.basicEncryption.transposition
+
class Transposition:
+
def main(self):
myMessage = """Cb b rssti aieih rooaopbrtnsceee er es no npfgcwu plri
ch nitaalr eiuengiteehb(e1 hilincegeoamn fubehgtarndcstudmd nM eu eacBoltaetee
oinebcdkyremdteghn.aa2r81a condari fmps" tad l t oisn sit u1rnd stara nvhn fs
edbh ee,n e necrg6 8nmisv l nc muiftegiitm tutmg cm shSs9fcie ebintcaets h a
ihda cctrhe ele 1O7 aaoem waoaatdahretnhechaopnooeapece9etfncdbgsoeb uuteitgna.
rteoh add e,D7c1Etnpneehtn beete" evecoal lsfmcrl iu1cifgo ai. sl1rchdnheev sh
meBd ies e9t)nh,htcnoecplrrh ,ide hmtlme. pheaLem,toeinfgn t e9yce da' eN eMp a
ffn Fc1o ge eohg dere.eec s nfap yox hla yon. lnrnsreaBoa t,e eitsw il ulpbdofg
BRe bwlmprraio po droB wtinue r Pieno nc ayieeto'lulcih sfnc ownaSserbereiaSm
-eaiah, nnrttgcC maciiritvledastinideI nn rms iehn tsigaBmuoetcetias rn"""
+
-
hackedMessage = self.hackTrans</s>
===========changed ref 2===========
# module: app.Decryptor.basicEncryption.transposition
+
class Transposition:
+
def main(self):
# offset: 1
<s> tsigaBmuoetcetias rn"""
+
-
hackedMessage = self.hackTransposition(myMessage)
===========changed ref 3===========
+ # module: app.test_chi_squared
+
+
===========changed ref 4===========
+ # module: app.test_basicparent
+
+
===========changed ref 5===========
+ # module: app.test_neuralNetwork
+
+
===========changed ref 6===========
+ # module: app.test_encoding
+
+
===========changed ref 7===========
+ # module: app.test_dictionary
+
+
===========changed ref 8===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 9===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_english_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("eW91ciB0ZXh0")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 10===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 11===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def tests_english_no_words(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("!!!!!!!!!!!!!!!!!!!")
+ self.assertEqual(result, True)
+
===========changed ref 12===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 13===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 14===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 15===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_ascii(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ a = "68 65 6C 6C 6F 20 64 6F 67"
+ result = ep.decrypt(a)
+ self.assertEqual(result["IsPlaintext?"], True)
+ |
app.Decryptor.basicEncryption.freqAnalysis/getLetterCount | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <2>:<add> letterCount = {
<add> "A": 0,
<add> "B": 0,
<add> "C": 0,
<add> "D": 0,
<add> "E": 0,
<add> "F": 0,
<add> "G": 0,
<add> "H": 0,
<add> "I": 0,
<add> "J": 0,
<add> "K": 0,
<add> "L": 0,
<add> "M": 0,
<add> "N": 0,
<add> "O": 0,
<add> "P": 0,
<add> "Q": 0,
<add> "R": 0,
<add> "S": 0,
<add> "T": 0,
<add> "U": 0,
<add> "V": 0,
<add> "W": 0,
<add> "X": 0,
<add> "Y": 0,
<add> "Z": 0,
<add> }
<del> letterCount = {'A': 0, 'B': 0, 'C': 0, 'D': 0, 'E': 0, 'F': 0, 'G': 0, 'H': 0, 'I': 0, 'J': 0, 'K': 0, 'L': 0, 'M': 0, 'N': 0, 'O': 0, 'P': 0, 'Q': 0, 'R': 0, 'S': 0, 'T': 0, 'U': 0, 'V': 0, 'W': 0, 'X': 0, 'Y': 0, 'Z': 0}
| # module: app.Decryptor.basicEncryption.freqAnalysis
+
def getLetterCount(message):
<0> # Returns a dictionary with keys of single letters and values of the
<1> # count of how many times they appear in the message parameter:
<2> letterCount = {'A': 0, 'B': 0, 'C': 0, 'D': 0, 'E': 0, 'F': 0, 'G': 0, 'H': 0, 'I': 0, 'J': 0, 'K': 0, 'L': 0, 'M': 0, 'N': 0, 'O': 0, 'P': 0, 'Q': 0, 'R': 0, 'S': 0, 'T': 0, 'U': 0, 'V': 0, 'W': 0, 'X': 0, 'Y': 0, 'Z': 0}
<3>
<4> for letter in message.upper():
<5> if letter in LETTERS:
<6> letterCount[letter] += 1
<7>
<8> return letterCount
<9>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.freqAnalysis
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
===========changed ref 0===========
+ # module: app.test_chi_squared
+
+
===========changed ref 1===========
+ # module: app.test_basicparent
+
+
===========changed ref 2===========
+ # module: app.test_neuralNetwork
+
+
===========changed ref 3===========
+ # module: app.test_encoding
+
+
===========changed ref 4===========
+ # module: app.test_dictionary
+
+
===========changed ref 5===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 6===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_english_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("eW91ciB0ZXh0")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 7===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 8===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def tests_english_no_words(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("!!!!!!!!!!!!!!!!!!!")
+ self.assertEqual(result, True)
+
===========changed ref 9===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 10===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 11===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 12===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_ascii(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ a = "68 65 6C 6C 6F 20 64 6F 67"
+ result = ep.decrypt(a)
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 13===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_base64_spaces_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("SGVsbG8gSSBsaWtlIGRvZ3MgYW5kIGNhdHM=")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 14===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def test_chi_english_caps(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("Hello My NaME IS BraNdOnnn And I LOVE You!")
+ self.assertEqual(result, True)
+
===========changed ref 15===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_md5_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("5d41402abc4b2a76b9719d911017c592")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 1)
+
===========changed ref 16===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_caesar_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("bcpvu up qvu ifs cpplt bxbz, cvu jotufbe tif qvmmfe")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 4)
+
===========changed ref 17===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_sha1_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("6D32263A85C7846D70439026B75758C9FC31A9B7")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 0)
+
===========changed ref 18===========
+ # module: app.test_basicparent
+ class TestBasicParent(unittest.TestCase):
+ def test_basic_parent_reverse_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ bp = BasicParent(lc)
+ result = bp.decrypt(
+ "tsafkaerb hsilgne doog a ekil od yllaer i dna rehtom ym olleh rehtaf ym olleh"
+ )
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 19===========
+ # module: app.test_basicparent
+ class TestBasicParent(unittest.TestCase):
+ def test_basic_parent_reverse_yes_2(self):
+ lc = LanguageChecker.LanguageChecker()
+ bp = BasicParent(lc)
+ result = bp.decrypt(
+ "sevom ylpmis rac eht ciffart ruoy lla gnillenut si hcihw redivorp NPV a ekilnU"
+ )
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 20===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def test_chi_english_yes(self):
+ """Checks to see if it returns True (it should)"""
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi(
+ "Hello my name is Brandon and I'm a top secret message"
+ )
+ self.assertEqual(result, True)
+ |
app.Decryptor.basicEncryption.freqAnalysis/getFrequencyOrder | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <19>:<add> freqToLetter[freq] = "".join(freqToLetter[freq])
<del> freqToLetter[freq] = ''.join(freqToLetter[freq])
<32>:<add> return "".join(freqOrder)
<del> return ''.join(freqOrder)
| # module: app.Decryptor.basicEncryption.freqAnalysis
def getFrequencyOrder(message):
<0> # Returns a string of the alphabet letters arranged in order of most
<1> # frequently occurring in the message parameter.
<2>
<3> # First, get a dictionary of each letter and its frequency count:
<4> letterToFreq = getLetterCount(message)
<5>
<6> # Second, make a dictionary of each frequency count to each letter(s)
<7> # with that frequency:
<8> freqToLetter = {}
<9> for letter in LETTERS:
<10> if letterToFreq[letter] not in freqToLetter:
<11> freqToLetter[letterToFreq[letter]] = [letter]
<12> else:
<13> freqToLetter[letterToFreq[letter]].append(letter)
<14>
<15> # Third, put each list of letters in reverse "ETAOIN" order, and then
<16> # convert it to a string:
<17> for freq in freqToLetter:
<18> freqToLetter[freq].sort(key=ETAOIN.find, reverse=True)
<19> freqToLetter[freq] = ''.join(freqToLetter[freq])
<20>
<21> # Fourth, convert the freqToLetter dictionary to a list of
<22> # tuple pairs (key, value), then sort them:
<23> freqPairs = list(freqToLetter.items())
<24> freqPairs.sort(key=getItemAtIndexZero, reverse=True)
<25>
<26> # Fifth, now that the letters are ordered by frequency, extract all
<27> # the letters for the final string:
<28> freqOrder = []
<29> for freqPair in freqPairs:
<30> freqOrder.append(freqPair[1])
<31>
<32> return ''.join(freqOrder)
<33>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.freqAnalysis
ETAOIN = 'ETAOINSHRDLCUMWFGYPBVKJXQZ'
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
getLetterCount(message)
getItemAtIndexZero(items)
===========changed ref 0===========
# module: app.Decryptor.basicEncryption.freqAnalysis
+
def getLetterCount(message):
# Returns a dictionary with keys of single letters and values of the
# count of how many times they appear in the message parameter:
+ letterCount = {
+ "A": 0,
+ "B": 0,
+ "C": 0,
+ "D": 0,
+ "E": 0,
+ "F": 0,
+ "G": 0,
+ "H": 0,
+ "I": 0,
+ "J": 0,
+ "K": 0,
+ "L": 0,
+ "M": 0,
+ "N": 0,
+ "O": 0,
+ "P": 0,
+ "Q": 0,
+ "R": 0,
+ "S": 0,
+ "T": 0,
+ "U": 0,
+ "V": 0,
+ "W": 0,
+ "X": 0,
+ "Y": 0,
+ "Z": 0,
+ }
- letterCount = {'A': 0, 'B': 0, 'C': 0, 'D': 0, 'E': 0, 'F': 0, 'G': 0, 'H': 0, 'I': 0, 'J': 0, 'K': 0, 'L': 0, 'M': 0, 'N': 0, 'O': 0, 'P': 0, 'Q': 0, 'R': 0, 'S': 0, 'T': 0, 'U': 0, 'V': 0, 'W': 0, 'X': 0, 'Y': 0, 'Z': 0}
for letter in message.upper():
if letter in LETTERS:
letterCount[letter] += 1
return letterCount
===========changed ref 1===========
+ # module: app.test_chi_squared
+
+
===========changed ref 2===========
+ # module: app.test_basicparent
+
+
===========changed ref 3===========
+ # module: app.test_neuralNetwork
+
+
===========changed ref 4===========
+ # module: app.test_encoding
+
+
===========changed ref 5===========
+ # module: app.test_dictionary
+
+
===========changed ref 6===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 7===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_english_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("eW91ciB0ZXh0")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 8===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 9===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def tests_english_no_words(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("!!!!!!!!!!!!!!!!!!!")
+ self.assertEqual(result, True)
+
===========changed ref 10===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 11===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 12===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 13===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_ascii(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ a = "68 65 6C 6C 6F 20 64 6F 67"
+ result = ep.decrypt(a)
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 14===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_base64_spaces_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("SGVsbG8gSSBsaWtlIGRvZ3MgYW5kIGNhdHM=")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 15===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def test_chi_english_caps(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("Hello My NaME IS BraNdOnnn And I LOVE You!")
+ self.assertEqual(result, True)
+
===========changed ref 16===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_md5_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("5d41402abc4b2a76b9719d911017c592")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 1)
+
===========changed ref 17===========
+ # module: app.test_neuralNetwork
+ class testNeuralNetwork(unittest.TestCase):
+ def test_caesar_yes(self):
+ model = NeuralNetwork()
+ result = model.predictnn("bcpvu up qvu ifs cpplt bxbz, cvu jotufbe tif qvmmfe")
+ numpy.set_printoptions(suppress=True)
+ result = numpy.argmax(result)
+ self.assertEqual(result, 4)
+ |
app.Decryptor.basicEncryption.freqAnalysis/englishFreqMatchScore | Modified | Ciphey~Ciphey | 95e451e7a43a8c7a2f2aa42e4a9b7d25b13ab4f2 | Fixed testing & Ciphey now runs | <17>:<add> return matchScore
<del> return matchScore
| # module: app.Decryptor.basicEncryption.freqAnalysis
def englishFreqMatchScore(message):
<0> # Return the number of matches that the string in the message
<1> # parameter has when its letter frequency is compared to English
<2> # letter frequency. A "match" is how many of its six most frequent
<3> # and six least frequent letters is among the six most frequent and
<4> # six least frequent letters for English.
<5> freqOrder = getFrequencyOrder(message)
<6>
<7> matchScore = 0
<8> # Find how many matches for the six most common letters there are:
<9> for commonLetter in ETAOIN[:6]:
<10> if commonLetter in freqOrder[:6]:
<11> matchScore += 1
<12> # Find how many matches for the six least common letters there are:
<13> for uncommonLetter in ETAOIN[-6:]:
<14> if uncommonLetter in freqOrder[-6:]:
<15> matchScore += 1
<16>
<17> return matchScore
<18>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.freqAnalysis
ETAOIN = 'ETAOINSHRDLCUMWFGYPBVKJXQZ'
getFrequencyOrder(message)
===========changed ref 0===========
# module: app.Decryptor.basicEncryption.freqAnalysis
def getFrequencyOrder(message):
# Returns a string of the alphabet letters arranged in order of most
# frequently occurring in the message parameter.
# First, get a dictionary of each letter and its frequency count:
letterToFreq = getLetterCount(message)
# Second, make a dictionary of each frequency count to each letter(s)
# with that frequency:
freqToLetter = {}
for letter in LETTERS:
if letterToFreq[letter] not in freqToLetter:
freqToLetter[letterToFreq[letter]] = [letter]
else:
freqToLetter[letterToFreq[letter]].append(letter)
# Third, put each list of letters in reverse "ETAOIN" order, and then
# convert it to a string:
for freq in freqToLetter:
freqToLetter[freq].sort(key=ETAOIN.find, reverse=True)
+ freqToLetter[freq] = "".join(freqToLetter[freq])
- freqToLetter[freq] = ''.join(freqToLetter[freq])
# Fourth, convert the freqToLetter dictionary to a list of
# tuple pairs (key, value), then sort them:
freqPairs = list(freqToLetter.items())
freqPairs.sort(key=getItemAtIndexZero, reverse=True)
# Fifth, now that the letters are ordered by frequency, extract all
# the letters for the final string:
freqOrder = []
for freqPair in freqPairs:
freqOrder.append(freqPair[1])
+ return "".join(freqOrder)
- return ''.join(freqOrder)
===========changed ref 1===========
# module: app.Decryptor.basicEncryption.freqAnalysis
+
def getLetterCount(message):
# Returns a dictionary with keys of single letters and values of the
# count of how many times they appear in the message parameter:
+ letterCount = {
+ "A": 0,
+ "B": 0,
+ "C": 0,
+ "D": 0,
+ "E": 0,
+ "F": 0,
+ "G": 0,
+ "H": 0,
+ "I": 0,
+ "J": 0,
+ "K": 0,
+ "L": 0,
+ "M": 0,
+ "N": 0,
+ "O": 0,
+ "P": 0,
+ "Q": 0,
+ "R": 0,
+ "S": 0,
+ "T": 0,
+ "U": 0,
+ "V": 0,
+ "W": 0,
+ "X": 0,
+ "Y": 0,
+ "Z": 0,
+ }
- letterCount = {'A': 0, 'B': 0, 'C': 0, 'D': 0, 'E': 0, 'F': 0, 'G': 0, 'H': 0, 'I': 0, 'J': 0, 'K': 0, 'L': 0, 'M': 0, 'N': 0, 'O': 0, 'P': 0, 'Q': 0, 'R': 0, 'S': 0, 'T': 0, 'U': 0, 'V': 0, 'W': 0, 'X': 0, 'Y': 0, 'Z': 0}
for letter in message.upper():
if letter in LETTERS:
letterCount[letter] += 1
return letterCount
===========changed ref 2===========
+ # module: app.test_chi_squared
+
+
===========changed ref 3===========
+ # module: app.test_basicparent
+
+
===========changed ref 4===========
+ # module: app.test_neuralNetwork
+
+
===========changed ref 5===========
+ # module: app.test_encoding
+
+
===========changed ref 6===========
+ # module: app.test_dictionary
+
+
===========changed ref 7===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage("jdajj kop9u0r 9jjidasjp", "English")
+ self.assertEqual(result, False)
+
===========changed ref 8===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_english_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("eW91ciB0ZXh0")
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 9===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello again my friend this is my name and I like dogs!", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 10===========
+ # module: app.test_chi_squared
+ class testChi(unittest.TestCase):
+ def tests_english_no_words(self):
+ self.chi = chiSquared()
+ """
+ Tests to see whether a sentene is classified as English or not
+ """
+ result = self.chi.checkChi("!!!!!!!!!!!!!!!!!!!")
+ self.assertEqual(result, True)
+
===========changed ref 11===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_false_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "pink jdajj red 9jjidasjp october whisky odiajdq", "English"
+ )
+ self.assertEqual(result, True)
+
===========changed ref 12===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_percentage(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "The password for my computer is tyu456q and the username is admin",
+ "English",
+ )
+ self.assertEqual(dc.languagePercentage, 90.0)
+
===========changed ref 13===========
+ # module: app.test_dictionary
+ class testDictionary(unittest.TestCase):
+ def test_english_yes_two(self):
+ dc = dictionaryChecker()
+ result = dc.confirmlanguage(
+ "hello my name is brandon and this is a normal english text timtable fuse kindle hormone",
+ "English",
+ )
+ self.assertEqual(result, True)
+
===========changed ref 14===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_ascii(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ a = "68 65 6C 6C 6F 20 64 6F 67"
+ result = ep.decrypt(a)
+ self.assertEqual(result["IsPlaintext?"], True)
+
===========changed ref 15===========
+ # module: app.test_encoding
+ class TestEncoding(unittest.TestCase):
+ def test_base64_spaces_yes(self):
+ lc = LanguageChecker.LanguageChecker()
+ ep = EncodingParent(lc)
+ result = ep.decrypt("SGVsbG8gSSBsaWtlIGRvZ3MgYW5kIGNhdHM=")
+ self.assertEqual(result["IsPlaintext?"], True)
+ |
app.neuralNetworkMod.nn/NeuralNetwork.__init__ | Modified | Ciphey~Ciphey | f821545de16eb56144e1316a53e896d499fa6ecb | fixed neural network bug | <6>:<add> self.mh = mathsHelper.mathsHelper()
<del> self.mh = app.mathsHelper.mathsHelper()
| # module: app.neuralNetworkMod.nn
class NeuralNetwork:
def __init__(self):
<0> self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
<1> self.CATEGORIES = [1, 2, 3, 4, 5, 6]
<2> script_dir = os.path.dirname(__file__)
<3> file_path = os.path.join(script_dir, "NeuralNetworkModel.model")
<4> self.MODEL = load_model(file_path)
<5>
<6> self.mh = app.mathsHelper.mathsHelper()
<7>
| ===========unchanged ref 0===========
at: os.path
join(a: StrPath, *paths: StrPath) -> str
join(a: BytesPath, *paths: BytesPath) -> bytes
dirname(p: _PathLike[AnyStr]) -> AnyStr
dirname(p: AnyStr) -> AnyStr
===========changed ref 0===========
# module: app.neuralNetworkMod.nn
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
+ sys.path.append("..")
+ |
app.languageCheckerMod.dictionaryChecker/dictionaryChecker.__init__ | Modified | Ciphey~Ciphey | c0ee4697969a4ecf9ff77174d78d4ab84575a15e | Fixed testing.... again | <0>:<add> self.mh = mathsHelper.mathsHelper()
<del> self.mh = app.mathsHelper.mathsHelper()
| # module: app.languageCheckerMod.dictionaryChecker
-
class dictionaryChecker:
def __init__(self):
<0> self.mh = app.mathsHelper.mathsHelper()
<1> self.languagePercentage = 0.0
<2> self.languageWordsCounter = 0.0
<3> self.languageThreshold = 55
<4>
| ===========unchanged ref 0===========
at: app.languageCheckerMod.dictionaryChecker.dictionaryChecker.checkDictionary
self.languageWordsCounter = counter
self.languagePercentage = self.mh.percentage(
float(self.languageWordsCounter), float(len(text))
)
at: mathsHelper
mathsHelper()
|
app.Decryptor.basicEncryption.reverse/Reverse.__init__ | Modified | Ciphey~Ciphey | c0ee4697969a4ecf9ff77174d78d4ab84575a15e | Fixed testing.... again | <1>:<add> self.mh = mathsHelper.mathsHelper()
<del> self.mh = app.mathsHelper.mathsHelper()
| # module: app.Decryptor.basicEncryption.reverse
class Reverse:
def __init__(self, lc):
<0> self.lc = lc
<1> self.mh = app.mathsHelper.mathsHelper()
<2>
| ===========changed ref 0===========
# module: app.languageCheckerMod.dictionaryChecker
+ sys.path.append("..")
===========changed ref 1===========
# module: app.languageCheckerMod.dictionaryChecker
-
class dictionaryChecker:
def __init__(self):
+ self.mh = mathsHelper.mathsHelper()
- self.mh = app.mathsHelper.mathsHelper()
self.languagePercentage = 0.0
self.languageWordsCounter = 0.0
self.languageThreshold = 55
|
app.languageCheckerMod.chisquared/chiSquared.__init__ | Modified | Ciphey~Ciphey | c0ee4697969a4ecf9ff77174d78d4ab84575a15e | Fixed testing.... again | # module: app.languageCheckerMod.chisquared
class chiSquared:
def __init__(self):
<0> self.languages = {
<1> "English":
<2> # [0.0855, 0.0160, 0.0316, 0.0387, 0.1210,0.0218, 0.0209, 0.0496, 0.0733, 0.0022,0.0081, 0.0421, 0.0253, 0.0717, 0.0747,0.0207, 0.0010, 0.0633, 0.0673, 0.0894,0.0268, 0.0106, 0.0183, 0.0019, 0.0172,0.0011]
<3> # {'A': 8.12, 'B': 1.49, 'C': 2.71, 'D': 4.32, 'E': 12.02, 'F': 2.3, 'G': 2.03, 'H': 5.92, 'I': 7.31, 'J': 0.1, 'K': 0.69, 'L': 3.98, 'M': 2.61, 'N': 6.95, 'O': 7.68, 'P': 1.82, 'Q': 0.11, 'R': 6.02, 'S': 6.28, 'T': 9.1, 'U': 2.88, 'V': 1.11, 'W': 2.09, 'X': 0.17, 'Y': 2.11, 'Z': 0.07}
<4> [
<5> 0.0812,
<6> 0.0271,
<7> 0.0149,
<8> 0.1202,
<9> 0.0432,
<10> 0.0203,
<11> 0.023,
<12> 0.0731,
<13> 0.0592,
<14> 0.0069,
<15> 0.001,
<16> 0.026099999999999998,
<17> 0.0398,
<18> 0.0768,
</s> | ===========below chunk 0===========
# module: app.languageCheckerMod.chisquared
class chiSquared:
def __init__(self):
# offset: 1
0.0011,
0.0182,
0.06280000000000001,
0.0602,
0.0288,
0.091,
0.0209,
0.0111,
0.021099999999999997,
0.0017000000000000001,
0.0007000000000000001,
]
}
self.average = 0.0
self.totalDone = 0.0
self.oldAverage = 0.0
self.mh = app.mathsHelper.mathsHelper()
self.highestLanguage = ""
self.totalChi = 0.0
self.totalEqual = False
self.chisAsaList = []
# these are settings that may impact how the program works overall
self.chiSquaredSignificaneThreshold = 1 # how many stds you want to go below it
self.totalDoneThreshold = 10
self.standarddeviation = 0.00 # the standard deviation I use
self.oldstandarddeviation = 0.00
===========unchanged ref 0===========
at: app.languageCheckerMod.chisquared.chiSquared.chiSquared
self.totalEqual = self.mh.checkEqual(list(letterFreq.values()))
self.highestLanguage = language
self.oldAverage = self.average
self.totalDone += 1
self.average = (self.totalChi + maxChiSquare) / self.totalDone
at: mathsHelper
mathsHelper()
===========changed ref 0===========
# module: app.languageCheckerMod.chisquared
+
+ sys.path.append("..")
+
# I had a bug where empty string was being added to letter freq dictionary
# this solves it :)
punctuation += " "
NUMBERS = "1234567890"
===========changed ref 1===========
# module: app.languageCheckerMod.dictionaryChecker
+ sys.path.append("..")
===========changed ref 2===========
# module: app.Decryptor.basicEncryption.reverse
+
+ sys.path.append("..")
===========changed ref 3===========
# module: app.Decryptor.basicEncryption.reverse
class Reverse:
def __init__(self, lc):
self.lc = lc
+ self.mh = mathsHelper.mathsHelper()
- self.mh = app.mathsHelper.mathsHelper()
===========changed ref 4===========
# module: app.languageCheckerMod.dictionaryChecker
-
class dictionaryChecker:
def __init__(self):
+ self.mh = mathsHelper.mathsHelper()
- self.mh = app.mathsHelper.mathsHelper()
self.languagePercentage = 0.0
self.languageWordsCounter = 0.0
self.languageThreshold = 55
|
|
app.languageCheckerMod.dictionaryChecker/dictionaryChecker.__init__ | Modified | Ciphey~Ciphey | 6d943a498c6b569f7881e6f537db5fc45aabdb72 | Uploaded to PyPi | <0>:<add> self.mh = mh.mathsHelper()
<del> self.mh = mathsHelper.mathsHelper()
| # module: app.languageCheckerMod.dictionaryChecker
+
class dictionaryChecker:
def __init__(self):
<0> self.mh = mathsHelper.mathsHelper()
<1> self.languagePercentage = 0.0
<2> self.languageWordsCounter = 0.0
<3> self.languageThreshold = 55
<4>
| ===========changed ref 0===========
# module: app.languageCheckerMod.dictionaryChecker
+
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
===========changed ref 1===========
# module: app.Decryptor.basicEncryption.viginere
+ try:
+ import Decryptor.basicEncryption.freqAnalysis
+ except ModuleNotFoundError:
+ import app.Decryptor.basicEncryption.freqAnalysis
+
# If vigenereHacker.py is run (instead of imported as a module) call
# the main() function.
if __name__ == "__main__":
v = Viginere()
v.main()
|
app.languageCheckerMod.chisquared/chiSquared.__init__ | Modified | Ciphey~Ciphey | 6d943a498c6b569f7881e6f537db5fc45aabdb72 | Uploaded to PyPi | # module: app.languageCheckerMod.chisquared
class chiSquared:
def __init__(self):
<0> self.languages = {
<1> "English":
<2> # [0.0855, 0.0160, 0.0316, 0.0387, 0.1210,0.0218, 0.0209, 0.0496, 0.0733, 0.0022,0.0081, 0.0421, 0.0253, 0.0717, 0.0747,0.0207, 0.0010, 0.0633, 0.0673, 0.0894,0.0268, 0.0106, 0.0183, 0.0019, 0.0172,0.0011]
<3> # {'A': 8.12, 'B': 1.49, 'C': 2.71, 'D': 4.32, 'E': 12.02, 'F': 2.3, 'G': 2.03, 'H': 5.92, 'I': 7.31, 'J': 0.1, 'K': 0.69, 'L': 3.98, 'M': 2.61, 'N': 6.95, 'O': 7.68, 'P': 1.82, 'Q': 0.11, 'R': 6.02, 'S': 6.28, 'T': 9.1, 'U': 2.88, 'V': 1.11, 'W': 2.09, 'X': 0.17, 'Y': 2.11, 'Z': 0.07}
<4> [
<5> 0.0812,
<6> 0.0271,
<7> 0.0149,
<8> 0.1202,
<9> 0.0432,
<10> 0.0203,
<11> 0.023,
<12> 0.0731,
<13> 0.0592,
<14> 0.0069,
<15> 0.001,
<16> 0.026099999999999998,
<17> 0.0398,
<18> 0.0768,
</s> | ===========below chunk 0===========
# module: app.languageCheckerMod.chisquared
class chiSquared:
def __init__(self):
# offset: 1
0.0011,
0.0182,
0.06280000000000001,
0.0602,
0.0288,
0.091,
0.0209,
0.0111,
0.021099999999999997,
0.0017000000000000001,
0.0007000000000000001,
]
}
self.average = 0.0
self.totalDone = 0.0
self.oldAverage = 0.0
self.mh = mathsHelper.mathsHelper()
self.highestLanguage = ""
self.totalChi = 0.0
self.totalEqual = False
self.chisAsaList = []
# these are settings that may impact how the program works overall
self.chiSquaredSignificaneThreshold = 1 # how many stds you want to go below it
self.totalDoneThreshold = 10
self.standarddeviation = 0.00 # the standard deviation I use
self.oldstandarddeviation = 0.00
===========unchanged ref 0===========
at: app.languageCheckerMod.chisquared.chiSquared.chiSquared
self.totalEqual = self.mh.checkEqual(list(letterFreq.values()))
self.highestLanguage = language
self.oldAverage = self.average
self.totalDone += 1
self.average = (self.totalChi + maxChiSquare) / self.totalDone
at: mathsHelper
mathsHelper()
===========changed ref 0===========
# module: app.languageCheckerMod.chisquared
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
-
===========changed ref 1===========
# module: app.languageCheckerMod.dictionaryChecker
+
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
===========changed ref 2===========
# module: app.languageCheckerMod.dictionaryChecker
+
class dictionaryChecker:
def __init__(self):
+ self.mh = mh.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
self.languagePercentage = 0.0
self.languageWordsCounter = 0.0
self.languageThreshold = 55
===========changed ref 3===========
# module: app.Decryptor.basicEncryption.viginere
+ try:
+ import Decryptor.basicEncryption.freqAnalysis
+ except ModuleNotFoundError:
+ import app.Decryptor.basicEncryption.freqAnalysis
+
# If vigenereHacker.py is run (instead of imported as a module) call
# the main() function.
if __name__ == "__main__":
v = Viginere()
v.main()
|
|
app.languageCheckerMod.LanguageChecker/LanguageChecker.__init__ | Modified | Ciphey~Ciphey | 6d943a498c6b569f7881e6f537db5fc45aabdb72 | Uploaded to PyPi | <0>:<add> self.dictionary = dc.dictionaryChecker()
<add> self.chi = cs.chiSquared()
<del> self.dictionary = languageCheckerMod.dictionaryChecker.dictionaryChecker()
<1>:<del> self.chi = languageCheckerMod.chisquared.chiSquared()
| # module: app.languageCheckerMod.LanguageChecker
+
class LanguageChecker:
def __init__(self):
<0> self.dictionary = languageCheckerMod.dictionaryChecker.dictionaryChecker()
<1> self.chi = languageCheckerMod.chisquared.chiSquared()
<2>
| ===========changed ref 0===========
# module: app.languageCheckerMod.dictionaryChecker
+
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
===========changed ref 1===========
# module: app.languageCheckerMod.chisquared
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
-
===========changed ref 2===========
# module: app.languageCheckerMod.dictionaryChecker
+
class dictionaryChecker:
def __init__(self):
+ self.mh = mh.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
self.languagePercentage = 0.0
self.languageWordsCounter = 0.0
self.languageThreshold = 55
===========changed ref 3===========
# module: app.Decryptor.basicEncryption.viginere
+ try:
+ import Decryptor.basicEncryption.freqAnalysis
+ except ModuleNotFoundError:
+ import app.Decryptor.basicEncryption.freqAnalysis
+
# If vigenereHacker.py is run (instead of imported as a module) call
# the main() function.
if __name__ == "__main__":
v = Viginere()
v.main()
===========changed ref 4===========
# module: app.languageCheckerMod.chisquared
class chiSquared:
def __init__(self):
self.languages = {
"English":
# [0.0855, 0.0160, 0.0316, 0.0387, 0.1210,0.0218, 0.0209, 0.0496, 0.0733, 0.0022,0.0081, 0.0421, 0.0253, 0.0717, 0.0747,0.0207, 0.0010, 0.0633, 0.0673, 0.0894,0.0268, 0.0106, 0.0183, 0.0019, 0.0172,0.0011]
# {'A': 8.12, 'B': 1.49, 'C': 2.71, 'D': 4.32, 'E': 12.02, 'F': 2.3, 'G': 2.03, 'H': 5.92, 'I': 7.31, 'J': 0.1, 'K': 0.69, 'L': 3.98, 'M': 2.61, 'N': 6.95, 'O': 7.68, 'P': 1.82, 'Q': 0.11, 'R': 6.02, 'S': 6.28, 'T': 9.1, 'U': 2.88, 'V': 1.11, 'W': 2.09, 'X': 0.17, 'Y': 2.11, 'Z': 0.07}
[
0.0812,
0.0271,
0.0149,
0.1202,
0.0432,
0.0203,
0.023,
0.0731,
0.0592,
0.0069,
0.001,
0.026099999999999998,
0.0398,
0.0768,
0.0695,
0.0011,
0.</s>
===========changed ref 5===========
# module: app.languageCheckerMod.chisquared
class chiSquared:
def __init__(self):
# offset: 1
<s>
0.0768,
0.0695,
0.0011,
0.0182,
0.06280000000000001,
0.0602,
0.0288,
0.091,
0.0209,
0.0111,
0.021099999999999997,
0.0017000000000000001,
0.0007000000000000001,
]
}
self.average = 0.0
self.totalDone = 0.0
self.oldAverage = 0.0
+ self.mh = mh.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
self.highestLanguage = ""
self.totalChi = 0.0
self.totalEqual = False
self.chisAsaList = []
# these are settings that may impact how the program works overall
self.chiSquaredSignificaneThreshold = 1 # how many stds you want to go below it
self.totalDoneThreshold = 10
self.standarddeviation = 0.00 # the standard deviation I use
self.oldstandarddeviation = 0.00
|
app.Decryptor.basicEncryption.reverse/Reverse.__init__ | Modified | Ciphey~Ciphey | 6d943a498c6b569f7881e6f537db5fc45aabdb72 | Uploaded to PyPi | <1>:<add> self.mh = mh.mathsHelper()
<del> self.mh = mathsHelper.mathsHelper()
| # module: app.Decryptor.basicEncryption.reverse
class Reverse:
def __init__(self, lc):
<0> self.lc = lc
<1> self.mh = mathsHelper.mathsHelper()
<2>
| ===========changed ref 0===========
# module: app.Decryptor.basicEncryption.reverse
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
===========changed ref 1===========
# module: app.languageCheckerMod.dictionaryChecker
+
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
===========changed ref 2===========
# module: app.languageCheckerMod.chisquared
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
-
===========changed ref 3===========
# module: app.languageCheckerMod.LanguageChecker
+
class LanguageChecker:
def __init__(self):
+ self.dictionary = dc.dictionaryChecker()
+ self.chi = cs.chiSquared()
- self.dictionary = languageCheckerMod.dictionaryChecker.dictionaryChecker()
- self.chi = languageCheckerMod.chisquared.chiSquared()
===========changed ref 4===========
# module: app.languageCheckerMod.dictionaryChecker
+
class dictionaryChecker:
def __init__(self):
+ self.mh = mh.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
self.languagePercentage = 0.0
self.languageWordsCounter = 0.0
self.languageThreshold = 55
===========changed ref 5===========
# module: app.languageCheckerMod.LanguageChecker
+ try:
+ import languageCheckerMod.dictionaryChecker as dc
+ except ModuleNotFoundError:
+ import app.languageCheckerMod.dictionaryChecker as dc
+ try:
+ import languageCheckerMod.chisquared as cs
+ except ModuleNotFoundError:
+ import app.languageCheckerMod.chisquared as cs
===========changed ref 6===========
# module: app.Decryptor.basicEncryption.viginere
+ try:
+ import Decryptor.basicEncryption.freqAnalysis
+ except ModuleNotFoundError:
+ import app.Decryptor.basicEncryption.freqAnalysis
+
# If vigenereHacker.py is run (instead of imported as a module) call
# the main() function.
if __name__ == "__main__":
v = Viginere()
v.main()
===========changed ref 7===========
# module: setup
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# The text of the README file
README = (HERE / "README.MD").read_text()
long_description = "An automated decryption tool using machine learning"
DESCRIPTION = "An automated decryption tool using machine learning"
# get list of required installs
with open('requirements.txt') as f:
required = f.read().splitlines()
# This call to setup() does all the work
setup(
+ name="Ciphey",
- name="ciphey",
+ version="3.0.2",
- version="2.0.0",
description="Automated decryption tool using machine learning & common sense",
long_description=README,
long_description_content_type="text/markdown",
url="https://github.com/brandonskerritt/ciphey",
author="Brandon Skerritt",
author_email="[email protected]",
license="MIT",
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
],
+ packages=find_packages("Ciphey", exclude=("tests",)),
- packages=find_packages(exclude=("tests",)),
include_package_data=True,
install_requires=required,
+ entry_points={
- entry_points={
+ 'console_scripts': [
- "console_scripts": [
+ 'ciphey = app.__main__:main',
- "ciphey=app.__main__:main",
+ ],}
- ]
- },
)
===========changed ref 8===========
# module: app.languageCheckerMod.chisquared
class chiSquared:
def __init__(self):
self.languages = {
"English":
# [0.0855, 0.0160, 0.0316, 0.0387, 0.1210,0.0218, 0.0209, 0.0496, 0.0733, 0.0022,0.0081, 0.0421, 0.0253, 0.0717, 0.0747,0.0207, 0.0010, 0.0633, 0.0673, 0.0894,0.0268, 0.0106, 0.0183, 0.0019, 0.0172,0.0011]
# {'A': 8.12, 'B': 1.49, 'C': 2.71, 'D': 4.32, 'E': 12.02, 'F': 2.3, 'G': 2.03, 'H': 5.92, 'I': 7.31, 'J': 0.1, 'K': 0.69, 'L': 3.98, 'M': 2.61, 'N': 6.95, 'O': 7.68, 'P': 1.82, 'Q': 0.11, 'R': 6.02, 'S': 6.28, 'T': 9.1, 'U': 2.88, 'V': 1.11, 'W': 2.09, 'X': 0.17, 'Y': 2.11, 'Z': 0.07}
[
0.0812,
0.0271,
0.0149,
0.1202,
0.0432,
0.0203,
0.023,
0.0731,
0.0592,
0.0069,
0.001,
0.026099999999999998,
0.0398,
0.0768,
0.0695,
0.0011,
0.</s>
===========changed ref 9===========
# module: app.languageCheckerMod.chisquared
class chiSquared:
def __init__(self):
# offset: 1
<s>
0.0768,
0.0695,
0.0011,
0.0182,
0.06280000000000001,
0.0602,
0.0288,
0.091,
0.0209,
0.0111,
0.021099999999999997,
0.0017000000000000001,
0.0007000000000000001,
]
}
self.average = 0.0
self.totalDone = 0.0
self.oldAverage = 0.0
+ self.mh = mh.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
self.highestLanguage = ""
self.totalChi = 0.0
self.totalEqual = False
self.chisAsaList = []
# these are settings that may impact how the program works overall
self.chiSquaredSignificaneThreshold = 1 # how many stds you want to go below it
self.totalDoneThreshold = 10
self.standarddeviation = 0.00 # the standard deviation I use
self.oldstandarddeviation = 0.00
|
app.Decryptor.basicEncryption.basic_parent/BasicParent.__init__ | Modified | Ciphey~Ciphey | 6d943a498c6b569f7881e6f537db5fc45aabdb72 | Uploaded to PyPi | <1>:<add> self.caesar = ca.Caesar(self.lc)
<add> self.reverse = re.Reverse(self.lc)
<add> self.viginere = vi.Viginere(self.lc)
<add> self.pig = pi.PigLatin(self.lc)
<del> self.caesar = Decryptor.basicEncryption.caesar.Caesar(self.lc)
<2>:<del> self.reverse = Decryptor.basicEncryption.reverse.Reverse(self.lc)
<3>:<del> self.viginere = Decryptor.basicEncryption.viginere.Viginere(self.lc)
<4>:<del> self.pig = Decryptor.basicEncryption.pigLatin.PigLatin(self.lc)
| # module: app.Decryptor.basicEncryption.basic_parent
class BasicParent:
def __init__(self, lc):
<0> self.lc = lc
<1> self.caesar = Decryptor.basicEncryption.caesar.Caesar(self.lc)
<2> self.reverse = Decryptor.basicEncryption.reverse.Reverse(self.lc)
<3> self.viginere = Decryptor.basicEncryption.viginere.Viginere(self.lc)
<4> self.pig = Decryptor.basicEncryption.pigLatin.PigLatin(self.lc)
<5> # self.trans = Transposition(self.lc)
<6>
<7> self.list_of_objects = [self.caesar, self.reverse, self.pig]
<8>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.basic_parent.BasicParent.decrypt
self.lc = self.lc + answer["lc"]
at: app.Decryptor.basicEncryption.caesar
Caesar(lc)
===========changed ref 0===========
# module: app.Decryptor.basicEncryption.basic_parent
+ try:
+ import Decryptor.basicEncryption.caesar as ca
+ import Decryptor.basicEncryption.reverse as re
+ import Decryptor.basicEncryption.viginere as vi
+ import Decryptor.basicEncryption.pigLatin as pi
+ except ModuleNotFoundError:
+ import app.Decryptor.basicEncryption.caesar as ca
+ import app.Decryptor.basicEncryption.reverse as re
+ import app.Decryptor.basicEncryption.viginere as vi
+ import app.Decryptor.basicEncryption.pigLatin as pi
"""
So I want to assign the prob distribution to objects
so it makes sense to do this?
list of objects
for each item in the prob distribution
replace that with the appropriate object in the list?
So each object has a getName func that returns the name as a str
new_prob_dict = {}
for key, val in self.prob:
for obj in list:
if obj.getName() == key:
new_prob_dict[obj] = val
But I don't need to do all this, do I?
The dict comes in already sorted.
So why do I need the probability values if it's sorted?
It'd be easier if I make a list in the same order as the dict?
sooo
list_objs = [caeser, etc]
counter = 0
for key, val in self.prob:
for listCounter, item in enumerate(list_objs):
if item.getName() == key:
# moves the item
list_objs.insert(counter, list_objs.pop(listCounter))
counter = counter + 1
Eventually we get a sorted list of obj
"""
===========changed ref 1===========
# module: app.Decryptor.basicEncryption.reverse
class Reverse:
def __init__(self, lc):
self.lc = lc
+ self.mh = mh.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
===========changed ref 2===========
# module: app.Decryptor.basicEncryption.reverse
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
===========changed ref 3===========
# module: app.languageCheckerMod.dictionaryChecker
+
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
===========changed ref 4===========
# module: app.languageCheckerMod.chisquared
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
-
===========changed ref 5===========
# module: app.languageCheckerMod.LanguageChecker
+
class LanguageChecker:
def __init__(self):
+ self.dictionary = dc.dictionaryChecker()
+ self.chi = cs.chiSquared()
- self.dictionary = languageCheckerMod.dictionaryChecker.dictionaryChecker()
- self.chi = languageCheckerMod.chisquared.chiSquared()
===========changed ref 6===========
# module: app.languageCheckerMod.dictionaryChecker
+
class dictionaryChecker:
def __init__(self):
+ self.mh = mh.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
self.languagePercentage = 0.0
self.languageWordsCounter = 0.0
self.languageThreshold = 55
===========changed ref 7===========
# module: app.languageCheckerMod.LanguageChecker
+ try:
+ import languageCheckerMod.dictionaryChecker as dc
+ except ModuleNotFoundError:
+ import app.languageCheckerMod.dictionaryChecker as dc
+ try:
+ import languageCheckerMod.chisquared as cs
+ except ModuleNotFoundError:
+ import app.languageCheckerMod.chisquared as cs
===========changed ref 8===========
# module: app.Decryptor.basicEncryption.viginere
+ try:
+ import Decryptor.basicEncryption.freqAnalysis
+ except ModuleNotFoundError:
+ import app.Decryptor.basicEncryption.freqAnalysis
+
# If vigenereHacker.py is run (instead of imported as a module) call
# the main() function.
if __name__ == "__main__":
v = Viginere()
v.main()
===========changed ref 9===========
# module: setup
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# The text of the README file
README = (HERE / "README.MD").read_text()
long_description = "An automated decryption tool using machine learning"
DESCRIPTION = "An automated decryption tool using machine learning"
# get list of required installs
with open('requirements.txt') as f:
required = f.read().splitlines()
# This call to setup() does all the work
setup(
+ name="Ciphey",
- name="ciphey",
+ version="3.0.2",
- version="2.0.0",
description="Automated decryption tool using machine learning & common sense",
long_description=README,
long_description_content_type="text/markdown",
url="https://github.com/brandonskerritt/ciphey",
author="Brandon Skerritt",
author_email="[email protected]",
license="MIT",
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
],
+ packages=find_packages("Ciphey", exclude=("tests",)),
- packages=find_packages(exclude=("tests",)),
include_package_data=True,
install_requires=required,
+ entry_points={
- entry_points={
+ 'console_scripts': [
- "console_scripts": [
+ 'ciphey = app.__main__:main',
- "ciphey=app.__main__:main",
+ ],}
- ]
- },
)
|
app.test_basicparent/TestBasicParent.test_basic_parent_caesar_yes | Modified | Ciphey~Ciphey | 6d943a498c6b569f7881e6f537db5fc45aabdb72 | Uploaded to PyPi | <0>:<add> lc = lcm.LanguageChecker()
<del> lc = LanguageChecker.LanguageChecker()
| # module: app.test_basicparent
class TestBasicParent(unittest.TestCase):
def test_basic_parent_caesar_yes(self):
<0> lc = LanguageChecker.LanguageChecker()
<1> bp = BasicParent(lc)
<2> result = bp.decrypt(
<3> "uryyb zl sngure uryyb zl zbgure naq v ernyyl qb yvxr n tbbq ratyvfu oernxsnfg"
<4> )
<5> self.assertEqual(result["IsPlaintext?"], True)
<6>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.basic_parent
BasicParent(lc)
at: unittest.case
TestCase(methodName: str=...)
===========changed ref 0===========
# module: app.Decryptor.basicEncryption.reverse
class Reverse:
def __init__(self, lc):
self.lc = lc
+ self.mh = mh.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
===========changed ref 1===========
# module: app.Decryptor.basicEncryption.reverse
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
===========changed ref 2===========
# module: app.languageCheckerMod.dictionaryChecker
+
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
===========changed ref 3===========
# module: app.languageCheckerMod.chisquared
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
-
===========changed ref 4===========
# module: app.languageCheckerMod.LanguageChecker
+
class LanguageChecker:
def __init__(self):
+ self.dictionary = dc.dictionaryChecker()
+ self.chi = cs.chiSquared()
- self.dictionary = languageCheckerMod.dictionaryChecker.dictionaryChecker()
- self.chi = languageCheckerMod.chisquared.chiSquared()
===========changed ref 5===========
# module: app.languageCheckerMod.dictionaryChecker
+
class dictionaryChecker:
def __init__(self):
+ self.mh = mh.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
self.languagePercentage = 0.0
self.languageWordsCounter = 0.0
self.languageThreshold = 55
===========changed ref 6===========
# module: app.languageCheckerMod.LanguageChecker
+ try:
+ import languageCheckerMod.dictionaryChecker as dc
+ except ModuleNotFoundError:
+ import app.languageCheckerMod.dictionaryChecker as dc
+ try:
+ import languageCheckerMod.chisquared as cs
+ except ModuleNotFoundError:
+ import app.languageCheckerMod.chisquared as cs
===========changed ref 7===========
# module: app.Decryptor.basicEncryption.viginere
+ try:
+ import Decryptor.basicEncryption.freqAnalysis
+ except ModuleNotFoundError:
+ import app.Decryptor.basicEncryption.freqAnalysis
+
# If vigenereHacker.py is run (instead of imported as a module) call
# the main() function.
if __name__ == "__main__":
v = Viginere()
v.main()
===========changed ref 8===========
# module: app.Decryptor.basicEncryption.basic_parent
class BasicParent:
def __init__(self, lc):
self.lc = lc
+ self.caesar = ca.Caesar(self.lc)
+ self.reverse = re.Reverse(self.lc)
+ self.viginere = vi.Viginere(self.lc)
+ self.pig = pi.PigLatin(self.lc)
- self.caesar = Decryptor.basicEncryption.caesar.Caesar(self.lc)
- self.reverse = Decryptor.basicEncryption.reverse.Reverse(self.lc)
- self.viginere = Decryptor.basicEncryption.viginere.Viginere(self.lc)
- self.pig = Decryptor.basicEncryption.pigLatin.PigLatin(self.lc)
# self.trans = Transposition(self.lc)
self.list_of_objects = [self.caesar, self.reverse, self.pig]
===========changed ref 9===========
# module: setup
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# The text of the README file
README = (HERE / "README.MD").read_text()
long_description = "An automated decryption tool using machine learning"
DESCRIPTION = "An automated decryption tool using machine learning"
# get list of required installs
with open('requirements.txt') as f:
required = f.read().splitlines()
# This call to setup() does all the work
setup(
+ name="Ciphey",
- name="ciphey",
+ version="3.0.2",
- version="2.0.0",
description="Automated decryption tool using machine learning & common sense",
long_description=README,
long_description_content_type="text/markdown",
url="https://github.com/brandonskerritt/ciphey",
author="Brandon Skerritt",
author_email="[email protected]",
license="MIT",
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
],
+ packages=find_packages("Ciphey", exclude=("tests",)),
- packages=find_packages(exclude=("tests",)),
include_package_data=True,
install_requires=required,
+ entry_points={
- entry_points={
+ 'console_scripts': [
- "console_scripts": [
+ 'ciphey = app.__main__:main',
- "ciphey=app.__main__:main",
+ ],}
- ]
- },
)
===========changed ref 10===========
# module: app.Decryptor.basicEncryption.basic_parent
+ try:
+ import Decryptor.basicEncryption.caesar as ca
+ import Decryptor.basicEncryption.reverse as re
+ import Decryptor.basicEncryption.viginere as vi
+ import Decryptor.basicEncryption.pigLatin as pi
+ except ModuleNotFoundError:
+ import app.Decryptor.basicEncryption.caesar as ca
+ import app.Decryptor.basicEncryption.reverse as re
+ import app.Decryptor.basicEncryption.viginere as vi
+ import app.Decryptor.basicEncryption.pigLatin as pi
"""
So I want to assign the prob distribution to objects
so it makes sense to do this?
list of objects
for each item in the prob distribution
replace that with the appropriate object in the list?
So each object has a getName func that returns the name as a str
new_prob_dict = {}
for key, val in self.prob:
for obj in list:
if obj.getName() == key:
new_prob_dict[obj] = val
But I don't need to do all this, do I?
The dict comes in already sorted.
So why do I need the probability values if it's sorted?
It'd be easier if I make a list in the same order as the dict?
sooo
list_objs = [caeser, etc]
counter = 0
for key, val in self.prob:
for listCounter, item in enumerate(list_objs):
if item.getName() == key:
# moves the item
list_objs.insert(counter, list_objs.pop(listCounter))
counter = counter + 1
Eventually we get a sorted list of obj
"""
|
app.test_basicparent/TestBasicParent.test_basic_parent_reverse_yes | Modified | Ciphey~Ciphey | 6d943a498c6b569f7881e6f537db5fc45aabdb72 | Uploaded to PyPi | <0>:<add> lc = lcm.LanguageChecker()
<del> lc = LanguageChecker.LanguageChecker()
| # module: app.test_basicparent
class TestBasicParent(unittest.TestCase):
def test_basic_parent_reverse_yes(self):
<0> lc = LanguageChecker.LanguageChecker()
<1> bp = BasicParent(lc)
<2> result = bp.decrypt(
<3> "tsafkaerb hsilgne doog a ekil od yllaer i dna rehtom ym olleh rehtaf ym olleh"
<4> )
<5> self.assertEqual(result["IsPlaintext?"], True)
<6>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.basic_parent
BasicParent(lc)
at: app.Decryptor.basicEncryption.basic_parent.BasicParent
decrypt(text)
at: app.test_basicparent.TestBasicParent.test_basic_parent_caesar_yes
lc = lcm.LanguageChecker()
at: unittest.case.TestCase
failureException: Type[BaseException]
longMessage: bool
maxDiff: Optional[int]
_testMethodName: str
_testMethodDoc: str
assertEqual(first: Any, second: Any, msg: Any=...) -> None
===========changed ref 0===========
# module: app.test_basicparent
class TestBasicParent(unittest.TestCase):
def test_basic_parent_caesar_yes(self):
+ lc = lcm.LanguageChecker()
- lc = LanguageChecker.LanguageChecker()
bp = BasicParent(lc)
result = bp.decrypt(
"uryyb zl sngure uryyb zl zbgure naq v ernyyl qb yvxr n tbbq ratyvfu oernxsnfg"
)
self.assertEqual(result["IsPlaintext?"], True)
===========changed ref 1===========
# module: app.Decryptor.basicEncryption.reverse
class Reverse:
def __init__(self, lc):
self.lc = lc
+ self.mh = mh.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
===========changed ref 2===========
# module: app.Decryptor.basicEncryption.reverse
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
===========changed ref 3===========
# module: app.languageCheckerMod.dictionaryChecker
+
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
===========changed ref 4===========
# module: app.languageCheckerMod.chisquared
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
-
===========changed ref 5===========
# module: app.languageCheckerMod.LanguageChecker
+
class LanguageChecker:
def __init__(self):
+ self.dictionary = dc.dictionaryChecker()
+ self.chi = cs.chiSquared()
- self.dictionary = languageCheckerMod.dictionaryChecker.dictionaryChecker()
- self.chi = languageCheckerMod.chisquared.chiSquared()
===========changed ref 6===========
# module: app.languageCheckerMod.dictionaryChecker
+
class dictionaryChecker:
def __init__(self):
+ self.mh = mh.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
self.languagePercentage = 0.0
self.languageWordsCounter = 0.0
self.languageThreshold = 55
===========changed ref 7===========
# module: app.languageCheckerMod.LanguageChecker
+ try:
+ import languageCheckerMod.dictionaryChecker as dc
+ except ModuleNotFoundError:
+ import app.languageCheckerMod.dictionaryChecker as dc
+ try:
+ import languageCheckerMod.chisquared as cs
+ except ModuleNotFoundError:
+ import app.languageCheckerMod.chisquared as cs
===========changed ref 8===========
# module: app.Decryptor.basicEncryption.viginere
+ try:
+ import Decryptor.basicEncryption.freqAnalysis
+ except ModuleNotFoundError:
+ import app.Decryptor.basicEncryption.freqAnalysis
+
# If vigenereHacker.py is run (instead of imported as a module) call
# the main() function.
if __name__ == "__main__":
v = Viginere()
v.main()
===========changed ref 9===========
# module: app.Decryptor.basicEncryption.basic_parent
class BasicParent:
def __init__(self, lc):
self.lc = lc
+ self.caesar = ca.Caesar(self.lc)
+ self.reverse = re.Reverse(self.lc)
+ self.viginere = vi.Viginere(self.lc)
+ self.pig = pi.PigLatin(self.lc)
- self.caesar = Decryptor.basicEncryption.caesar.Caesar(self.lc)
- self.reverse = Decryptor.basicEncryption.reverse.Reverse(self.lc)
- self.viginere = Decryptor.basicEncryption.viginere.Viginere(self.lc)
- self.pig = Decryptor.basicEncryption.pigLatin.PigLatin(self.lc)
# self.trans = Transposition(self.lc)
self.list_of_objects = [self.caesar, self.reverse, self.pig]
===========changed ref 10===========
# module: setup
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# The text of the README file
README = (HERE / "README.MD").read_text()
long_description = "An automated decryption tool using machine learning"
DESCRIPTION = "An automated decryption tool using machine learning"
# get list of required installs
with open('requirements.txt') as f:
required = f.read().splitlines()
# This call to setup() does all the work
setup(
+ name="Ciphey",
- name="ciphey",
+ version="3.0.2",
- version="2.0.0",
description="Automated decryption tool using machine learning & common sense",
long_description=README,
long_description_content_type="text/markdown",
url="https://github.com/brandonskerritt/ciphey",
author="Brandon Skerritt",
author_email="[email protected]",
license="MIT",
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
],
+ packages=find_packages("Ciphey", exclude=("tests",)),
- packages=find_packages(exclude=("tests",)),
include_package_data=True,
install_requires=required,
+ entry_points={
- entry_points={
+ 'console_scripts': [
- "console_scripts": [
+ 'ciphey = app.__main__:main',
- "ciphey=app.__main__:main",
+ ],}
- ]
- },
)
|
app.test_basicparent/TestBasicParent.test_basic_parent_reverse_yes_2 | Modified | Ciphey~Ciphey | 6d943a498c6b569f7881e6f537db5fc45aabdb72 | Uploaded to PyPi | <0>:<add> lc = lcm.LanguageChecker()
<del> lc = LanguageChecker.LanguageChecker()
| # module: app.test_basicparent
class TestBasicParent(unittest.TestCase):
def test_basic_parent_reverse_yes_2(self):
<0> lc = LanguageChecker.LanguageChecker()
<1> bp = BasicParent(lc)
<2> result = bp.decrypt(
<3> "sevom ylpmis rac eht ciffart ruoy lla gnillenut si hcihw redivorp NPV a ekilnU"
<4> )
<5> self.assertEqual(result["IsPlaintext?"], True)
<6>
| ===========unchanged ref 0===========
at: app.Decryptor.basicEncryption.basic_parent
BasicParent(lc)
at: app.Decryptor.basicEncryption.basic_parent.BasicParent
decrypt(text)
at: app.test_basicparent.TestBasicParent.test_basic_parent_reverse_yes
lc = lcm.LanguageChecker()
at: unittest.case.TestCase
assertEqual(first: Any, second: Any, msg: Any=...) -> None
===========changed ref 0===========
# module: app.test_basicparent
class TestBasicParent(unittest.TestCase):
def test_basic_parent_reverse_yes(self):
+ lc = lcm.LanguageChecker()
- lc = LanguageChecker.LanguageChecker()
bp = BasicParent(lc)
result = bp.decrypt(
"tsafkaerb hsilgne doog a ekil od yllaer i dna rehtom ym olleh rehtaf ym olleh"
)
self.assertEqual(result["IsPlaintext?"], True)
===========changed ref 1===========
# module: app.test_basicparent
class TestBasicParent(unittest.TestCase):
def test_basic_parent_caesar_yes(self):
+ lc = lcm.LanguageChecker()
- lc = LanguageChecker.LanguageChecker()
bp = BasicParent(lc)
result = bp.decrypt(
"uryyb zl sngure uryyb zl zbgure naq v ernyyl qb yvxr n tbbq ratyvfu oernxsnfg"
)
self.assertEqual(result["IsPlaintext?"], True)
===========changed ref 2===========
# module: app.Decryptor.basicEncryption.reverse
class Reverse:
def __init__(self, lc):
self.lc = lc
+ self.mh = mh.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
===========changed ref 3===========
# module: app.Decryptor.basicEncryption.reverse
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
===========changed ref 4===========
# module: app.languageCheckerMod.dictionaryChecker
+
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
===========changed ref 5===========
# module: app.languageCheckerMod.chisquared
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
-
===========changed ref 6===========
# module: app.languageCheckerMod.LanguageChecker
+
class LanguageChecker:
def __init__(self):
+ self.dictionary = dc.dictionaryChecker()
+ self.chi = cs.chiSquared()
- self.dictionary = languageCheckerMod.dictionaryChecker.dictionaryChecker()
- self.chi = languageCheckerMod.chisquared.chiSquared()
===========changed ref 7===========
# module: app.languageCheckerMod.dictionaryChecker
+
class dictionaryChecker:
def __init__(self):
+ self.mh = mh.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
self.languagePercentage = 0.0
self.languageWordsCounter = 0.0
self.languageThreshold = 55
===========changed ref 8===========
# module: app.languageCheckerMod.LanguageChecker
+ try:
+ import languageCheckerMod.dictionaryChecker as dc
+ except ModuleNotFoundError:
+ import app.languageCheckerMod.dictionaryChecker as dc
+ try:
+ import languageCheckerMod.chisquared as cs
+ except ModuleNotFoundError:
+ import app.languageCheckerMod.chisquared as cs
===========changed ref 9===========
# module: app.Decryptor.basicEncryption.viginere
+ try:
+ import Decryptor.basicEncryption.freqAnalysis
+ except ModuleNotFoundError:
+ import app.Decryptor.basicEncryption.freqAnalysis
+
# If vigenereHacker.py is run (instead of imported as a module) call
# the main() function.
if __name__ == "__main__":
v = Viginere()
v.main()
===========changed ref 10===========
# module: app.Decryptor.basicEncryption.basic_parent
class BasicParent:
def __init__(self, lc):
self.lc = lc
+ self.caesar = ca.Caesar(self.lc)
+ self.reverse = re.Reverse(self.lc)
+ self.viginere = vi.Viginere(self.lc)
+ self.pig = pi.PigLatin(self.lc)
- self.caesar = Decryptor.basicEncryption.caesar.Caesar(self.lc)
- self.reverse = Decryptor.basicEncryption.reverse.Reverse(self.lc)
- self.viginere = Decryptor.basicEncryption.viginere.Viginere(self.lc)
- self.pig = Decryptor.basicEncryption.pigLatin.PigLatin(self.lc)
# self.trans = Transposition(self.lc)
self.list_of_objects = [self.caesar, self.reverse, self.pig]
===========changed ref 11===========
# module: setup
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# The text of the README file
README = (HERE / "README.MD").read_text()
long_description = "An automated decryption tool using machine learning"
DESCRIPTION = "An automated decryption tool using machine learning"
# get list of required installs
with open('requirements.txt') as f:
required = f.read().splitlines()
# This call to setup() does all the work
setup(
+ name="Ciphey",
- name="ciphey",
+ version="3.0.2",
- version="2.0.0",
description="Automated decryption tool using machine learning & common sense",
long_description=README,
long_description_content_type="text/markdown",
url="https://github.com/brandonskerritt/ciphey",
author="Brandon Skerritt",
author_email="[email protected]",
license="MIT",
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
],
+ packages=find_packages("Ciphey", exclude=("tests",)),
- packages=find_packages(exclude=("tests",)),
include_package_data=True,
install_requires=required,
+ entry_points={
- entry_points={
+ 'console_scripts': [
- "console_scripts": [
+ 'ciphey = app.__main__:main',
- "ciphey=app.__main__:main",
+ ],}
- ]
- },
)
|
app.test_basicparent/TestBasicParent.test_viginere_yes | Modified | Ciphey~Ciphey | 6d943a498c6b569f7881e6f537db5fc45aabdb72 | Uploaded to PyPi | <0>:<add> lc = lcm.LanguageChecker()
<del> lc = LanguageChecker.LanguageChecker()
| # module: app.test_basicparent
class TestBasicParent(unittest.TestCase):
def test_viginere_yes(self):
<0> lc = LanguageChecker.LanguageChecker()
<1> bp = BasicParent(lc)
<2> result = bp.decrypt(
<3> """Adiz Avtzqeci Tmzubb wsa m Pmilqev halpqavtakuoi, lgouqdaf, kdmktsvmztsl, izr xoexghzr kkusitaaf. Vz wsa twbhdg ubalmmzhdad qz hce vmhsgohuqbo ox kaakulmd gxiwvos, krgdurdny i rcmmstugvtawz ca tzm ocicwxfg jf "stscmilpy" oid "uwydptsbuci" wabt hce Lcdwig eiovdnw. Bgfdny qe kddwtk qjnkqpsmev ba pz tzm roohwz at xoexghzr kkusicw izr vrlqrwxist uboedtuuznum. Pimifo Icmlv Emf DI, Lcdwig owdyzd xwd hce Ywhsmnemzh Xovm mby Cqxtsm Supacg (GUKE) oo Bdmfqclwg Bomk, Tzuhvif'a ocyetzqofifo ositjm. Rcm a lqys ce oie vzav wr Vpt 8, lpq gzclqab mekxabnittq tjr Ymdavn fihog cjgbhvnstkgds. Zm psqikmp o iuejqf jf lmoviiicqg aoj jdsvkavs Uzreiz qdpzmdg, dnutgrdny bts helpar jf lpq pjmtm, mb zlwkffjmwktoiiuix avczqzs ohsb ocplv nuby swbfwigk naf ohw Mzwbms umqcifm. Mtoej bts raj pq kjrcmp oo tzm Zooigvmz</s> | ===========below chunk 0===========
# module: app.test_basicparent
class TestBasicParent(unittest.TestCase):
def test_viginere_yes(self):
# offset: 1
)
self.assertEqual(result["IsPlaintext?"], True)
===========unchanged ref 0===========
at: Decryptor.basicEncryption.basic_parent.BasicParent
decrypt(text)
at: app.Decryptor.basicEncryption.basic_parent
BasicParent(lc)
at: app.test_basicparent.TestBasicParent.test_basic_parent_reverse_yes_2
lc = lcm.LanguageChecker()
at: unittest.case.TestCase
assertEqual(first: Any, second: Any, msg: Any=...) -> None
===========changed ref 0===========
# module: app.test_basicparent
class TestBasicParent(unittest.TestCase):
def test_basic_parent_reverse_yes_2(self):
+ lc = lcm.LanguageChecker()
- lc = LanguageChecker.LanguageChecker()
bp = BasicParent(lc)
result = bp.decrypt(
"sevom ylpmis rac eht ciffart ruoy lla gnillenut si hcihw redivorp NPV a ekilnU"
)
self.assertEqual(result["IsPlaintext?"], True)
===========changed ref 1===========
# module: app.test_basicparent
class TestBasicParent(unittest.TestCase):
def test_basic_parent_reverse_yes(self):
+ lc = lcm.LanguageChecker()
- lc = LanguageChecker.LanguageChecker()
bp = BasicParent(lc)
result = bp.decrypt(
"tsafkaerb hsilgne doog a ekil od yllaer i dna rehtom ym olleh rehtaf ym olleh"
)
self.assertEqual(result["IsPlaintext?"], True)
===========changed ref 2===========
# module: app.test_basicparent
class TestBasicParent(unittest.TestCase):
def test_basic_parent_caesar_yes(self):
+ lc = lcm.LanguageChecker()
- lc = LanguageChecker.LanguageChecker()
bp = BasicParent(lc)
result = bp.decrypt(
"uryyb zl sngure uryyb zl zbgure naq v ernyyl qb yvxr n tbbq ratyvfu oernxsnfg"
)
self.assertEqual(result["IsPlaintext?"], True)
===========changed ref 3===========
# module: app.Decryptor.basicEncryption.reverse
class Reverse:
def __init__(self, lc):
self.lc = lc
+ self.mh = mh.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
===========changed ref 4===========
# module: app.Decryptor.basicEncryption.reverse
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
===========changed ref 5===========
# module: app.languageCheckerMod.dictionaryChecker
+
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
===========changed ref 6===========
# module: app.languageCheckerMod.chisquared
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
-
===========changed ref 7===========
# module: app.languageCheckerMod.LanguageChecker
+
class LanguageChecker:
def __init__(self):
+ self.dictionary = dc.dictionaryChecker()
+ self.chi = cs.chiSquared()
- self.dictionary = languageCheckerMod.dictionaryChecker.dictionaryChecker()
- self.chi = languageCheckerMod.chisquared.chiSquared()
===========changed ref 8===========
# module: app.languageCheckerMod.dictionaryChecker
+
class dictionaryChecker:
def __init__(self):
+ self.mh = mh.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
self.languagePercentage = 0.0
self.languageWordsCounter = 0.0
self.languageThreshold = 55
===========changed ref 9===========
# module: app.languageCheckerMod.LanguageChecker
+ try:
+ import languageCheckerMod.dictionaryChecker as dc
+ except ModuleNotFoundError:
+ import app.languageCheckerMod.dictionaryChecker as dc
+ try:
+ import languageCheckerMod.chisquared as cs
+ except ModuleNotFoundError:
+ import app.languageCheckerMod.chisquared as cs
===========changed ref 10===========
# module: app.Decryptor.basicEncryption.viginere
+ try:
+ import Decryptor.basicEncryption.freqAnalysis
+ except ModuleNotFoundError:
+ import app.Decryptor.basicEncryption.freqAnalysis
+
# If vigenereHacker.py is run (instead of imported as a module) call
# the main() function.
if __name__ == "__main__":
v = Viginere()
v.main()
===========changed ref 11===========
# module: app.Decryptor.basicEncryption.basic_parent
class BasicParent:
def __init__(self, lc):
self.lc = lc
+ self.caesar = ca.Caesar(self.lc)
+ self.reverse = re.Reverse(self.lc)
+ self.viginere = vi.Viginere(self.lc)
+ self.pig = pi.PigLatin(self.lc)
- self.caesar = Decryptor.basicEncryption.caesar.Caesar(self.lc)
- self.reverse = Decryptor.basicEncryption.reverse.Reverse(self.lc)
- self.viginere = Decryptor.basicEncryption.viginere.Viginere(self.lc)
- self.pig = Decryptor.basicEncryption.pigLatin.PigLatin(self.lc)
# self.trans = Transposition(self.lc)
self.list_of_objects = [self.caesar, self.reverse, self.pig]
===========changed ref 12===========
# module: setup
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# The text of the README file
README = (HERE / "README.MD").read_text()
long_description = "An automated decryption tool using machine learning"
DESCRIPTION = "An automated decryption tool using machine learning"
# get list of required installs
with open('requirements.txt') as f:
required = f.read().splitlines()
# This call to setup() does all the work
setup(
+ name="Ciphey",
- name="ciphey",
+ version="3.0.2",
- version="2.0.0",
description="Automated decryption tool using machine learning & common sense",
long_description=README,
long_description_content_type="text/markdown",
url="https://github.com/brandonskerritt/ciphey",
author="Brandon Skerritt",
author_email="[email protected]",
license="MIT",
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
],
+ packages=find_packages("Ciphey", exclude=("tests",)),
- packages=find_packages(exclude=("tests",)),
include_package_data=True,
install_requires=required,
+ entry_points={
- entry_points={
+ 'console_scripts': [
- "console_scripts": [
+ 'ciphey = app.__main__:main',
- "ciphey=app.__main__:main",
+ ],}
- ]
- },
)
|
app.neuralNetworkMod.nn/NeuralNetwork.__init__ | Modified | Ciphey~Ciphey | 6d943a498c6b569f7881e6f537db5fc45aabdb72 | Uploaded to PyPi | <6>:<add> self.mh = mh.mathsHelper()
<del> self.mh = mathsHelper.mathsHelper()
| # module: app.neuralNetworkMod.nn
class NeuralNetwork:
def __init__(self):
<0> self.CATEGORIES = ["sha1", "md5", "sha256", "sha512", "caeser", "plaintext"]
<1> self.CATEGORIES = [1, 2, 3, 4, 5, 6]
<2> script_dir = os.path.dirname(__file__)
<3> file_path = os.path.join(script_dir, "NeuralNetworkModel.model")
<4> self.MODEL = load_model(file_path)
<5>
<6> self.mh = mathsHelper.mathsHelper()
<7>
| ===========unchanged ref 0===========
at: os.path
dirname(p: _PathLike[AnyStr]) -> AnyStr
dirname(p: AnyStr) -> AnyStr
===========changed ref 0===========
# module: app.neuralNetworkMod.nn
+
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
-
===========changed ref 1===========
# module: app.Decryptor.basicEncryption.reverse
class Reverse:
def __init__(self, lc):
self.lc = lc
+ self.mh = mh.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
===========changed ref 2===========
# module: app.Decryptor.basicEncryption.reverse
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
===========changed ref 3===========
# module: app.languageCheckerMod.dictionaryChecker
+
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
===========changed ref 4===========
# module: app.languageCheckerMod.chisquared
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
-
===========changed ref 5===========
# module: app.languageCheckerMod.LanguageChecker
+
class LanguageChecker:
def __init__(self):
+ self.dictionary = dc.dictionaryChecker()
+ self.chi = cs.chiSquared()
- self.dictionary = languageCheckerMod.dictionaryChecker.dictionaryChecker()
- self.chi = languageCheckerMod.chisquared.chiSquared()
===========changed ref 6===========
# module: app.languageCheckerMod.dictionaryChecker
+
class dictionaryChecker:
def __init__(self):
+ self.mh = mh.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
self.languagePercentage = 0.0
self.languageWordsCounter = 0.0
self.languageThreshold = 55
===========changed ref 7===========
# module: app.languageCheckerMod.LanguageChecker
+ try:
+ import languageCheckerMod.dictionaryChecker as dc
+ except ModuleNotFoundError:
+ import app.languageCheckerMod.dictionaryChecker as dc
+ try:
+ import languageCheckerMod.chisquared as cs
+ except ModuleNotFoundError:
+ import app.languageCheckerMod.chisquared as cs
===========changed ref 8===========
# module: app.test_basicparent
+ try:
+ from languageCheckerMod import LanguageChecker as lcm
+ except ModuleNotFoundError:
+ from app.languageCheckerMod import LanguageChecker as lcm
+ try:
+ from Decryptor.basicEncryption.basic_parent import BasicParent#
+ except ModuleNotFoundError:
+ from app.Decryptor.basicEncryption.basic_parent import BasicParent
===========changed ref 9===========
# module: app.test_basicparent
class TestBasicParent(unittest.TestCase):
def test_basic_parent_reverse_yes(self):
+ lc = lcm.LanguageChecker()
- lc = LanguageChecker.LanguageChecker()
bp = BasicParent(lc)
result = bp.decrypt(
"tsafkaerb hsilgne doog a ekil od yllaer i dna rehtom ym olleh rehtaf ym olleh"
)
self.assertEqual(result["IsPlaintext?"], True)
===========changed ref 10===========
# module: app.test_basicparent
class TestBasicParent(unittest.TestCase):
def test_basic_parent_reverse_yes_2(self):
+ lc = lcm.LanguageChecker()
- lc = LanguageChecker.LanguageChecker()
bp = BasicParent(lc)
result = bp.decrypt(
"sevom ylpmis rac eht ciffart ruoy lla gnillenut si hcihw redivorp NPV a ekilnU"
)
self.assertEqual(result["IsPlaintext?"], True)
===========changed ref 11===========
# module: app.test_basicparent
class TestBasicParent(unittest.TestCase):
def test_basic_parent_caesar_yes(self):
+ lc = lcm.LanguageChecker()
- lc = LanguageChecker.LanguageChecker()
bp = BasicParent(lc)
result = bp.decrypt(
"uryyb zl sngure uryyb zl zbgure naq v ernyyl qb yvxr n tbbq ratyvfu oernxsnfg"
)
self.assertEqual(result["IsPlaintext?"], True)
===========changed ref 12===========
# module: app.Decryptor.basicEncryption.viginere
+ try:
+ import Decryptor.basicEncryption.freqAnalysis
+ except ModuleNotFoundError:
+ import app.Decryptor.basicEncryption.freqAnalysis
+
# If vigenereHacker.py is run (instead of imported as a module) call
# the main() function.
if __name__ == "__main__":
v = Viginere()
v.main()
===========changed ref 13===========
# module: app.Decryptor.basicEncryption.basic_parent
class BasicParent:
def __init__(self, lc):
self.lc = lc
+ self.caesar = ca.Caesar(self.lc)
+ self.reverse = re.Reverse(self.lc)
+ self.viginere = vi.Viginere(self.lc)
+ self.pig = pi.PigLatin(self.lc)
- self.caesar = Decryptor.basicEncryption.caesar.Caesar(self.lc)
- self.reverse = Decryptor.basicEncryption.reverse.Reverse(self.lc)
- self.viginere = Decryptor.basicEncryption.viginere.Viginere(self.lc)
- self.pig = Decryptor.basicEncryption.pigLatin.PigLatin(self.lc)
# self.trans = Transposition(self.lc)
self.list_of_objects = [self.caesar, self.reverse, self.pig]
===========changed ref 14===========
# module: setup
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# The text of the README file
README = (HERE / "README.MD").read_text()
long_description = "An automated decryption tool using machine learning"
DESCRIPTION = "An automated decryption tool using machine learning"
# get list of required installs
with open('requirements.txt') as f:
required = f.read().splitlines()
# This call to setup() does all the work
setup(
+ name="Ciphey",
- name="ciphey",
+ version="3.0.2",
- version="2.0.0",
description="Automated decryption tool using machine learning & common sense",
long_description=README,
long_description_content_type="text/markdown",
url="https://github.com/brandonskerritt/ciphey",
author="Brandon Skerritt",
author_email="[email protected]",
license="MIT",
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
],
+ packages=find_packages("Ciphey", exclude=("tests",)),
- packages=find_packages(exclude=("tests",)),
include_package_data=True,
install_requires=required,
+ entry_points={
- entry_points={
+ 'console_scripts': [
- "console_scripts": [
+ 'ciphey = app.__main__:main',
- "ciphey=app.__main__:main",
+ ],}
- ]
- },
)
|
app.__main__/Ciphey.__init__ | Modified | Ciphey~Ciphey | 6d943a498c6b569f7881e6f537db5fc45aabdb72 | Uploaded to PyPi | <2>:<add> self.lc = lc.LanguageChecker()
<del> self.lc = LanguageChecker.LanguageChecker()
<3>:<add> self.mh = mh.mathsHelper()
<del> self.mh = mathsHelper.mathsHelper()
| # module: app.__main__
class Ciphey:
def __init__(self, text, cipher):
<0> # general purpose modules
<1> self.ai = NeuralNetwork()
<2> self.lc = LanguageChecker.LanguageChecker()
<3> self.mh = mathsHelper.mathsHelper()
<4>
<5> # the one bit of text given to us to decrypt
<6> self.text = text
<7>
<8> # the decryptor components
<9> self.basic = BasicParent(self.lc)
<10> self.hash = HashParent()
<11> self.encoding = EncodingParent(self.lc)
<12>
<13> self.level = 1
<14> self.sickomode = False
<15> self.cipher = cipher
<16>
| ===========unchanged ref 0===========
at: Decryptor.Encoding.encodingParent
EncodingParent(lc)
at: Decryptor.Hash.hashParent
HashParent()
at: app.Decryptor.Encoding.encodingParent
EncodingParent(lc)
at: app.Decryptor.Hash.hashParent
HashParent()
===========changed ref 0===========
# module: app.__main__
"""
██████╗██╗██████╗ ██╗ ██╗███████╗██╗ ██╗
██╔════╝██║██╔══██╗██║ ██║██╔════╝╚██╗ ██╔╝
██║ ██║██████╔╝███████║█████╗ ╚████╔╝
██║ ██║██╔═══╝ ██╔══██║██╔══╝ ╚██╔╝
╚██████╗██║█�</s>
===========changed ref 1===========
# module: app.__main__
# offset: 1
<s>�████╗██║██║ ██║ ██║███████╗ ██║
© Brandon Skerritt
Github: brandonskerritt
"""
+ try:
+ from languageCheckerMod import LanguageChecker as lc
+ except ModuleNotFoundError:
+ from app.languageCheckerMod import LanguageChecker as lc
+ try:
+ from neuralNetworkMod.nn import NeuralNetwork
+ except ModuleNotFoundError:
+ from app.neuralNetworkMod.nn import NeuralNetwork
+
+ try:
+ from Decryptor.basicEncryption.basic_parent import BasicParent
+ except ModuleNotFoundError:
+ from app.Decryptor.basicEncryption.basic_parent import BasicParent
+
+ try:
+ from Decryptor.Hash.hashParent import HashParent
+ except ModuleNotFoundError:
+ from app.Decryptor.Hash.hashParent import HashParent
+ try:
+ from Decryptor.Encoding.encodingParent import EncodingParent
+ except ModuleNotFoundError:
+ from app.Decryptor.Encoding.encodingParent import EncodingParent
===========changed ref 2===========
+ # module: app.neuralNetworkMod
+
+
===========changed ref 3===========
# module: app.Decryptor.Hash.hashParent
+ try:
+ from Decryptor.Hash import hashBuster
+ except ModuleNotFoundError:
+ from app.Decryptor.Hash import hashBuster
===========changed ref 4===========
# module: app.Decryptor.basicEncryption.reverse
class Reverse:
def __init__(self, lc):
self.lc = lc
+ self.mh = mh.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
===========changed ref 5===========
# module: app.Decryptor.basicEncryption.reverse
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
===========changed ref 6===========
# module: app.languageCheckerMod.dictionaryChecker
+
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
===========changed ref 7===========
# module: app.neuralNetworkMod.nn
+
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
-
===========changed ref 8===========
# module: app.languageCheckerMod.chisquared
sys.path.append("..")
+ try:
+ import mathsHelper as mh
+ except ModuleNotFoundError:
+ import app.mathsHelper as mh
-
===========changed ref 9===========
# module: app.languageCheckerMod.LanguageChecker
+
class LanguageChecker:
def __init__(self):
+ self.dictionary = dc.dictionaryChecker()
+ self.chi = cs.chiSquared()
- self.dictionary = languageCheckerMod.dictionaryChecker.dictionaryChecker()
- self.chi = languageCheckerMod.chisquared.chiSquared()
===========changed ref 10===========
# module: app.languageCheckerMod.dictionaryChecker
+
class dictionaryChecker:
def __init__(self):
+ self.mh = mh.mathsHelper()
- self.mh = mathsHelper.mathsHelper()
self.languagePercentage = 0.0
self.languageWordsCounter = 0.0
self.languageThreshold = 55
===========changed ref 11===========
# module: app.languageCheckerMod.LanguageChecker
+ try:
+ import languageCheckerMod.dictionaryChecker as dc
+ except ModuleNotFoundError:
+ import app.languageCheckerMod.dictionaryChecker as dc
+ try:
+ import languageCheckerMod.chisquared as cs
+ except ModuleNotFoundError:
+ import app.languageCheckerMod.chisquared as cs
===========changed ref 12===========
# module: app.test_basicparent
+ try:
+ from languageCheckerMod import LanguageChecker as lcm
+ except ModuleNotFoundError:
+ from app.languageCheckerMod import LanguageChecker as lcm
+ try:
+ from Decryptor.basicEncryption.basic_parent import BasicParent#
+ except ModuleNotFoundError:
+ from app.Decryptor.basicEncryption.basic_parent import BasicParent
===========changed ref 13===========
# module: app.test_basicparent
class TestBasicParent(unittest.TestCase):
def test_basic_parent_reverse_yes(self):
+ lc = lcm.LanguageChecker()
- lc = LanguageChecker.LanguageChecker()
bp = BasicParent(lc)
result = bp.decrypt(
"tsafkaerb hsilgne doog a ekil od yllaer i dna rehtom ym olleh rehtaf ym olleh"
)
self.assertEqual(result["IsPlaintext?"], True)
===========changed ref 14===========
# module: app.test_basicparent
class TestBasicParent(unittest.TestCase):
def test_basic_parent_reverse_yes_2(self):
+ lc = lcm.LanguageChecker()
- lc = LanguageChecker.LanguageChecker()
bp = BasicParent(lc)
result = bp.decrypt(
"sevom ylpmis rac eht ciffart ruoy lla gnillenut si hcihw redivorp NPV a ekilnU"
)
self.assertEqual(result["IsPlaintext?"], True)
|
app.__main__/Ciphey.one_level_of_decryption | Modified | Ciphey~Ciphey | 69a064142f666eac28b02fec5f25423fb2980102 | Added progress bars | <0>:<add> items = range(1)
<add> with alive_bar() as bar:
<add> for key, val in self.whatToChoose.items():
<del> for key, val in self.whatToChoose.items():
<1>:<add> # https://stackoverflow.com/questions/4843173/how-to-check-if-type-of-a-variable-is-string
<del> # https://stackoverflow.com/questions/4843173/how-to-check-if-type-of-a-variable-is-string
<2>:<add> if not isinstance(key, str):
<del> if not isinstance(key, str):
<3>:<add> key.setProbTable(val)
<del> key.setProbTable(val)
<4>:<add> ret = key.decrypt(self.text)
<del> ret = key.decrypt(self.text)
<5>:<add> if ret["IsPlaintext?"]:
<del> if ret["IsPlaintext?"]:
<6>:<add> print(ret["Plaintext"])
<del> print(ret["Plaintext"])
<7>:<add> if self.cipher:
<del> if self.cipher:
<8>:<add> if ret["Extra Information"] != None:
<del> if ret["Extra Information"] != None:
<9>:<add> print(
<del> print(
<10>:<add> "The cipher used is",
<del> "The cipher used is",
<11>:<add> ret["Cipher"] + ".",
<del> ret["Cipher"] + ".",
<12>:<add> ret["Extra Information"] + ".",
<del> ret["Extra Information"] + ".",
<13>:<add> )
<del> )
<14>:<add> else:
<del> else:
<15>:<add> print(ret["Cipher"])
<del> print(ret["Cipher"])
| # module: app.__main__
class Ciphey:
def one_level_of_decryption(self, file=None, sickomode=None):
<0> for key, val in self.whatToChoose.items():
<1> # https://stackoverflow.com/questions/4843173/how-to-check-if-type-of-a-variable-is-string
<2> if not isinstance(key, str):
<3> key.setProbTable(val)
<4> ret = key.decrypt(self.text)
<5> if ret["IsPlaintext?"]:
<6> print(ret["Plaintext"])
<7> if self.cipher:
<8> if ret["Extra Information"] != None:
<9> print(
<10> "The cipher used is",
<11> ret["Cipher"] + ".",
<12> ret["Extra Information"] + ".",
<13> )
<14> else:
<15> print(ret["Cipher"])
<16>
<17> return ret
<18> print("No encryption found. Here's the probabilities we calculated")
<19> import pprint
<20>
<21> pprint.pprint(self.whatToChoose)
<22>
| ===========unchanged ref 0===========
at: app.__main__
Ciphey(text, cipher)
main()
at: app.__main__.Ciphey
decrypt()
at: app.__main__.main
args = vars(parser.parse_args())
cipher = False
===========changed ref 0===========
# module: app.__main__
class Ciphey:
def decrypt(self):
"""
this method calls 1 level of decrypt
The idea is that so long as decrypt doesnt return the plaintext
to carry on decrypting all subsets of the text until we find one that does decrypt properly
maybe only 2 levels
The way probability distribution works is something like this:
{Encoding: {"Binary": 0.137, "Base64": 0.09, "Hexadecimal": 0.00148}, Hashes: {"SHA1": 0.0906, "MD5": 0.98}}
If an item in the dictionary is == 0.00 then write it down as 0.001
Each parental dictiony object (eg encoding, hashing) is the actual object
So each decipherment class has a parent that controls all of it
sha1, sha256, md5, sha512 etc all belong to the object "hashes"
Ciphey passes each probability to these classes
Sort the dictionary
"""
self.probabilityDistribution = self.ai.predictnn(self.text)[0]
self.whatToChoose = {
self.hash: {
"sha1": self.probabilityDistribution[0],
"md5": self.probabilityDistribution[1],
"sha256": self.probabilityDistribution[2],
"sha512": self.probabilityDistribution[3],
},
self.basic: {"caesar": self.probabilityDistribution[4]},
"plaintext": {"plaintext": self.probabilityDistribution[5]},
</s>
===========changed ref 1===========
# module: app.__main__
class Ciphey:
def decrypt(self):
# offset: 1
<s>": self.probabilityDistribution[4]},
"plaintext": {"plaintext": self.probabilityDistribution[5]},
self.encoding: {
"reverse": self.probabilityDistribution[6],
"base64": self.probabilityDistribution[7],
"binary": self.probabilityDistribution[8],
"hexadecimal": self.probabilityDistribution[9],
"ascii": self.probabilityDistribution[10],
"morse": self.probabilityDistribution[11],
},
}
# sorts each indiviudal sub-dictionary
for key, value in self.whatToChoose.items():
for k, v in value.items():
if v < 0.01:
self.whatToChoose[key][k] = 0.01
for key, value in self.whatToChoose.items():
self.whatToChoose[key] = self.mh.sortDictionary(value)
# the below code selects the most likely one
# and places it at the front
new_dict = {}
maximum = 0.00
max_key = None
max_val = None
for key, value in self.whatToChoose.items():
val = next(iter(value))
val = value[val]
if val >= maximum:
maximum = val
max_key = key
max_val = value
new_dict = collections.OrderedDict()
new_dict[max_key] = max_val
"""
find key in the main dict, delete it
go through that dict and add each component to the end of this dict?
"""
temp = self.whatToChoose
for key, value in self.whatToChoose.items():</s>
===========changed ref 2===========
# module: app.__main__
class Ciphey:
def decrypt(self):
# offset: 2
<s> if key == max_key:
continue
new_dict[key] = value
# ok so this looks wacky but hear me out here
# a.update(b)
# adds all content of dict b onto end of dict a
# no way to add it to front, so I have to do this :)
self.whatToChoose = new_dict
"""
for each dictionary in the dictionary
sort that dictionary
sort the overall dictionary by the first value of the new dictionary
"""
if self.level <= 1:
self.one_level_of_decryption()
else:
if self.sickomode:
- print(
- '''
- MMMMSSSSSSSSSSSSSSSSSMSS;. .dMMMMSSSSSSMMSSSSSSSSS
- MMSSSSSSSMSSSSSMSSSSMMMSS."-.-":MMMMMSSSSMMMMSSMSSSMMS
- MSSSSSSSMSSSSMMMSSMMMPTMM;"-/":MMM^" MMMSSMMMSSMM
- SSSSSSSMMSSMMMMMMMMMP-.MMM : ;.;P dMMMMMMMMMP'
- SSMSSSMMMSMMMMMMMMMP :M;`: ;.'+"""t+dMMMMMMMMMMP
- MMMSSMMMMMMMMPTMMMM"""":P `.\// ' ""^^MMMMMMMP'
- MMMMMMPTMMMMP="TMMMsg, \/ db`c" dMMMMMP"
- MMMMMM TMMM d$$$b ^ /T$; ;-</s> |
ciphey.__main__/Ciphey.__init__ | Modified | Ciphey~Ciphey | 45aa7fefb126550c64e7941ca8985e07e3edf8bb | Output is now greppable | <15>:<add> self.greppable = grep
| # module: ciphey.__main__
class Ciphey:
+ def __init__(self, text, grep=False, cipher=False):
- def __init__(self, text, cipher):
<0> # general purpose modules
<1> self.ai = NeuralNetwork()
<2> self.lc = lc.LanguageChecker()
<3> self.mh = mh.mathsHelper()
<4>
<5> # the one bit of text given to us to decrypt
<6> self.text = text
<7>
<8> # the decryptor components
<9> self.basic = BasicParent(self.lc)
<10> self.hash = HashParent()
<11> self.encoding = EncodingParent(self.lc)
<12>
<13> self.level = 1
<14> self.sickomode = False
<15> self.cipher = cipher
<16>
| ===========unchanged ref 0===========
at: Decryptor.Encoding.encodingParent
EncodingParent(lc)
at: Decryptor.basicEncryption.basic_parent
BasicParent(lc)
at: ciphey.Decryptor.Hash.hashParent
HashParent()
at: ciphey.mathsHelper
mathsHelper()
at: languageCheckerMod.LanguageChecker
LanguageChecker()
at: neuralNetworkMod.nn
NeuralNetwork()
|
ciphey.__main__/Ciphey.one_level_of_decryption | Modified | Ciphey~Ciphey | 45aa7fefb126550c64e7941ca8985e07e3edf8bb | Output is now greppable | <1>:<add> if self.greppable:
<add> self.decryptNormal()
<add> else:
<add> with alive_bar() as bar:
<del> with alive_bar() as bar:
<2>:<del> for key, val in self.whatToChoose.items():
<3>:<del> # https://stackoverflow.com/questions/4843173/how-to-check-if-type-of-a-variable-is-string
<4>:<del> if not isinstance(key, str):
<5>:<del> key.setProbTable(val)
<6>:<del> ret = key.decrypt(self.text)
<7>:<del> if ret["IsPlaintext?"]:
<8>:<del> print(ret["Plaintext"])
<9>:<del> if self.cipher:
<10>:<del> if ret["Extra Information"] != None:
<11>:<del> print(
<12>:<del> "The cipher used is",
<13>:<del> ret["Cipher"] + ".",
<14>:<del> ret["Extra Information"] + ".",
<15>:<del> )
<16>:<del> else:
<17>:<del> print(ret["Cipher"])
<18>:<del>
<19>:<del> bar()
<20>:<del> return ret
<21>:<del> print("No encryption found. Here's the probabilities we calculated")
<22>:<del> import pprint
<23>:<del>
<24>:<del> pprint.pprint(self.whatToChoose)
<25>:<add> self.decryptNormal(bar)
| # module: ciphey.__main__
class Ciphey:
def one_level_of_decryption(self, file=None, sickomode=None):
<0> items = range(1)
<1> with alive_bar() as bar:
<2> for key, val in self.whatToChoose.items():
<3> # https://stackoverflow.com/questions/4843173/how-to-check-if-type-of-a-variable-is-string
<4> if not isinstance(key, str):
<5> key.setProbTable(val)
<6> ret = key.decrypt(self.text)
<7> if ret["IsPlaintext?"]:
<8> print(ret["Plaintext"])
<9> if self.cipher:
<10> if ret["Extra Information"] != None:
<11> print(
<12> "The cipher used is",
<13> ret["Cipher"] + ".",
<14> ret["Extra Information"] + ".",
<15> )
<16> else:
<17> print(ret["Cipher"])
<18>
<19> bar()
<20> return ret
<21> print("No encryption found. Here's the probabilities we calculated")
<22> import pprint
<23>
<24> pprint.pprint(self.whatToChoose)
<25>
| ===========unchanged ref 0===========
at: Decryptor.basicEncryption.basic_parent.BasicParent
setProbTable(prob)
at: ciphey.Decryptor.Encoding.encodingParent.EncodingParent
setProbTable(table)
decrypt(text)
at: ciphey.Decryptor.Hash.hashParent.HashParent
decrypt(text)
setProbTable(val)
at: ciphey.Decryptor.basicEncryption.basic_parent.BasicParent
decrypt(text)
at: ciphey.__main__.Ciphey.__init__
self.text = text
self.greppable = grep
self.cipher = cipher
at: ciphey.__main__.Ciphey.decrypt
self.whatToChoose = {
self.hash: {
"sha1": self.probabilityDistribution[0],
"md5": self.probabilityDistribution[1],
"sha256": self.probabilityDistribution[2],
"sha512": self.probabilityDistribution[3],
},
self.basic: {"caesar": self.probabilityDistribution[4]},
"plaintext": {"plaintext": self.probabilityDistribution[5]},
self.encoding: {
"reverse": self.probabilityDistribution[6],
"base64": self.probabilityDistribution[7],
"binary": self.probabilityDistribution[8],
"hexadecimal": self.probabilityDistribution[9],
"ascii": self.probabilityDistribution[10],
"morse": self.probabilityDistribution[11],
},
}
self.whatToChoose = new_dict
at: collections.OrderedDict
items() -> _OrderedDictItemsView[_KT, _VT]
===========changed ref 0===========
# module: ciphey.__main__
class Ciphey:
+ def __init__(self, text, grep=False, cipher=False):
- def __init__(self, text, cipher):
# general purpose modules
self.ai = NeuralNetwork()
self.lc = lc.LanguageChecker()
self.mh = mh.mathsHelper()
# the one bit of text given to us to decrypt
self.text = text
# the decryptor components
self.basic = BasicParent(self.lc)
self.hash = HashParent()
self.encoding = EncodingParent(self.lc)
self.level = 1
self.sickomode = False
+ self.greppable = grep
self.cipher = cipher
===========changed ref 1===========
# module: ciphey.__main__
class Ciphey:
def decrypt(self):
"""
this method calls 1 level of decrypt
The idea is that so long as decrypt doesnt return the plaintext
to carry on decrypting all subsets of the text until we find one that does decrypt properly
maybe only 2 levels
The way probability distribution works is something like this:
{Encoding: {"Binary": 0.137, "Base64": 0.09, "Hexadecimal": 0.00148}, Hashes: {"SHA1": 0.0906, "MD5": 0.98}}
If an item in the dictionary is == 0.00 then write it down as 0.001
Each parental dictiony object (eg encoding, hashing) is the actual object
So each decipherment class has a parent that controls all of it
sha1, sha256, md5, sha512 etc all belong to the object "hashes"
Ciphey passes each probability to these classes
Sort the dictionary
"""
self.probabilityDistribution = self.ai.predictnn(self.text)[0]
self.whatToChoose = {
self.hash: {
"sha1": self.probabilityDistribution[0],
"md5": self.probabilityDistribution[1],
"sha256": self.probabilityDistribution[2],
"sha512": self.probabilityDistribution[3],
},
self.basic: {"caesar": self.probabilityDistribution[4]},
"plaintext": {"plaintext": self.probabilityDistribution[5]},
</s>
===========changed ref 2===========
# module: ciphey.__main__
class Ciphey:
def decrypt(self):
# offset: 1
<s>": self.probabilityDistribution[4]},
"plaintext": {"plaintext": self.probabilityDistribution[5]},
self.encoding: {
"reverse": self.probabilityDistribution[6],
"base64": self.probabilityDistribution[7],
"binary": self.probabilityDistribution[8],
"hexadecimal": self.probabilityDistribution[9],
"ascii": self.probabilityDistribution[10],
"morse": self.probabilityDistribution[11],
},
}
# sorts each indiviudal sub-dictionary
for key, value in self.whatToChoose.items():
for k, v in value.items():
if v < 0.01:
self.whatToChoose[key][k] = 0.01
for key, value in self.whatToChoose.items():
self.whatToChoose[key] = self.mh.sortDictionary(value)
# the below code selects the most likely one
# and places it at the front
new_dict = {}
maximum = 0.00
max_key = None
max_val = None
for key, value in self.whatToChoose.items():
val = next(iter(value))
val = value[val]
if val >= maximum:
maximum = val
max_key = key
max_val = value
new_dict = collections.OrderedDict()
new_dict[max_key] = max_val
"""
find key in the main dict, delete it
go through that dict and add each component to the end of this dict?
"""
temp = self.whatToChoose
for key, value in self.whatToChoose.</s>
===========changed ref 3===========
# module: ciphey.__main__
class Ciphey:
def decrypt(self):
# offset: 2
<s>
if key == max_key:
continue
new_dict[key] = value
# ok so this looks wacky but hear me out here
# a.update(b)
# adds all content of dict b onto end of dict a
# no way to add it to front, so I have to do this :)
self.whatToChoose = new_dict
"""
for each dictionary in the dictionary
sort that dictionary
sort the overall dictionary by the first value of the new dictionary
"""
if self.level <= 1:
self.one_level_of_decryption()
else:
if self.sickomode:
print("Sicko mode entered")
f = open("decryptionContents.txt", "w")
+ self.one_level_of_decryption(file=f)
- self.one_level_of_decryption(file=f, sickomode=self.sickomode)
for i in range(0, self.level):
# open file and go through each text item
pass
|
ciphey.__main__/main | Modified | Ciphey~Ciphey | 45aa7fefb126550c64e7941ca8985e07e3edf8bb | Output is now greppable | <5>:<add> parser.add_argument('-g','--greppable', help='Are you grepping this output?', required=False)
<del> # parser.add_argument('-g','--greppable', help='Are you grepping this output?', required=False)
<9>:<add> "-c", "--printcipher", help="Do you want information on the cipher?", required=False
<del> "-c", "--cipher", help="What is the cipher used?", required=False
<13>:<add> if args["printcipher"] != None:
<del> if args["cipher"] != None:
<17>:<add> if args['greppable'] != None:
<add> greppable = True
<add> else:
<add> greppable = False
| # module: ciphey.__main__
+
+
def main():
<0> parser = argparse.ArgumentParser(
<1> description="Automated decryption tool. Put in the encrypted text and Ciphey will decrypt it."
<2> )
<3> # parser.add_argument('-f','--file', help='File you want to decrypt', required=False)
<4> # parser.add_argument('-l','--level', help='How many levels of decryption you want (the more levels, the slower it is)', required=False)
<5> # parser.add_argument('-g','--greppable', help='Are you grepping this output?', required=False)
<6> parser.add_argument("-t", "--text", help="Text to decrypt", required=False)
<7> # parser.add_argument('-s','--sicko-mode', help='If it is encrypted Ciphey WILL find it', required=False)
<8> parser.add_argument(
<9> "-c", "--cipher", help="What is the cipher used?", required=False
<10> )
<11>
<12> args = vars(parser.parse_args())
<13> if args["cipher"] != None:
<14> cipher = True
<15> else:
<16> cipher = False
<17> """
<18> ██████╗██╗██████╗ ██╗ ██╗███████╗██╗ ██╗
<19> ██╔════╝██║██╔══██╗█�</s> | ===========below chunk 0===========
# module: ciphey.__main__
+
+
def main():
# offset: 1
██║ ██║██████╔╝███████║█████╗ ╚████╔╝
██║ ██║██╔═══╝ ██╔══██║██╔══╝ ╚██╔╝
╚██████╗██║██║ ██║ ██║███████╗ ██║
Made by Brandon Skerritt"""
# uryyb zl sngure uryyb zl zbgure naq v ernyyl qb yvxr n tbbq ratyvfu oernxsnfg
if args["text"]:
cipherObj = Ciphey(args["text"], cipher)
cipherObj.decrypt()
else:
print(
"You didn't supply any arguments. Look at the help menu with -h or --help"
)
===========unchanged ref 0===========
at: argparse
ArgumentParser(prog: Optional[str]=..., usage: Optional[str]=..., description: Optional[str]=..., epilog: Optional[str]=..., parents: Sequence[ArgumentParser]=..., formatter_class: _FormatterClass=..., prefix_chars: str=..., fromfile_prefix_chars: Optional[str]=..., argument_default: Any=..., conflict_handler: str=..., add_help: bool=..., allow_abbrev: bool=...)
at: argparse.ArgumentParser
parse_args(args: Optional[Sequence[Text]], namespace: None) -> Namespace
parse_args(args: Optional[Sequence[Text]]=...) -> Namespace
parse_args(*, namespace: None) -> Namespace
parse_args(args: Optional[Sequence[Text]], namespace: _N) -> _N
parse_args(*, namespace: _N) -> _N
at: argparse._ActionsContainer
add_argument(*name_or_flags: Text, action: Union[Text, Type[Action]]=..., nargs: Union[int, Text]=..., const: Any=..., default: Any=..., type: Union[Callable[[Text], _T], Callable[[str], _T], FileType]=..., choices: Iterable[_T]=..., required: bool=..., help: Optional[Text]=..., metavar: Optional[Union[Text, Tuple[Text, ...]]]=..., dest: Optional[Text]=..., version: Text=..., **kwargs: Any) -> Action
at: ciphey.__main__.Ciphey.__init__
self.greppable = grep
===========unchanged ref 1===========
at: ciphey.__main__.Ciphey.decrypt
self.whatToChoose = {
self.hash: {
"sha1": self.probabilityDistribution[0],
"md5": self.probabilityDistribution[1],
"sha256": self.probabilityDistribution[2],
"sha512": self.probabilityDistribution[3],
},
self.basic: {"caesar": self.probabilityDistribution[4]},
"plaintext": {"plaintext": self.probabilityDistribution[5]},
self.encoding: {
"reverse": self.probabilityDistribution[6],
"base64": self.probabilityDistribution[7],
"binary": self.probabilityDistribution[8],
"hexadecimal": self.probabilityDistribution[9],
"ascii": self.probabilityDistribution[10],
"morse": self.probabilityDistribution[11],
},
}
self.whatToChoose = new_dict
at: ciphey.__main__.Ciphey.decryptNormal
ret = key.decrypt(self.text)
at: pprint
pprint(object: object, stream: Optional[IO[str]]=..., indent: int=..., width: int=..., depth: Optional[int]=..., *, compact: bool=...) -> None
===========changed ref 0===========
# module: ciphey.__main__
class Ciphey:
+
+
+ def decryptNormal(self, bar=None):
+ for key, val in self.whatToChoose.items():
+ # https://stackoverflow.com/questions/4843173/how-to-check-if-type-of-a-variable-is-string
+ if not isinstance(key, str):
+ key.setProbTable(val)
+ ret = key.decrypt(self.text)
+ if ret["IsPlaintext?"]:
+ print(ret["Plaintext"])
+ if self.cipher:
+ if ret["Extra Information"] != None:
+ print(
+ "The cipher used is",
+ ret["Cipher"] + ".",
+ ret["Extra Information"] + ".",
+ )
+ else:
+ print(ret["Cipher"])
+ return ret
+
+ if not self.greppable:
+ bar()
+
+ print("No encryption found. Here's the probabilities we calculated")
+ import pprint
+
+ pprint.pprint(self.whatToChoose)
+
===========changed ref 1===========
# module: ciphey.__main__
class Ciphey:
+ def __init__(self, text, grep=False, cipher=False):
- def __init__(self, text, cipher):
# general purpose modules
self.ai = NeuralNetwork()
self.lc = lc.LanguageChecker()
self.mh = mh.mathsHelper()
# the one bit of text given to us to decrypt
self.text = text
# the decryptor components
self.basic = BasicParent(self.lc)
self.hash = HashParent()
self.encoding = EncodingParent(self.lc)
self.level = 1
self.sickomode = False
+ self.greppable = grep
self.cipher = cipher
|
ciphey.Decryptor.Encoding.base64/Base64.decrypt | Modified | Ciphey~Ciphey | 1b91321c9ef077180295e1ac64b2936372451fd6 | Fixing probability table issues | <0>:<add> print("Trying bases")
<add> result = "None"
<add> ciph = "None"
<1>:<add> # try to decode, if it fails do nothing until the end
<5>:<add> print(result)
<6>:<del> return {
<7>:<del> "lc": self.lc,
<8>:<del> "IsPlaintext?": False,
<9>:<del> "Plaintext": None,
<10>:<del> "Cipher": None,
<11>:<del> "Extra Information": None,
<12>:<add> None
<del> }
<14>:<del> return {
<15>:<del> "lc": self.lc,
<16>:<del> "IsPlaintext?": False,
<17>:<del> "Plaintext": None,
<18>:<del> "Cipher": None,
<19>:<del> "Extra Information": None,
<20>:<add> None
<del> }
<21>:<add>
<22>:<del> return {
<23>:<del> "lc": self.lc,
<24>:<del> "IsPlaintext?": True,
<25>:<del> "Plaintext": result,
<26>:<del> "Cipher": "Base64 encoded",
<27>:<del> "Extra Information": None,
<28>:<add> return self.goodRet(result, cipher="Base64")
<add>
<del> }
<29>:<add>
<del> else:
<30>:<add> # Base32\
<add> try:
<add> result = base64.b32decode(text)
<add> # yeet turning b strings into normal stringy bois
<add> result = result.decode("utf-8")
<add> except UnicodeDecodeError as e:
<add> None
<add> except binascii.Error as e:
<add> None
<add>
<add> if self.lc.checkLanguage(result):
<add> return | # module: ciphey.Decryptor.Encoding.base64
class Base64:
def decrypt(self, text):
<0>
<1> try:
<2> result = base64.b64decode(text)
<3> # yeet turning b strings into normal stringy bois
<4> result = result.decode("utf-8")
<5> except UnicodeDecodeError as e:
<6> return {
<7> "lc": self.lc,
<8> "IsPlaintext?": False,
<9> "Plaintext": None,
<10> "Cipher": None,
<11> "Extra Information": None,
<12> }
<13> except binascii.Error as e:
<14> return {
<15> "lc": self.lc,
<16> "IsPlaintext?": False,
<17> "Plaintext": None,
<18> "Cipher": None,
<19> "Extra Information": None,
<20> }
<21> if self.lc.checkLanguage(result):
<22> return {
<23> "lc": self.lc,
<24> "IsPlaintext?": True,
<25> "Plaintext": result,
<26> "Cipher": "Base64 encoded",
<27> "Extra Information": None,
<28> }
<29> else:
<30> return {
<31> "lc": self.lc,
<32> "IsPlaintext?": False,
<33> "Plaintext": None,
<34> "Cipher": None,
<35> "Extra Information": None,
<36> }
<37>
| ===========unchanged ref 0===========
at: base64
b64decode(s: _decodable, altchars: Optional[bytes]=..., validate: bool=...) -> bytes
b32decode(s: _decodable, casefold: bool=..., map01: Optional[bytes]=...) -> bytes
b16decode(s: _decodable, casefold: bool=...) -> bytes
at: binascii
Error(*args: object)
at: ciphey.Decryptor.Encoding.base64.Base64
goodRet(result, cipher)
at: ciphey.Decryptor.Encoding.base64.Base64.__init__
self.lc = lc
at: languageCheckerMod.LanguageChecker.LanguageChecker
checkLanguage(text)
|
ciphey.__main__/Ciphey.decryptNormal | Modified | Ciphey~Ciphey | 1b91321c9ef077180295e1ac64b2936372451fd6 | Fixing probability table issues | <1>:<add> # https://stackoverflow.com/questions/4843173/how-to-check-if-type-of-a-variable-is-string
<del> # https://stackoverflow.com/questions/4843173/how-to-check-if-type-of-a-variable-is-string
<17>:<add>
<del>
| # module: ciphey.__main__
class Ciphey:
-
def decryptNormal(self, bar=None):
<0> for key, val in self.whatToChoose.items():
<1> # https://stackoverflow.com/questions/4843173/how-to-check-if-type-of-a-variable-is-string
<2> if not isinstance(key, str):
<3> key.setProbTable(val)
<4> ret = key.decrypt(self.text)
<5> if ret["IsPlaintext?"]:
<6> print(ret["Plaintext"])
<7> if self.cipher:
<8> if ret["Extra Information"] != None:
<9> print(
<10> "The cipher used is",
<11> ret["Cipher"] + ".",
<12> ret["Extra Information"] + ".",
<13> )
<14> else:
<15> print(ret["Cipher"])
<16> return ret
<17>
<18> if not self.greppable:
<19> bar()
<20>
<21> print("No encryption found. Here's the probabilities we calculated")
<22> import pprint
<23>
<24> pprint.pprint(self.whatToChoose)
<25>
| ===========unchanged ref 0===========
at: Decryptor.Encoding.encodingParent.EncodingParent
setProbTable(table)
at: Decryptor.Hash.hashParent.HashParent
decrypt(text)
setProbTable(val)
at: ciphey.Decryptor.Encoding.encodingParent.EncodingParent
decrypt(text)
at: ciphey.Decryptor.basicEncryption.basic_parent.BasicParent
decrypt(text)
setProbTable(prob)
at: ciphey.__main__.Ciphey.__init__
self.text = text
self.greppable = grep
self.cipher = cipher
at: ciphey.__main__.Ciphey.decrypt
self.whatToChoose = {
self.hash: {
"sha1": self.probabilityDistribution[0],
"md5": self.probabilityDistribution[1],
"sha256": self.probabilityDistribution[2],
"sha512": self.probabilityDistribution[3],
},
self.basic: {"caesar": self.probabilityDistribution[4]},
"plaintext": {"plaintext": self.probabilityDistribution[5]},
self.encoding: {
"reverse": self.probabilityDistribution[6],
"base64": self.probabilityDistribution[7],
"binary": self.probabilityDistribution[8],
"hexadecimal": self.probabilityDistribution[9],
"ascii": self.probabilityDistribution[10],
"morse": self.probabilityDistribution[11],
},
}
self.whatToChoose = new_dict
at: collections.OrderedDict
update = __update = _collections_abc.MutableMapping.update
update = __update = _collections_abc.MutableMapping.update
items() -> _OrderedDictItemsView[_KT, _VT]
__ne__ = _collections_abc.MutableMapping.__ne__
__marker = object()
===========unchanged ref 1===========
at: pprint
pprint(object: object, stream: Optional[IO[str]]=..., indent: int=..., width: int=..., depth: Optional[int]=..., *, compact: bool=...) -> None
===========changed ref 0===========
+ # module: ciphey.Decryptor.Encoding.test
+
+
===========changed ref 1===========
+ # module: ciphey.Decryptor.Encoding.base
+
+
===========changed ref 2===========
+ # module: ciphey.Decryptor.Encoding.base
+ class allBases:
+ def __init__(self, lc, encryptedText):
+ self.lc = lc
+ self.encryptedText encryptedText
+
===========changed ref 3===========
+ # module: ciphey.Decryptor.Encoding.base
+ """
+ This class decodes encrypted text using any base up to 1024.
+ """
+
===========changed ref 4===========
+ # module: ciphey.Decryptor.Encoding.base
+ class allBases:
+
+ def numberToBase(n, b):
+ if n == 0:
+ return [0]
+ digits = []
+ while n:
+ digits.append(int(n % b))
+ n //= b
+ return digits[::-1]
+
===========changed ref 5===========
# module: ciphey.Decryptor.Encoding.base64
class Base64:
+ def badRet(self):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": None,
+ "Extra Information": None,
+ }
+
===========changed ref 6===========
# module: ciphey.Decryptor.Encoding.base64
class Base64:
+
+ def goodRet(self, result, cipher):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": result,
+ "Cipher": cipher,
+ "Extra Information": None,
+ }
+
===========changed ref 7===========
# module: ciphey.__main__
class Ciphey:
def decrypt(self):
"""
this method calls 1 level of decrypt
The idea is that so long as decrypt doesnt return the plaintext
to carry on decrypting all subsets of the text until we find one that does decrypt properly
maybe only 2 levels
The way probability distribution works is something like this:
{Encoding: {"Binary": 0.137, "Base64": 0.09, "Hexadecimal": 0.00148}, Hashes: {"SHA1": 0.0906, "MD5": 0.98}}
If an item in the dictionary is == 0.00 then write it down as 0.001
Each parental dictiony object (eg encoding, hashing) is the actual object
So each decipherment class has a parent that controls all of it
sha1, sha256, md5, sha512 etc all belong to the object "hashes"
Ciphey passes each probability to these classes
Sort the dictionary
"""
self.probabilityDistribution = self.ai.predictnn(self.text)[0]
self.whatToChoose = {
self.hash: {
"sha1": self.probabilityDistribution[0],
"md5": self.probabilityDistribution[1],
"sha256": self.probabilityDistribution[2],
"sha512": self.probabilityDistribution[3],
},
self.basic: {"caesar": self.probabilityDistribution[4]},
"plaintext": {"plaintext": self.probabilityDistribution[5]},
</s>
===========changed ref 8===========
# module: ciphey.__main__
class Ciphey:
def decrypt(self):
# offset: 1
<s>": self.probabilityDistribution[4]},
"plaintext": {"plaintext": self.probabilityDistribution[5]},
self.encoding: {
"reverse": self.probabilityDistribution[6],
"base64": self.probabilityDistribution[7],
"binary": self.probabilityDistribution[8],
"hexadecimal": self.probabilityDistribution[9],
"ascii": self.probabilityDistribution[10],
"morse": self.probabilityDistribution[11],
},
}
# sorts each indiviudal sub-dictionary
+ import pprint
+ print(self.whatToChoose)
for key, value in self.whatToChoose.items():
for k, v in value.items():
if v < 0.01:
self.whatToChoose[key][k] = 0.01
for key, value in self.whatToChoose.items():
self.whatToChoose[key] = self.mh.sortDictionary(value)
+
# the below code selects the most likely one
# and places it at the front
new_dict = {}
maximum = 0.00
max_key = None
max_val = None
for key, value in self.whatToChoose.items():
val = next(iter(value))
val = value[val]
if val >= maximum:
maximum = val
max_key = key
max_val = value
new_dict = collections.OrderedDict()
new_dict[max_key] = max_val
"""
find key in the main dict, delete it
go through that dict and add each component to the end of this dict?
"""
</s> |
ciphey.__main__/main | Modified | Ciphey~Ciphey | 1b91321c9ef077180295e1ac64b2936372451fd6 | Fixing probability table issues | <5>:<add> parser.add_argument(
<add> "-g", "--greppable", help="Are you grepping this output?", required=False
<del> parser.add_argument('-g','--greppable', help='Are you grepping this output?', required=False)
<6>:<add> )
<9>:<add> "-c",
<add> "--printcipher",
<add> help="Do you want information on the cipher?",
<add> required=False,
<del> "-c", "--printcipher", help="Do you want information on the cipher?", required=False
<17>:<add> if args["greppable"] != None:
<del> if args['greppable'] != None:
| # module: ciphey.__main__
-
-
def main():
<0> parser = argparse.ArgumentParser(
<1> description="Automated decryption tool. Put in the encrypted text and Ciphey will decrypt it."
<2> )
<3> # parser.add_argument('-f','--file', help='File you want to decrypt', required=False)
<4> # parser.add_argument('-l','--level', help='How many levels of decryption you want (the more levels, the slower it is)', required=False)
<5> parser.add_argument('-g','--greppable', help='Are you grepping this output?', required=False)
<6> parser.add_argument("-t", "--text", help="Text to decrypt", required=False)
<7> # parser.add_argument('-s','--sicko-mode', help='If it is encrypted Ciphey WILL find it', required=False)
<8> parser.add_argument(
<9> "-c", "--printcipher", help="Do you want information on the cipher?", required=False
<10> )
<11>
<12> args = vars(parser.parse_args())
<13> if args["printcipher"] != None:
<14> cipher = True
<15> else:
<16> cipher = False
<17> if args['greppable'] != None:
<18> greppable = True
<19> else:
<20> greppable = False
<21> """
<22> ██████╗██╗██████╗ ██╗ ██╗███████╗██╗ ██╗
<23> ██╔════</s> | ===========below chunk 0===========
# module: ciphey.__main__
-
-
def main():
# offset: 1
██║ ██║██████╔╝███████║█████╗ ╚████╔╝
██║ ██║██╔═══╝ ██╔══██║██╔══╝ ╚██╔╝
╚██████╗██║██║ ██║ ██║███████╗ ██║
Made by Brandon Skerritt"""
# uryyb zl sngure uryyb zl zbgure naq v ernyyl qb yvxr n tbbq ratyvfu oernxsnfg
if args["text"]:
cipherObj = Ciphey(args["text"], greppable, cipher)
cipherObj.decrypt()
else:
print(
"You didn't supply any arguments. Look at the help menu with -h or --help"
)
===========unchanged ref 0===========
at: argparse
ArgumentParser(prog: Optional[str]=..., usage: Optional[str]=..., description: Optional[str]=..., epilog: Optional[str]=..., parents: Sequence[ArgumentParser]=..., formatter_class: _FormatterClass=..., prefix_chars: str=..., fromfile_prefix_chars: Optional[str]=..., argument_default: Any=..., conflict_handler: str=..., add_help: bool=..., allow_abbrev: bool=...)
at: argparse.ArgumentParser
parse_args(args: Optional[Sequence[Text]], namespace: None) -> Namespace
parse_args(args: Optional[Sequence[Text]]=...) -> Namespace
parse_args(*, namespace: None) -> Namespace
parse_args(args: Optional[Sequence[Text]], namespace: _N) -> _N
parse_args(*, namespace: _N) -> _N
at: argparse._ActionsContainer
add_argument(*name_or_flags: Text, action: Union[Text, Type[Action]]=..., nargs: Union[int, Text]=..., const: Any=..., default: Any=..., type: Union[Callable[[Text], _T], Callable[[str], _T], FileType]=..., choices: Iterable[_T]=..., required: bool=..., help: Optional[Text]=..., metavar: Optional[Union[Text, Tuple[Text, ...]]]=..., dest: Optional[Text]=..., version: Text=..., **kwargs: Any) -> Action
at: ciphey.__main__
Ciphey(text, grep=False, cipher=False)
at: ciphey.__main__.Ciphey
decrypt()
===========changed ref 0===========
# module: ciphey.__main__
class Ciphey:
def decrypt(self):
"""
this method calls 1 level of decrypt
The idea is that so long as decrypt doesnt return the plaintext
to carry on decrypting all subsets of the text until we find one that does decrypt properly
maybe only 2 levels
The way probability distribution works is something like this:
{Encoding: {"Binary": 0.137, "Base64": 0.09, "Hexadecimal": 0.00148}, Hashes: {"SHA1": 0.0906, "MD5": 0.98}}
If an item in the dictionary is == 0.00 then write it down as 0.001
Each parental dictiony object (eg encoding, hashing) is the actual object
So each decipherment class has a parent that controls all of it
sha1, sha256, md5, sha512 etc all belong to the object "hashes"
Ciphey passes each probability to these classes
Sort the dictionary
"""
self.probabilityDistribution = self.ai.predictnn(self.text)[0]
self.whatToChoose = {
self.hash: {
"sha1": self.probabilityDistribution[0],
"md5": self.probabilityDistribution[1],
"sha256": self.probabilityDistribution[2],
"sha512": self.probabilityDistribution[3],
},
self.basic: {"caesar": self.probabilityDistribution[4]},
"plaintext": {"plaintext": self.probabilityDistribution[5]},
</s>
===========changed ref 1===========
# module: ciphey.__main__
class Ciphey:
def decrypt(self):
# offset: 1
<s>": self.probabilityDistribution[4]},
"plaintext": {"plaintext": self.probabilityDistribution[5]},
self.encoding: {
"reverse": self.probabilityDistribution[6],
"base64": self.probabilityDistribution[7],
"binary": self.probabilityDistribution[8],
"hexadecimal": self.probabilityDistribution[9],
"ascii": self.probabilityDistribution[10],
"morse": self.probabilityDistribution[11],
},
}
# sorts each indiviudal sub-dictionary
+ import pprint
+ print(self.whatToChoose)
for key, value in self.whatToChoose.items():
for k, v in value.items():
if v < 0.01:
self.whatToChoose[key][k] = 0.01
for key, value in self.whatToChoose.items():
self.whatToChoose[key] = self.mh.sortDictionary(value)
+
# the below code selects the most likely one
# and places it at the front
new_dict = {}
maximum = 0.00
max_key = None
max_val = None
for key, value in self.whatToChoose.items():
val = next(iter(value))
val = value[val]
if val >= maximum:
maximum = val
max_key = key
max_val = value
new_dict = collections.OrderedDict()
new_dict[max_key] = max_val
"""
find key in the main dict, delete it
go through that dict and add each component to the end of this dict?
"""
</s> |
ciphey.mathsHelper/mathsHelper.sortProbTable | Modified | Ciphey~Ciphey | 7f3bf7efbe5c73eb39be40ffc3b02f4fd23ae387 | Trying to fix sort dict | <1>:<del> table = sortDictionary(probTable)
<6>:<add> print(probTable)
<add> for key, value in probTable.items():
<del> for key, value in table:
<9>:<add> for key2, value2 in probTable['value'].items():
<del> for key2, value2 in table['value']:
<17>:<add> del probTable[highestKey]
<del> newTable = del probTable[highestKey]
<20>:<add> d = dict(maxDictPair.update(probTable))
<del> return maxDictPair.update(newTable)
<21>:<add> print(d)
<add> return d
| # module: ciphey.mathsHelper
class mathsHelper:
def sortProbTable(self, probTable):
<0> """Sorts the probabiltiy table"""
<1> table = sortDictionary(probTable)
<2> # for each object: prob table in dictionary
<3> maxOverall = 0
<4> maxDictPair = {}
<5> highestKey = None
<6> for key, value in table:
<7> maxLocal = 0
<8> # for each item in that table
<9> for key2, value2 in table['value']:
<10> maxLocal = maxLocal + value2
<11> if maxLocal > maxOverall:
<12> maxOverall = maxLocal
<13> # so eventually, we get the maximum dict pairing?
<14> maxDictPair[key] = value
<15> highestKey = key
<16> # removes the highest key from the prob table
<17> newTable = del probTable[highestKey]
<18> # returns the max dict (at the start) with the prob table
<19> # this way, it should always work on most likely first.
<20> return maxDictPair.update(newTable)
<21>
| |
ciphey.mathsHelper/mathsHelper.sortProbTable | Modified | Ciphey~Ciphey | dfc5b439d27e841f05a64a1512715c1a2ecdffc6 | Updated mathshelper | <7>:<add> print(key, value)
<9>:<add> print(value)
<add> for key2, value2 in value.items():
<del> for key2, value2 in probTable['value'].items():
| # module: ciphey.mathsHelper
class mathsHelper:
def sortProbTable(self, probTable):
<0> """Sorts the probabiltiy table"""
<1> # for each object: prob table in dictionary
<2> maxOverall = 0
<3> maxDictPair = {}
<4> highestKey = None
<5> print(probTable)
<6> for key, value in probTable.items():
<7> maxLocal = 0
<8> # for each item in that table
<9> for key2, value2 in probTable['value'].items():
<10> maxLocal = maxLocal + value2
<11> if maxLocal > maxOverall:
<12> maxOverall = maxLocal
<13> # so eventually, we get the maximum dict pairing?
<14> maxDictPair[key] = value
<15> highestKey = key
<16> # removes the highest key from the prob table
<17> del probTable[highestKey]
<18> # returns the max dict (at the start) with the prob table
<19> # this way, it should always work on most likely first.
<20> d = dict(maxDictPair.update(probTable))
<21> print(d)
<22> return d
<23>
| ===========unchanged ref 0===========
at: collections.OrderedDict
update = __update = _collections_abc.MutableMapping.update
update = __update = _collections_abc.MutableMapping.update
items() -> _OrderedDictItemsView[_KT, _VT]
__ne__ = _collections_abc.MutableMapping.__ne__
__marker = object()
|
ciphey.mathsHelper/mathsHelper.sortProbTable | Modified | Ciphey~Ciphey | 6cefcfb44660fe233eb7baad03b629485fb5cf72 | Compiles but still wrong | <21>:<add> # this way, it should always work on most likely first.#
<del> # this way, it should always work on most likely first.
<22>:<add> print("# Prob table")
<add> print(probTable)
<add> print("# Max dict pair")
<add> print(maxDictPair)
<add> d = {**maxDictPair, **probTable}
<add> print("################### d is:")
<del> d = dict(maxDictPair.update(probTable))
| # module: ciphey.mathsHelper
class mathsHelper:
def sortProbTable(self, probTable):
<0> """Sorts the probabiltiy table"""
<1> # for each object: prob table in dictionary
<2> maxOverall = 0
<3> maxDictPair = {}
<4> highestKey = None
<5> print(probTable)
<6> for key, value in probTable.items():
<7> print(key, value)
<8> maxLocal = 0
<9> # for each item in that table
<10> print(value)
<11> for key2, value2 in value.items():
<12> maxLocal = maxLocal + value2
<13> if maxLocal > maxOverall:
<14> maxOverall = maxLocal
<15> # so eventually, we get the maximum dict pairing?
<16> maxDictPair[key] = value
<17> highestKey = key
<18> # removes the highest key from the prob table
<19> del probTable[highestKey]
<20> # returns the max dict (at the start) with the prob table
<21> # this way, it should always work on most likely first.
<22> d = dict(maxDictPair.update(probTable))
<23> print(d)
<24> return d
<25>
| ===========unchanged ref 0===========
at: collections.OrderedDict
items() -> _OrderedDictItemsView[_KT, _VT]
|
ciphey.mathsHelper/mathsHelper.sortProbTable | Modified | Ciphey~Ciphey | 0cd252f6beb2341c8172ef68d51d1e8fedda9e95 | Possible fix | <14>:<add> print(f"\nChanging maxDictPair from {maxDictPair} to {highestKey}\n")
| # module: ciphey.mathsHelper
class mathsHelper:
def sortProbTable(self, probTable):
<0> """Sorts the probabiltiy table"""
<1> # for each object: prob table in dictionary
<2> maxOverall = 0
<3> maxDictPair = {}
<4> highestKey = None
<5> print(probTable)
<6> for key, value in probTable.items():
<7> print(key, value)
<8> maxLocal = 0
<9> # for each item in that table
<10> print(value)
<11> for key2, value2 in value.items():
<12> maxLocal = maxLocal + value2
<13> if maxLocal > maxOverall:
<14> maxOverall = maxLocal
<15> # so eventually, we get the maximum dict pairing?
<16> maxDictPair[key] = value
<17> highestKey = key
<18> # removes the highest key from the prob table
<19> del probTable[highestKey]
<20> # returns the max dict (at the start) with the prob table
<21> # this way, it should always work on most likely first.#
<22> print("# Prob table")
<23> print(probTable)
<24> print("# Max dict pair")
<25> print(maxDictPair)
<26> d = {**maxDictPair, **probTable}
<27> print("################### d is:")
<28> print(d)
<29> return d
<30>
| ===========unchanged ref 0===========
at: collections.OrderedDict
update = __update = _collections_abc.MutableMapping.update
update = __update = _collections_abc.MutableMapping.update
items() -> _OrderedDictItemsView[_KT, _VT]
__ne__ = _collections_abc.MutableMapping.__ne__
__marker = object()
|
test/sortProbTable | Modified | Ciphey~Ciphey | d3e1da32638f375de8d4b4424e245794168397f6 | Think i fixed dict sorting in test.py | <5>:<add>
<add> # sorts the prob table before we find max, and converts it to order dicts
<del> print(probTable)
<7>:<add> probTable[key] = newSort(value)
<add>
<add>
<add> # gets maximum key then sets it to the front
<add> for key, value in probTable.items():
<del> print(key, value)
| # module: test
def sortProbTable(probTable):
<0> """Sorts the probabiltiy table"""
<1> # for each object: prob table in dictionary
<2> maxOverall = 0
<3> maxDictPair = {}
<4> highestKey = None
<5> print(probTable)
<6> for key, value in probTable.items():
<7> print(key, value)
<8> maxLocal = 0
<9> # for each item in that table
<10> print(value)
<11> for key2, value2 in value.items():
<12> maxLocal = maxLocal + value2
<13> if maxLocal > maxOverall:
<14> # because the dict doesnt reset
<15> maxDictPair = {}
<16>
<17> maxOverall = maxLocal
<18> # so eventually, we get the maximum dict pairing?
<19> maxDictPair[key] = value
<20> highestKey = key
<21> print(f"\nChanging maxDictPair from {maxDictPair} to {highestKey}\n because local is {maxLocal}. The key / value are {key} {value}")
<22> # removes the highest key from the prob table
<23> del probTable[highestKey]
<24> # returns the max dict (at the start) with the prob table
<25> # this way, it should always work on most likely first.#
<26> d = {**maxDictPair, **probTable}
<27> print(f"\n\nThe maximum dict pair is {maxDictPair}")
<28> print("\n\n")
<29> print("################### d is:")
<30> print(d)
<31> return d
<32>
| ===========unchanged ref 0===========
at: collections
OrderedDict(map: Mapping[_KT, _VT], **kwargs: _VT)
OrderedDict(**kwargs: _VT)
OrderedDict(iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT)
at: test
newSort(newDict)
|
ciphey.mathsHelper/mathsHelper.sortProbTable | Modified | Ciphey~Ciphey | 80665c4f57ffdf7045fa3e94067842ee6d559760 | Bug fixes | <5>:<add>
<add> # sorts the prob table before we find max, and converts it to order dicts
<del> print(probTable)
<7>:<add> probTable[key] = self.newSort(value)
<add> probTable[key] = dict(probTable[key])
<add>
<add>
<add> # gets maximum key then sets it to the front
<add> for key, value in probTable.items():
<del> print(key, value)
<10>:<del> print(value)
<14>:<add> # because the dict doesnt reset
<add> maxDictPair = {}
<del> print(f"\nChanging maxDictPair from {maxDictPair} to {highestKey}\n")
<23>:<del> print("# Prob table")
<24>:<del> print(probTable)
<25>:<del> print("# Max dict pair")
<26>:<del> print(maxDictPair)
<28>:<del> print("################### d is:")
<29>:<del> print(d)
| # module: ciphey.mathsHelper
class mathsHelper:
def sortProbTable(self, probTable):
<0> """Sorts the probabiltiy table"""
<1> # for each object: prob table in dictionary
<2> maxOverall = 0
<3> maxDictPair = {}
<4> highestKey = None
<5> print(probTable)
<6> for key, value in probTable.items():
<7> print(key, value)
<8> maxLocal = 0
<9> # for each item in that table
<10> print(value)
<11> for key2, value2 in value.items():
<12> maxLocal = maxLocal + value2
<13> if maxLocal > maxOverall:
<14> print(f"\nChanging maxDictPair from {maxDictPair} to {highestKey}\n")
<15> maxOverall = maxLocal
<16> # so eventually, we get the maximum dict pairing?
<17> maxDictPair[key] = value
<18> highestKey = key
<19> # removes the highest key from the prob table
<20> del probTable[highestKey]
<21> # returns the max dict (at the start) with the prob table
<22> # this way, it should always work on most likely first.#
<23> print("# Prob table")
<24> print(probTable)
<25> print("# Max dict pair")
<26> print(maxDictPair)
<27> d = {**maxDictPair, **probTable}
<28> print("################### d is:")
<29> print(d)
<30> return d
<31>
| ===========unchanged ref 0===========
at: collections.OrderedDict
update = __update = _collections_abc.MutableMapping.update
update = __update = _collections_abc.MutableMapping.update
items() -> _OrderedDictItemsView[_KT, _VT]
__ne__ = _collections_abc.MutableMapping.__ne__
__marker = object()
|
ciphey.mathsHelper/mathsHelper.stripPuncuation | Modified | Ciphey~Ciphey | 80665c4f57ffdf7045fa3e94067842ee6d559760 | Bug fixes | <1>:<add> text = str(text).translate(str.maketrans("", "", punctuation))
<del> text = text.translate(str.maketrans("", "", punctuation))
| # module: ciphey.mathsHelper
class mathsHelper:
def stripPuncuation(self, text):
<0> """Strips punctuation from a given string"""
<1> text = text.translate(str.maketrans("", "", punctuation))
<2> return text
<3>
| ===========changed ref 0===========
# module: ciphey.mathsHelper
class mathsHelper:
+ def newSort(self, newDict):
+ # gets the key of the dictionary
+ # keyDict = list(newDict.keys())[0]
+ # gets the items of that key (which is a dictionary)
+ d = dict(newDict)
+
+
+
+ # (f"d is {d}")
+ sortedI = OrderedDict(sorted(d.items(), key=lambda x: x[1], reverse=True))
+ # sortedI = sortDictionary(x)
+ return sortedI
+
===========changed ref 1===========
# module: ciphey.mathsHelper
class mathsHelper:
def sortProbTable(self, probTable):
"""Sorts the probabiltiy table"""
# for each object: prob table in dictionary
maxOverall = 0
maxDictPair = {}
highestKey = None
+
+ # sorts the prob table before we find max, and converts it to order dicts
- print(probTable)
for key, value in probTable.items():
+ probTable[key] = self.newSort(value)
+ probTable[key] = dict(probTable[key])
+
+
+ # gets maximum key then sets it to the front
+ for key, value in probTable.items():
- print(key, value)
maxLocal = 0
# for each item in that table
- print(value)
for key2, value2 in value.items():
maxLocal = maxLocal + value2
if maxLocal > maxOverall:
+ # because the dict doesnt reset
+ maxDictPair = {}
- print(f"\nChanging maxDictPair from {maxDictPair} to {highestKey}\n")
maxOverall = maxLocal
# so eventually, we get the maximum dict pairing?
maxDictPair[key] = value
highestKey = key
# removes the highest key from the prob table
del probTable[highestKey]
# returns the max dict (at the start) with the prob table
# this way, it should always work on most likely first.#
- print("# Prob table")
- print(probTable)
- print("# Max dict pair")
- print(maxDictPair)
d = {**maxDictPair, **probTable}
- print("################### d is:")
- print(d)
return d
|
ciphey.languageCheckerMod.chisquared/chiSquared.getLetterFreq | Modified | Ciphey~Ciphey | 80665c4f57ffdf7045fa3e94067842ee6d559760 | Bug fixes | <37>:<add> str(letter) not in punctuation
<del> letter not in punctuation
<39>:<add> and str(letter) not in NUMBERS
<del> and letter not in NUMBERS
| # module: ciphey.languageCheckerMod.chisquared
class chiSquared:
def getLetterFreq(self, text):
<0> # This part creates a letter frequency of the text
<1> letterFreq = {
<2> "a": 0,
<3> "b": 0,
<4> "c": 0,
<5> "d": 0,
<6> "e": 0,
<7> "f": 0,
<8> "g": 0,
<9> "h": 0,
<10> "i": 0,
<11> "j": 0,
<12> "k": 0,
<13> "l": 0,
<14> "m": 0,
<15> "n": 0,
<16> "o": 0,
<17> "p": 0,
<18> "q": 0,
<19> "r": 0,
<20> "s": 0,
<21> "t": 0,
<22> "u": 0,
<23> "v": 0,
<24> "w": 0,
<25> "x": 0,
<26> "y": 0,
<27> "z": 0,
<28> }
<29>
<30> for letter in text.lower():
<31> if letter in letterFreq:
<32> letterFreq[letter] += 1
<33> else:
<34> # if letter is not puncuation, but it is still ascii
<35> # it's probably a different language so add it to the dict
<36> if (
<37> letter not in punctuation
<38> and self.mh.isAscii(letter)
<39> and letter not in NUMBERS
<40> ):
<41> letterFreq[letter] = 1
<42> return letterFreq
<43>
| ===========unchanged ref 0===========
at: ciphey.languageCheckerMod.chisquared
punctuation += " "
NUMBERS = "1234567890"
at: ciphey.languageCheckerMod.chisquared.chiSquared.__init__
self.mh = mh.mathsHelper()
at: mathsHelper.mathsHelper
isAscii(letter)
===========changed ref 0===========
# module: ciphey.mathsHelper
class mathsHelper:
def stripPuncuation(self, text):
"""Strips punctuation from a given string"""
+ text = str(text).translate(str.maketrans("", "", punctuation))
- text = text.translate(str.maketrans("", "", punctuation))
return text
===========changed ref 1===========
# module: ciphey.mathsHelper
class mathsHelper:
+ def newSort(self, newDict):
+ # gets the key of the dictionary
+ # keyDict = list(newDict.keys())[0]
+ # gets the items of that key (which is a dictionary)
+ d = dict(newDict)
+
+
+
+ # (f"d is {d}")
+ sortedI = OrderedDict(sorted(d.items(), key=lambda x: x[1], reverse=True))
+ # sortedI = sortDictionary(x)
+ return sortedI
+
===========changed ref 2===========
# module: ciphey.mathsHelper
class mathsHelper:
def sortProbTable(self, probTable):
"""Sorts the probabiltiy table"""
# for each object: prob table in dictionary
maxOverall = 0
maxDictPair = {}
highestKey = None
+
+ # sorts the prob table before we find max, and converts it to order dicts
- print(probTable)
for key, value in probTable.items():
+ probTable[key] = self.newSort(value)
+ probTable[key] = dict(probTable[key])
+
+
+ # gets maximum key then sets it to the front
+ for key, value in probTable.items():
- print(key, value)
maxLocal = 0
# for each item in that table
- print(value)
for key2, value2 in value.items():
maxLocal = maxLocal + value2
if maxLocal > maxOverall:
+ # because the dict doesnt reset
+ maxDictPair = {}
- print(f"\nChanging maxDictPair from {maxDictPair} to {highestKey}\n")
maxOverall = maxLocal
# so eventually, we get the maximum dict pairing?
maxDictPair[key] = value
highestKey = key
# removes the highest key from the prob table
del probTable[highestKey]
# returns the max dict (at the start) with the prob table
# this way, it should always work on most likely first.#
- print("# Prob table")
- print(probTable)
- print("# Max dict pair")
- print(maxDictPair)
d = {**maxDictPair, **probTable}
- print("################### d is:")
- print(d)
return d
|
ciphey.Decryptor.Encoding.base64/Base64.decrypt | Modified | Ciphey~Ciphey | 80665c4f57ffdf7045fa3e94067842ee6d559760 | Bug fixes | <0>:<del> print("Trying bases")
<9>:<del> print(result)
<13>:<add> None
<add> except ValueError:
<28>:<add> except ValueError:
<add> None
<40>:<add> None
<add> except ValueError:
| # module: ciphey.Decryptor.Encoding.base64
class Base64:
def decrypt(self, text):
<0> print("Trying bases")
<1> result = "None"
<2> ciph = "None"
<3>
<4> # try to decode, if it fails do nothing until the end
<5> try:
<6> result = base64.b64decode(text)
<7> # yeet turning b strings into normal stringy bois
<8> result = result.decode("utf-8")
<9> print(result)
<10> except UnicodeDecodeError as e:
<11> None
<12> except binascii.Error as e:
<13> None
<14>
<15> if self.lc.checkLanguage(result):
<16> return self.goodRet(result, cipher="Base64")
<17>
<18>
<19> # Base32\
<20> try:
<21> result = base64.b32decode(text)
<22> # yeet turning b strings into normal stringy bois
<23> result = result.decode("utf-8")
<24> except UnicodeDecodeError as e:
<25> None
<26> except binascii.Error as e:
<27> None
<28>
<29> if self.lc.checkLanguage(result):
<30> return self.goodRet(result, cipher="Base32")
<31>
<32> # Base16
<33> try:
<34> result = base64.b16decode(text)
<35> # yeet turning b strings into normal stringy bois
<36> result = result.decode("utf-8")
<37> except UnicodeDecodeError as e:
<38> None
<39> except binascii.Error as e:
<40> None
<41>
<42> if self.lc.checkLanguage(result):
<43> return self.goodRet(result, cipher="Base16")
<44>
<45> # Base85
<46> try:
<47> result = base64.b85decode(text)
<48> # yeet turning b</s> | ===========below chunk 0===========
# module: ciphey.Decryptor.Encoding.base64
class Base64:
def decrypt(self, text):
# offset: 1
result = result.decode("utf-8")
except UnicodeDecodeError as e:
None
except binascii.Error as e:
None
if self.lc.checkLanguage(result):
return self.goodRet(result, cipher="Base85")
# if nothing works, it has failed.
return self.badRet
===========unchanged ref 0===========
at: base64
b64decode(s: _decodable, altchars: Optional[bytes]=..., validate: bool=...) -> bytes
b32decode(s: _decodable, casefold: bool=..., map01: Optional[bytes]=...) -> bytes
b16decode(s: _decodable, casefold: bool=...) -> bytes
b85decode(b: _decodable) -> bytes
at: binascii
Error(*args: object)
at: ciphey.Decryptor.Encoding.base64.Base64
goodRet(result, cipher)
at: ciphey.Decryptor.Encoding.base64.Base64.__init__
self.lc = lc
at: languageCheckerMod.LanguageChecker.LanguageChecker
checkLanguage(text)
===========changed ref 0===========
# module: ciphey.mathsHelper
class mathsHelper:
def stripPuncuation(self, text):
"""Strips punctuation from a given string"""
+ text = str(text).translate(str.maketrans("", "", punctuation))
- text = text.translate(str.maketrans("", "", punctuation))
return text
===========changed ref 1===========
# module: ciphey.mathsHelper
class mathsHelper:
+ def newSort(self, newDict):
+ # gets the key of the dictionary
+ # keyDict = list(newDict.keys())[0]
+ # gets the items of that key (which is a dictionary)
+ d = dict(newDict)
+
+
+
+ # (f"d is {d}")
+ sortedI = OrderedDict(sorted(d.items(), key=lambda x: x[1], reverse=True))
+ # sortedI = sortDictionary(x)
+ return sortedI
+
===========changed ref 2===========
# module: ciphey.languageCheckerMod.chisquared
class chiSquared:
def getLetterFreq(self, text):
# This part creates a letter frequency of the text
letterFreq = {
"a": 0,
"b": 0,
"c": 0,
"d": 0,
"e": 0,
"f": 0,
"g": 0,
"h": 0,
"i": 0,
"j": 0,
"k": 0,
"l": 0,
"m": 0,
"n": 0,
"o": 0,
"p": 0,
"q": 0,
"r": 0,
"s": 0,
"t": 0,
"u": 0,
"v": 0,
"w": 0,
"x": 0,
"y": 0,
"z": 0,
}
for letter in text.lower():
if letter in letterFreq:
letterFreq[letter] += 1
else:
# if letter is not puncuation, but it is still ascii
# it's probably a different language so add it to the dict
if (
+ str(letter) not in punctuation
- letter not in punctuation
and self.mh.isAscii(letter)
+ and str(letter) not in NUMBERS
- and letter not in NUMBERS
):
letterFreq[letter] = 1
return letterFreq
===========changed ref 3===========
# module: ciphey.mathsHelper
class mathsHelper:
def sortProbTable(self, probTable):
"""Sorts the probabiltiy table"""
# for each object: prob table in dictionary
maxOverall = 0
maxDictPair = {}
highestKey = None
+
+ # sorts the prob table before we find max, and converts it to order dicts
- print(probTable)
for key, value in probTable.items():
+ probTable[key] = self.newSort(value)
+ probTable[key] = dict(probTable[key])
+
+
+ # gets maximum key then sets it to the front
+ for key, value in probTable.items():
- print(key, value)
maxLocal = 0
# for each item in that table
- print(value)
for key2, value2 in value.items():
maxLocal = maxLocal + value2
if maxLocal > maxOverall:
+ # because the dict doesnt reset
+ maxDictPair = {}
- print(f"\nChanging maxDictPair from {maxDictPair} to {highestKey}\n")
maxOverall = maxLocal
# so eventually, we get the maximum dict pairing?
maxDictPair[key] = value
highestKey = key
# removes the highest key from the prob table
del probTable[highestKey]
# returns the max dict (at the start) with the prob table
# this way, it should always work on most likely first.#
- print("# Prob table")
- print(probTable)
- print("# Max dict pair")
- print(maxDictPair)
d = {**maxDictPair, **probTable}
- print("################### d is:")
- print(d)
return d
|
ciphey.Decryptor.Encoding.encodingParent/EncodingParent.decrypt | Modified | Ciphey~Ciphey | 80665c4f57ffdf7045fa3e94067842ee6d559760 | Bug fixes | <16>:<add> print(f"\n\n The answer object is {answer}\n\n")
| # module: ciphey.Decryptor.Encoding.encodingParent
class EncodingParent:
def decrypt(self, text):
<0> self.text = text
<1> torun = [self.base64, self.binary, self.hex, self.ascii, self.morse]
<2> """
<3> ok so I have an array of functions
<4> and I want to apply each function to some text
<5> (text, function)
<6> but the way it works is you apply text to every item in the array (function)
<7>
<8> """
<9> from multiprocessing.dummy import Pool as ThreadPool
<10>
<11> pool = ThreadPool(4)
<12> answers = pool.map(self.callDecrypt, torun)
<13>
<14> for answer in answers:
<15> # adds the LC objects together
<16> self.lc = self.lc + answer["lc"]
<17> if answer["IsPlaintext?"]:
<18> return answer
<19> return {
<20> "lc": self.lc,
<21> "IsPlaintext?": False,
<22> "Plaintext": None,
<23> "Cipher": None,
<24> "Extra Information": None,
<25> }
<26>
| ===========unchanged ref 0===========
at: ciphey.Decryptor.Encoding.encodingParent.EncodingParent
callDecrypt(obj)
at: ciphey.Decryptor.Encoding.encodingParent.EncodingParent.__init__
self.lc = lc
self.base64 = Base64(self.lc)
self.binary = Binary(self.lc)
self.hex = Hexadecimal(self.lc)
self.ascii = Ascii(self.lc)
self.morse = MorseCode(self.lc)
at: multiprocessing.dummy
Pool(processes: Optional[int]=..., initializer: Optional[Callable[..., Any]]=..., initargs: Iterable[Any]=...) -> Any
===========changed ref 0===========
# module: ciphey.mathsHelper
class mathsHelper:
def stripPuncuation(self, text):
"""Strips punctuation from a given string"""
+ text = str(text).translate(str.maketrans("", "", punctuation))
- text = text.translate(str.maketrans("", "", punctuation))
return text
===========changed ref 1===========
# module: ciphey.mathsHelper
class mathsHelper:
+ def newSort(self, newDict):
+ # gets the key of the dictionary
+ # keyDict = list(newDict.keys())[0]
+ # gets the items of that key (which is a dictionary)
+ d = dict(newDict)
+
+
+
+ # (f"d is {d}")
+ sortedI = OrderedDict(sorted(d.items(), key=lambda x: x[1], reverse=True))
+ # sortedI = sortDictionary(x)
+ return sortedI
+
===========changed ref 2===========
# module: ciphey.languageCheckerMod.chisquared
class chiSquared:
def getLetterFreq(self, text):
# This part creates a letter frequency of the text
letterFreq = {
"a": 0,
"b": 0,
"c": 0,
"d": 0,
"e": 0,
"f": 0,
"g": 0,
"h": 0,
"i": 0,
"j": 0,
"k": 0,
"l": 0,
"m": 0,
"n": 0,
"o": 0,
"p": 0,
"q": 0,
"r": 0,
"s": 0,
"t": 0,
"u": 0,
"v": 0,
"w": 0,
"x": 0,
"y": 0,
"z": 0,
}
for letter in text.lower():
if letter in letterFreq:
letterFreq[letter] += 1
else:
# if letter is not puncuation, but it is still ascii
# it's probably a different language so add it to the dict
if (
+ str(letter) not in punctuation
- letter not in punctuation
and self.mh.isAscii(letter)
+ and str(letter) not in NUMBERS
- and letter not in NUMBERS
):
letterFreq[letter] = 1
return letterFreq
===========changed ref 3===========
# module: ciphey.mathsHelper
class mathsHelper:
def sortProbTable(self, probTable):
"""Sorts the probabiltiy table"""
# for each object: prob table in dictionary
maxOverall = 0
maxDictPair = {}
highestKey = None
+
+ # sorts the prob table before we find max, and converts it to order dicts
- print(probTable)
for key, value in probTable.items():
+ probTable[key] = self.newSort(value)
+ probTable[key] = dict(probTable[key])
+
+
+ # gets maximum key then sets it to the front
+ for key, value in probTable.items():
- print(key, value)
maxLocal = 0
# for each item in that table
- print(value)
for key2, value2 in value.items():
maxLocal = maxLocal + value2
if maxLocal > maxOverall:
+ # because the dict doesnt reset
+ maxDictPair = {}
- print(f"\nChanging maxDictPair from {maxDictPair} to {highestKey}\n")
maxOverall = maxLocal
# so eventually, we get the maximum dict pairing?
maxDictPair[key] = value
highestKey = key
# removes the highest key from the prob table
del probTable[highestKey]
# returns the max dict (at the start) with the prob table
# this way, it should always work on most likely first.#
- print("# Prob table")
- print(probTable)
- print("# Max dict pair")
- print(maxDictPair)
d = {**maxDictPair, **probTable}
- print("################### d is:")
- print(d)
return d
===========changed ref 4===========
# module: ciphey.Decryptor.Encoding.base64
class Base64:
def decrypt(self, text):
- print("Trying bases")
result = "None"
ciph = "None"
# try to decode, if it fails do nothing until the end
try:
result = base64.b64decode(text)
# yeet turning b strings into normal stringy bois
result = result.decode("utf-8")
- print(result)
except UnicodeDecodeError as e:
None
except binascii.Error as e:
+ None
+ except ValueError:
None
if self.lc.checkLanguage(result):
return self.goodRet(result, cipher="Base64")
# Base32\
try:
result = base64.b32decode(text)
# yeet turning b strings into normal stringy bois
result = result.decode("utf-8")
except UnicodeDecodeError as e:
None
except binascii.Error as e:
None
+ except ValueError:
+ None
if self.lc.checkLanguage(result):
return self.goodRet(result, cipher="Base32")
# Base16
try:
result = base64.b16decode(text)
# yeet turning b strings into normal stringy bois
result = result.decode("utf-8")
except UnicodeDecodeError as e:
None
except binascii.Error as e:
+ None
+ except ValueError:
None
if self.lc.checkLanguage(result):
return self.goodRet(result, cipher="Base16")
# Base85
try:
result = base64.b85decode(text)
# yeet turning b strings into normal stringy bois
result</s> |
ciphey.Decryptor.Encoding.base64/Base64.decrypt | Modified | Ciphey~Ciphey | ce7350c2c18cdaccda51e6ab799f541f99aaee17 | Fixed bases | # module: ciphey.Decryptor.Encoding.base64
class Base64:
def decrypt(self, text):
<0> result = "None"
<1> ciph = "None"
<2>
<3> # try to decode, if it fails do nothing until the end
<4> try:
<5> result = base64.b64decode(text)
<6> # yeet turning b strings into normal stringy bois
<7> result = result.decode("utf-8")
<8> except UnicodeDecodeError as e:
<9> None
<10> except binascii.Error as e:
<11> None
<12> except ValueError:
<13> None
<14>
<15> if self.lc.checkLanguage(result):
<16> return self.goodRet(result, cipher="Base64")
<17>
<18>
<19> # Base32\
<20> try:
<21> result = base64.b32decode(text)
<22> # yeet turning b strings into normal stringy bois
<23> result = result.decode("utf-8")
<24> except UnicodeDecodeError as e:
<25> None
<26> except binascii.Error as e:
<27> None
<28> except ValueError:
<29> None
<30>
<31> if self.lc.checkLanguage(result):
<32> return self.goodRet(result, cipher="Base32")
<33>
<34> # Base16
<35> try:
<36> result = base64.b16decode(text)
<37> # yeet turning b strings into normal stringy bois
<38> result = result.decode("utf-8")
<39> except UnicodeDecodeError as e:
<40> None
<41> except binascii.Error as e:
<42> None
<43> except ValueError:
<44> None
<45>
<46> if self.lc.checkLanguage(result):
<47> return self.goodRet(result, cipher="Base16")
<48>
<49> # Base85
<50> try:
<51> result = base</s> | ===========below chunk 0===========
# module: ciphey.Decryptor.Encoding.base64
class Base64:
def decrypt(self, text):
# offset: 1
# yeet turning b strings into normal stringy bois
result = result.decode("utf-8")
except UnicodeDecodeError as e:
None
except binascii.Error as e:
None
except ValueError:
None
if self.lc.checkLanguage(result):
return self.goodRet(result, cipher="Base85")
# if nothing works, it has failed.
return self.badRet
===========unchanged ref 0===========
at: base64
b64decode(s: _decodable, altchars: Optional[bytes]=..., validate: bool=...) -> bytes
b32decode(s: _decodable, casefold: bool=..., map01: Optional[bytes]=...) -> bytes
b16decode(s: _decodable, casefold: bool=...) -> bytes
b85decode(b: _decodable) -> bytes
at: binascii
Error(*args: object)
at: ciphey.Decryptor.Encoding.base64.Base64
goodRet(result, cipher)
badRet()
at: ciphey.Decryptor.Encoding.base64.Base64.__init__
self.lc = lc
at: languageCheckerMod.LanguageChecker.LanguageChecker
checkLanguage(text)
|
|
ciphey.Decryptor.Encoding.encodingParent/EncodingParent.decrypt | Modified | Ciphey~Ciphey | ce7350c2c18cdaccda51e6ab799f541f99aaee17 | Fixed bases | <16>:<del> print(f"\n\n The answer object is {answer}\n\n")
| # module: ciphey.Decryptor.Encoding.encodingParent
class EncodingParent:
def decrypt(self, text):
<0> self.text = text
<1> torun = [self.base64, self.binary, self.hex, self.ascii, self.morse]
<2> """
<3> ok so I have an array of functions
<4> and I want to apply each function to some text
<5> (text, function)
<6> but the way it works is you apply text to every item in the array (function)
<7>
<8> """
<9> from multiprocessing.dummy import Pool as ThreadPool
<10>
<11> pool = ThreadPool(4)
<12> answers = pool.map(self.callDecrypt, torun)
<13>
<14> for answer in answers:
<15> # adds the LC objects together
<16> print(f"\n\n The answer object is {answer}\n\n")
<17> self.lc = self.lc + answer["lc"]
<18> if answer["IsPlaintext?"]:
<19> return answer
<20> return {
<21> "lc": self.lc,
<22> "IsPlaintext?": False,
<23> "Plaintext": None,
<24> "Cipher": None,
<25> "Extra Information": None,
<26> }
<27>
| ===========unchanged ref 0===========
at: ciphey.Decryptor.Encoding.encodingParent.EncodingParent
callDecrypt(obj)
at: ciphey.Decryptor.Encoding.encodingParent.EncodingParent.__init__
self.lc = lc
self.base64 = Base64(self.lc)
self.binary = Binary(self.lc)
self.hex = Hexadecimal(self.lc)
self.ascii = Ascii(self.lc)
self.morse = MorseCode(self.lc)
at: multiprocessing.dummy
Pool(processes: Optional[int]=..., initializer: Optional[Callable[..., Any]]=..., initargs: Iterable[Any]=...) -> Any
===========changed ref 0===========
# module: ciphey.Decryptor.Encoding.base64
class Base64:
def decrypt(self, text):
result = "None"
ciph = "None"
# try to decode, if it fails do nothing until the end
try:
result = base64.b64decode(text)
# yeet turning b strings into normal stringy bois
result = result.decode("utf-8")
except UnicodeDecodeError as e:
None
except binascii.Error as e:
None
except ValueError:
None
if self.lc.checkLanguage(result):
return self.goodRet(result, cipher="Base64")
# Base32\
try:
result = base64.b32decode(text)
# yeet turning b strings into normal stringy bois
result = result.decode("utf-8")
except UnicodeDecodeError as e:
None
except binascii.Error as e:
None
except ValueError:
None
if self.lc.checkLanguage(result):
return self.goodRet(result, cipher="Base32")
# Base16
try:
result = base64.b16decode(text)
# yeet turning b strings into normal stringy bois
result = result.decode("utf-8")
except UnicodeDecodeError as e:
None
except binascii.Error as e:
None
except ValueError:
None
if self.lc.checkLanguage(result):
return self.goodRet(result, cipher="Base16")
# Base85
try:
result = base64.b85decode(text)
# yeet turning b strings into normal stringy bois
result = result.decode("utf-8")
except UnicodeDecodeError as e:
None
</s>
===========changed ref 1===========
# module: ciphey.Decryptor.Encoding.base64
class Base64:
def decrypt(self, text):
# offset: 1
<s>y bois
result = result.decode("utf-8")
except UnicodeDecodeError as e:
None
except binascii.Error as e:
None
except ValueError:
None
if self.lc.checkLanguage(result):
return self.goodRet(result, cipher="Base85")
# if nothing works, it has failed.
+ return self.badRet()
- return self.badRet
|
ciphey.mathsHelper/mathsHelper.sortDictionary | Modified | Ciphey~Ciphey | 57a27f8e1c8030e1bee5c5c8ef4626f2fa3bdb10 | Cleaning up unused files | <1>:<add>
<del>
| # module: ciphey.mathsHelper
class mathsHelper:
def sortDictionary(self, dictionary):
<0> """Sorts a dictionary"""
<1>
<2> return dict(OrderedDict(sorted(dictionary.items())))
<3>
| ===========unchanged ref 0===========
at: collections
OrderedDict(map: Mapping[_KT, _VT], **kwargs: _VT)
OrderedDict(**kwargs: _VT)
OrderedDict(iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT)
|
ciphey.mathsHelper/mathsHelper.sortProbTable | Modified | Ciphey~Ciphey | 57a27f8e1c8030e1bee5c5c8ef4626f2fa3bdb10 | Cleaning up unused files | <5>:<add>
<del>
<11>:<del>
| # module: ciphey.mathsHelper
class mathsHelper:
def sortProbTable(self, probTable):
<0> """Sorts the probabiltiy table"""
<1> # for each object: prob table in dictionary
<2> maxOverall = 0
<3> maxDictPair = {}
<4> highestKey = None
<5>
<6> # sorts the prob table before we find max, and converts it to order dicts
<7> for key, value in probTable.items():
<8> probTable[key] = self.newSort(value)
<9> probTable[key] = dict(probTable[key])
<10>
<11>
<12> # gets maximum key then sets it to the front
<13> for key, value in probTable.items():
<14> maxLocal = 0
<15> # for each item in that table
<16> for key2, value2 in value.items():
<17> maxLocal = maxLocal + value2
<18> if maxLocal > maxOverall:
<19> # because the dict doesnt reset
<20> maxDictPair = {}
<21> maxOverall = maxLocal
<22> # so eventually, we get the maximum dict pairing?
<23> maxDictPair[key] = value
<24> highestKey = key
<25> # removes the highest key from the prob table
<26> del probTable[highestKey]
<27> # returns the max dict (at the start) with the prob table
<28> # this way, it should always work on most likely first.#
<29> d = {**maxDictPair, **probTable}
<30> return d
<31>
| ===========changed ref 0===========
# module: ciphey.mathsHelper
class mathsHelper:
def sortDictionary(self, dictionary):
"""Sorts a dictionary"""
+
-
return dict(OrderedDict(sorted(dictionary.items())))
|
ciphey.mathsHelper/mathsHelper.newSort | Modified | Ciphey~Ciphey | 57a27f8e1c8030e1bee5c5c8ef4626f2fa3bdb10 | Cleaning up unused files | <4>:<del>
<5>:<del>
<6>:<del>
<7>:<add>
| # module: ciphey.mathsHelper
class mathsHelper:
+
def newSort(self, newDict):
<0> # gets the key of the dictionary
<1> # keyDict = list(newDict.keys())[0]
<2> # gets the items of that key (which is a dictionary)
<3> d = dict(newDict)
<4>
<5>
<6>
<7> # (f"d is {d}")
<8> sortedI = OrderedDict(sorted(d.items(), key=lambda x: x[1], reverse=True))
<9> # sortedI = sortDictionary(x)
<10> return sortedI
<11>
| ===========unchanged ref 0===========
at: collections
OrderedDict(map: Mapping[_KT, _VT], **kwargs: _VT)
OrderedDict(**kwargs: _VT)
OrderedDict(iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT)
===========changed ref 0===========
# module: ciphey.mathsHelper
class mathsHelper:
def sortDictionary(self, dictionary):
"""Sorts a dictionary"""
+
-
return dict(OrderedDict(sorted(dictionary.items())))
===========changed ref 1===========
# module: ciphey.mathsHelper
class mathsHelper:
def sortProbTable(self, probTable):
"""Sorts the probabiltiy table"""
# for each object: prob table in dictionary
maxOverall = 0
maxDictPair = {}
highestKey = None
+
-
# sorts the prob table before we find max, and converts it to order dicts
for key, value in probTable.items():
probTable[key] = self.newSort(value)
probTable[key] = dict(probTable[key])
-
# gets maximum key then sets it to the front
for key, value in probTable.items():
maxLocal = 0
# for each item in that table
for key2, value2 in value.items():
maxLocal = maxLocal + value2
if maxLocal > maxOverall:
# because the dict doesnt reset
maxDictPair = {}
maxOverall = maxLocal
# so eventually, we get the maximum dict pairing?
maxDictPair[key] = value
highestKey = key
# removes the highest key from the prob table
del probTable[highestKey]
# returns the max dict (at the start) with the prob table
# this way, it should always work on most likely first.#
d = {**maxDictPair, **probTable}
return d
|
ciphey.Decryptor.Encoding.base64/Base64.decrypt | Modified | Ciphey~Ciphey | 57a27f8e1c8030e1bee5c5c8ef4626f2fa3bdb10 | Cleaning up unused files | <14>:<add>
<del>
<17>:<del>
<18>:<del>
<19>:<add>
<45>:<add>
<del>
<48>:<add>
<del>
| # module: ciphey.Decryptor.Encoding.base64
class Base64:
def decrypt(self, text):
<0> result = "None"
<1> ciph = "None"
<2>
<3> # try to decode, if it fails do nothing until the end
<4> try:
<5> result = base64.b64decode(text)
<6> # yeet turning b strings into normal stringy bois
<7> result = result.decode("utf-8")
<8> except UnicodeDecodeError as e:
<9> None
<10> except binascii.Error as e:
<11> None
<12> except ValueError:
<13> None
<14>
<15> if self.lc.checkLanguage(result):
<16> return self.goodRet(result, cipher="Base64")
<17>
<18>
<19> # Base32\
<20> try:
<21> result = base64.b32decode(text)
<22> # yeet turning b strings into normal stringy bois
<23> result = result.decode("utf-8")
<24> except UnicodeDecodeError as e:
<25> None
<26> except binascii.Error as e:
<27> None
<28> except ValueError:
<29> None
<30>
<31> if self.lc.checkLanguage(result):
<32> return self.goodRet(result, cipher="Base32")
<33>
<34> # Base16
<35> try:
<36> result = base64.b16decode(text)
<37> # yeet turning b strings into normal stringy bois
<38> result = result.decode("utf-8")
<39> except UnicodeDecodeError as e:
<40> None
<41> except binascii.Error as e:
<42> None
<43> except ValueError:
<44> None
<45>
<46> if self.lc.checkLanguage(result):
<47> return self.goodRet(result, cipher="Base16")
<48>
<49> # Base85
<50> try:
<51> result = base</s> | ===========below chunk 0===========
# module: ciphey.Decryptor.Encoding.base64
class Base64:
def decrypt(self, text):
# offset: 1
# yeet turning b strings into normal stringy bois
result = result.decode("utf-8")
except UnicodeDecodeError as e:
None
except binascii.Error as e:
None
except ValueError:
None
if self.lc.checkLanguage(result):
return self.goodRet(result, cipher="Base85")
# if nothing works, it has failed.
return self.badRet()
===========unchanged ref 0===========
at: base64
b64decode(s: _decodable, altchars: Optional[bytes]=..., validate: bool=...) -> bytes
b32decode(s: _decodable, casefold: bool=..., map01: Optional[bytes]=...) -> bytes
b16decode(s: _decodable, casefold: bool=...) -> bytes
b85decode(b: _decodable) -> bytes
at: binascii
Error(*args: object)
at: ciphey.Decryptor.Encoding.base64.Base64
goodRet(result, cipher)
badRet()
at: ciphey.Decryptor.Encoding.base64.Base64.__init__
self.lc = lc
at: languageCheckerMod.LanguageChecker.LanguageChecker
checkLanguage(text)
===========changed ref 0===========
# module: ciphey.mathsHelper
class mathsHelper:
def sortDictionary(self, dictionary):
"""Sorts a dictionary"""
+
-
return dict(OrderedDict(sorted(dictionary.items())))
===========changed ref 1===========
# module: ciphey.mathsHelper
class mathsHelper:
+
def newSort(self, newDict):
# gets the key of the dictionary
# keyDict = list(newDict.keys())[0]
# gets the items of that key (which is a dictionary)
d = dict(newDict)
-
-
-
+
# (f"d is {d}")
sortedI = OrderedDict(sorted(d.items(), key=lambda x: x[1], reverse=True))
# sortedI = sortDictionary(x)
return sortedI
===========changed ref 2===========
# module: ciphey.mathsHelper
class mathsHelper:
def sortProbTable(self, probTable):
"""Sorts the probabiltiy table"""
# for each object: prob table in dictionary
maxOverall = 0
maxDictPair = {}
highestKey = None
+
-
# sorts the prob table before we find max, and converts it to order dicts
for key, value in probTable.items():
probTable[key] = self.newSort(value)
probTable[key] = dict(probTable[key])
-
# gets maximum key then sets it to the front
for key, value in probTable.items():
maxLocal = 0
# for each item in that table
for key2, value2 in value.items():
maxLocal = maxLocal + value2
if maxLocal > maxOverall:
# because the dict doesnt reset
maxDictPair = {}
maxOverall = maxLocal
# so eventually, we get the maximum dict pairing?
maxDictPair[key] = value
highestKey = key
# removes the highest key from the prob table
del probTable[highestKey]
# returns the max dict (at the start) with the prob table
# this way, it should always work on most likely first.#
d = {**maxDictPair, **probTable}
return d
|
ciphey.Decryptor.basicEncryption.transposition/Transposition.hackTransposition | Modified | Ciphey~Ciphey | 90a0ee311493d25f9e56ae381ae2c01153610817 | Fixing transposition | <8>:<add> decryptedText = self.decryptMessage(key, message)
<del> decryptedText = self.transpositionDecrypt.decryptMessage(key, message)
| # module: ciphey.Decryptor.basicEncryption.transposition
class Transposition:
def hackTransposition(self, message):
<0> print("Hacking...")
<1>
<2> # Python programs can be stopped at any time by pressing Ctrl-C (on
<3> # Windows) or Ctrl-D (on Mac and Linux)
<4>
<5> # brute-force by looping through every possible key
<6> for key in range(1, len(message)):
<7>
<8> decryptedText = self.transpositionDecrypt.decryptMessage(key, message)
<9>
<10> # if self.lc.checkLanguage(decryptedText):
<11> # Check with user to see if the decrypted key has been found.
<12> if self.lc.checkLanguage(decryptedText):
<13> return {
<14> "lc": self.lc,
<15> "IsPlaintext?": True,
<16> "Plaintext": decryptedText,
<17> "Cipher": "Transposition",
<18> "Extra Information": f"The key is {key}",
<19> }
<20> return {
<21> "lc": self.lc,
<22> "IsPlaintext?": False,
<23> "Plaintext": None,
<24> "Cipher": "Transposition",
<25> "Extra Information": None,
<26> }
<27>
| ===========unchanged ref 0===========
at: ciphey.Decryptor.basicEncryption.transposition.Transposition
decryptMessage(key, message)
at: ciphey.Decryptor.basicEncryption.transposition.Transposition.__init__
self.lc = lc
|
ciphey.Decryptor.basicEncryption.transposition/Transposition.main | Modified | Ciphey~Ciphey | 0fcb8c744315fe2da9c375da9522fe74a7be7f38 | Transposition cipher is now implemented but doesn't decrypt | <0>:<add> # this main exists so i can test it
<add> myMessage = """Cb b rssti aieih rooaopbrtnsceee er es no npfgcwu plri
<del> myMessage = """Cb b rssti aieih rooaopbrtnsceee er es no npfgcwu plri
<1>:<del>
<2>:<del> ch nitaalr eiuengiteehb(e1 hilincegeoamn fubehgtarndcstudmd nM eu eacBoltaetee
<3>:<del>
<4>:<del> oinebcdkyremdteghn.aa2r81a condari fmps" tad l t oisn sit u1rnd stara nvhn fs
<5>:<del>
<6>:<del> edbh ee,n e necrg6 8nmisv l nc muiftegiitm tutmg cm shSs9fcie ebintcaets h a
<7>:<del>
<8>:<del> ihda cctrhe ele 1O7 aaoem waoaatdahretnhechaopnooeapece9etfncdbgsoeb uuteitgna.
<9>:<del>
<10>:<del> rteoh add e,D7c1Etnpneehtn beete" evecoal lsfmcrl iu1cifgo ai. sl1rchdnheev sh
<11>:<del>
<12>:<del> meBd ies e9t)nh,htcnoecplrrh ,ide hmtlme. pheaLem,toeinfgn t e9yce da' eN eMp a
<13>:<del>
<14>:<del> ffn Fc1o ge eohg dere.eec s nfap yox hla yon. lnrnsreaBoa t,e eitsw il ulpbdofg
<15>:<del>
<16>:<del> BRe bwlmprraio po droB wtinue r Pieno nc ayieeto'lulcih sfnc ownaSserbereiaSm
<17>:<del>
<18>:<del> -eaiah, nnrttgcC maciiritvledastinideI nn rms iehn tsigaBmuoetcet
| # module: ciphey.Decryptor.basicEncryption.transposition
-
-
class Transposition:
-
def main(self):
<0> myMessage = """Cb b rssti aieih rooaopbrtnsceee er es no npfgcwu plri
<1>
<2> ch nitaalr eiuengiteehb(e1 hilincegeoamn fubehgtarndcstudmd nM eu eacBoltaetee
<3>
<4> oinebcdkyremdteghn.aa2r81a condari fmps" tad l t oisn sit u1rnd stara nvhn fs
<5>
<6> edbh ee,n e necrg6 8nmisv l nc muiftegiitm tutmg cm shSs9fcie ebintcaets h a
<7>
<8> ihda cctrhe ele 1O7 aaoem waoaatdahretnhechaopnooeapece9etfncdbgsoeb uuteitgna.
<9>
<10> rteoh add e,D7c1Etnpneehtn beete" evecoal lsfmcrl iu1cifgo ai. sl1rchdnheev sh
<11>
<12> meBd ies e9t)nh,htcnoecplrrh ,ide hmtlme. pheaLem,toeinfgn t e9yce da' eN eMp a
<13>
<14> ffn Fc1o ge eohg dere.eec s nfap yox hla yon. lnrnsreaBoa t,e eitsw il ulpbdofg
<15>
<16> BRe bwlmprraio po droB wtinue r Pieno nc ayieeto'lulcih sfnc ownaSserbereiaSm
<17>
<18> -eaiah, nnrttgcC maciiritvledastinideI nn rms iehn tsigaBmuoetcet</s> | ===========below chunk 0===========
# module: ciphey.Decryptor.basicEncryption.transposition
-
-
class Transposition:
-
def main(self):
# offset: 1
hackedMessage = self.hackTransposition(myMessage)
===========changed ref 0===========
+ # module: ciphey.Decryptor.basicEncryption.oldtransposition
+
+
+ class Transposition:
+
+ def getName(self):
+ return "Transposition"
+
===========changed ref 1===========
+ # module: ciphey.Decryptor.basicEncryption.oldtransposition
+
+
+ class Transposition:
+ def __init__(self, lc):
+ self.lc = lc
+
===========changed ref 2===========
+ # module: ciphey.Decryptor.basicEncryption.oldtransposition
+
+
+ if __name__ == "__main__":
+ t = Transposition("a")
+ t.main()
+
===========changed ref 3===========
+ # module: ciphey.Decryptor.basicEncryption.oldtransposition
+
+
+ class Transposition:
+
+ def decrypt(self, text):
+ # Brute-force by looping through every possible key.
+ decryptedText = self.hackTransposition("""ehlol ym aftehrh ellom ym ohteXrX""")
+
===========changed ref 4===========
+ # module: ciphey.Decryptor.basicEncryption.oldtransposition
+
+
+ class Transposition:
+
+ def hackTransposition(self, message):
+ print("Hacking...")
+
+ # Python programs can be stopped at any time by pressing Ctrl-C (on
+ # Windows) or Ctrl-D (on Mac and Linux)
+
+ # brute-force by looping through every possible key
+ for key in range(1, len(message)):
+
+ decryptedText = self.decryptMessage(key, message)
+
+ # if self.lc.checkLanguage(decryptedText):
+ # Check with user to see if the decrypted key has been found.
+ if self.lc.checkLanguage(decryptedText):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": decryptedText,
+ "Cipher": "Transposition",
+ "Extra Information": f"The key is {key}",
+ }
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": "Transposition",
+ "Extra Information": None,
+ }
+
===========changed ref 5===========
+ # module: ciphey.Decryptor.basicEncryption.oldtransposition
+
+
+ class Transposition:
+
+ def decryptMessage(self, key, message):
+ # The transposition decrypt function will simulate the "columns" and
+ # "rows" of the grid that the plaintext is written on by using a list
+ # of strings. First, we need to calculate a few values.
+
+ # The number of "columns" in our transposition grid:
+ numOfColumns = math.ceil(len(message) / key)
+ # The number of "rows" in our grid will need:
+ numOfRows = key
+ # The number of "shaded boxes" in the last "column" of the grid:
+ numOfShadedBoxes = (numOfColumns * numOfRows) - len(message)
+
+ # Each string in plaintext represents a column in the grid.
+ plaintext = [""] * numOfColumns
+
+ # The col and row variables point to where in the grid the next
+ # character in the encrypted message will go.
+ col = 0
+ row = 0
+
+ for symbol in message:
+ plaintext[col] += symbol
+ col += 1 # point to next column
+
+ # If there are no more columns OR we're at a shaded box, go back to
+ # the first column and the next row.
+ if (col == numOfColumns) or (
+ col == numOfColumns - 1 and row >= numOfRows - numOfShadedBoxes
+ ):
+ col = 0
+ row += 1
+
+ return "".join(plaintext)
+
===========changed ref 6===========
+ # module: ciphey.Decryptor.basicEncryption.oldtransposition
+
+
+ class Transposition:
+
+ def main(self):
+ myMessage = """Cb b rssti aieih rooaopbrtnsceee er es no npfgcwu plri
+
+ ch nitaalr eiuengiteehb(e1 hilincegeoamn fubehgtarndcstudmd nM eu eacBoltaetee
+
+ oinebcdkyremdteghn.aa2r81a condari fmps" tad l t oisn sit u1rnd stara nvhn fs
+
+ edbh ee,n e necrg6 8nmisv l nc muiftegiitm tutmg cm shSs9fcie ebintcaets h a
+
+ ihda cctrhe ele 1O7 aaoem waoaatdahretnhechaopnooeapece9etfncdbgsoeb uuteitgna.
+
+ rteoh add e,D7c1Etnpneehtn beete" evecoal lsfmcrl iu1cifgo ai. sl1rchdnheev sh
+
+ meBd ies e9t)nh,htcnoecplrrh ,ide hmtlme. pheaLem,toeinfgn t e9yce da' eN eMp a
+
+ ffn Fc1o ge eohg dere.eec s nfap yox hla yon. lnrnsreaBoa t,e eitsw il ulpbdofg
+
+ BRe bwlmprraio po droB wtinue r Pieno nc ayieeto'lulcih sfnc ownaSserbereiaSm
+
+ -eaiah, nnrttgcC maciiritvledastinideI nn rms iehn tsigaB</s>
===========changed ref 7===========
+ # module: ciphey.Decryptor.basicEncryption.oldtransposition
+
+
+ class Transposition:
+
+ def main(self):
# offset: 1
<s> -eaiah, nnrttgcC maciiritvledastinideI nn rms iehn tsigaBmuoetcetias rn"""
+
+ hackedMessage = self.hackTransposition(myMessage)
+ |
ciphey.Decryptor.basicEncryption.transposition/Transposition.decrypt | Modified | Ciphey~Ciphey | 0fcb8c744315fe2da9c375da9522fe74a7be7f38 | Transposition cipher is now implemented but doesn't decrypt | <0>:<add> # Brute-force by looping through every possible key.
<del> # Brute-force by looping through every possible key.
<1>:<add> decryptedText = self.hackTransposition(text)
<add> return decryptedText
<del> decryptedText = self.hackTransposition("""ehlol ym aftehrh ellom ym ohteXrX""")
| # module: ciphey.Decryptor.basicEncryption.transposition
-
-
class Transposition:
-
def decrypt(self, text):
<0> # Brute-force by looping through every possible key.
<1> decryptedText = self.hackTransposition("""ehlol ym aftehrh ellom ym ohteXrX""")
<2>
| ===========changed ref 0===========
# module: ciphey.Decryptor.basicEncryption.transposition
-
-
class Transposition:
-
def main(self):
+ # this main exists so i can test it
+ myMessage = """Cb b rssti aieih rooaopbrtnsceee er es no npfgcwu plri
- myMessage = """Cb b rssti aieih rooaopbrtnsceee er es no npfgcwu plri
-
- ch nitaalr eiuengiteehb(e1 hilincegeoamn fubehgtarndcstudmd nM eu eacBoltaetee
-
- oinebcdkyremdteghn.aa2r81a condari fmps" tad l t oisn sit u1rnd stara nvhn fs
-
- edbh ee,n e necrg6 8nmisv l nc muiftegiitm tutmg cm shSs9fcie ebintcaets h a
-
- ihda cctrhe ele 1O7 aaoem waoaatdahretnhechaopnooeapece9etfncdbgsoeb uuteitgna.
-
- rteoh add e,D7c1Etnpneehtn beete" evecoal lsfmcrl iu1cifgo ai. sl1rchdnheev sh
-
- meBd ies e9t)nh,htcnoecplrrh ,ide hmtlme. pheaLem,toeinfgn t e9yce da' eN eMp a
-
- ffn Fc1o ge eohg dere.eec s nfap yox hla yon. lnrnsreaBoa t,e eitsw il ulpbdofg
-
- BRe bwlmprraio po droB wtinue r Pieno nc ayieeto'lulcih sfnc ownaSser</s>
===========changed ref 1===========
# module: ciphey.Decryptor.basicEncryption.transposition
-
-
class Transposition:
-
def main(self):
# offset: 1
<s>lmprraio po droB wtinue r Pieno nc ayieeto'lulcih sfnc ownaSserbereiaSm
-
- -eaiah, nnrttgcC maciiritvledastinideI nn rms iehn tsigaBmuoetcetias rn"""
-
- hackedMessage = self.hackTransposition(myMessage)
===========changed ref 2===========
+ # module: ciphey.Decryptor.basicEncryption.oldtransposition
+
+
+ class Transposition:
+
+ def getName(self):
+ return "Transposition"
+
===========changed ref 3===========
+ # module: ciphey.Decryptor.basicEncryption.oldtransposition
+
+
+ class Transposition:
+ def __init__(self, lc):
+ self.lc = lc
+
===========changed ref 4===========
+ # module: ciphey.Decryptor.basicEncryption.oldtransposition
+
+
+ if __name__ == "__main__":
+ t = Transposition("a")
+ t.main()
+
===========changed ref 5===========
+ # module: ciphey.Decryptor.basicEncryption.oldtransposition
+
+
+ class Transposition:
+
+ def decrypt(self, text):
+ # Brute-force by looping through every possible key.
+ decryptedText = self.hackTransposition("""ehlol ym aftehrh ellom ym ohteXrX""")
+
===========changed ref 6===========
+ # module: ciphey.Decryptor.basicEncryption.oldtransposition
+
+
+ class Transposition:
+
+ def hackTransposition(self, message):
+ print("Hacking...")
+
+ # Python programs can be stopped at any time by pressing Ctrl-C (on
+ # Windows) or Ctrl-D (on Mac and Linux)
+
+ # brute-force by looping through every possible key
+ for key in range(1, len(message)):
+
+ decryptedText = self.decryptMessage(key, message)
+
+ # if self.lc.checkLanguage(decryptedText):
+ # Check with user to see if the decrypted key has been found.
+ if self.lc.checkLanguage(decryptedText):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": decryptedText,
+ "Cipher": "Transposition",
+ "Extra Information": f"The key is {key}",
+ }
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": "Transposition",
+ "Extra Information": None,
+ }
+
===========changed ref 7===========
+ # module: ciphey.Decryptor.basicEncryption.oldtransposition
+
+
+ class Transposition:
+
+ def decryptMessage(self, key, message):
+ # The transposition decrypt function will simulate the "columns" and
+ # "rows" of the grid that the plaintext is written on by using a list
+ # of strings. First, we need to calculate a few values.
+
+ # The number of "columns" in our transposition grid:
+ numOfColumns = math.ceil(len(message) / key)
+ # The number of "rows" in our grid will need:
+ numOfRows = key
+ # The number of "shaded boxes" in the last "column" of the grid:
+ numOfShadedBoxes = (numOfColumns * numOfRows) - len(message)
+
+ # Each string in plaintext represents a column in the grid.
+ plaintext = [""] * numOfColumns
+
+ # The col and row variables point to where in the grid the next
+ # character in the encrypted message will go.
+ col = 0
+ row = 0
+
+ for symbol in message:
+ plaintext[col] += symbol
+ col += 1 # point to next column
+
+ # If there are no more columns OR we're at a shaded box, go back to
+ # the first column and the next row.
+ if (col == numOfColumns) or (
+ col == numOfColumns - 1 and row >= numOfRows - numOfShadedBoxes
+ ):
+ col = 0
+ row += 1
+
+ return "".join(plaintext)
+ |
ciphey.Decryptor.basicEncryption.transposition/Transposition.hackTransposition | Modified | Ciphey~Ciphey | 0fcb8c744315fe2da9c375da9522fe74a7be7f38 | Transposition cipher is now implemented but doesn't decrypt | <0>:<del> print("Hacking...")
<1>:<del>
<2>:<del> # Python programs can be stopped at any time by pressing Ctrl-C (on
<3>:<del> # Windows) or Ctrl-D (on Mac and Linux)
<4>:<del>
<5>:<del> # brute-force by looping through every possible key
<6>:<add> # we could probably multi thread this
<add> for key in range(1, len(message)):
<del> for key in range(1, len(message)):
<7>:<del>
<8>:<add> decryptedText = self.decryptMessage(key, message)
<del> decryptedText = self.decryptMessage(key, message)
<9>:<del>
<10>:<del> # if self.lc.checkLanguage(decryptedText):
<11>:<del> # Check with user to see if the decrypted key has been found.
<12>:<add> # if decrypted text is english, return true
<add> if self.lc.checkLanguage(decryptedText):
<del> if self.lc.checkLanguage(decryptedText):
<13>:<add> print("found decrypted text")
<add> return {
<del> return {
<14>:<add> "lc": self.lc,
<del> "lc": self.lc,
<15>:<add> "IsPlaintext?": True,
<del> "IsPlaintext?": True,
<16>:<add> "Plaintext": decryptedText,
<del> "Plaintext": decryptedText,
<17>:<add> "Cipher": "Transposition",
<del> "Cipher": "Transposition",
<18>:<add> "Extra Information": f"The key is {key}",
<del> "Extra Information": f"The key is {key}",
<19>:<add> }
<del> }
<20>:<add> # after all keys, return false
<add> print("no decrypted text")
<add> return {
<del> return {
<21>:<add> "lc": self.lc,
<del> "lc": self.lc,
<22>:<add> "IsPlaintext?": False,
<del> "IsPlaintext?": False,
<23>:<add> "Plaintext": None,
<del> "Plaintext": None,
<24>:<add> "Cipher": "Transposition",
<del> "Cipher": "Transposition",
| # module: ciphey.Decryptor.basicEncryption.transposition
-
-
class Transposition:
-
def hackTransposition(self, message):
<0> print("Hacking...")
<1>
<2> # Python programs can be stopped at any time by pressing Ctrl-C (on
<3> # Windows) or Ctrl-D (on Mac and Linux)
<4>
<5> # brute-force by looping through every possible key
<6> for key in range(1, len(message)):
<7>
<8> decryptedText = self.decryptMessage(key, message)
<9>
<10> # if self.lc.checkLanguage(decryptedText):
<11> # Check with user to see if the decrypted key has been found.
<12> if self.lc.checkLanguage(decryptedText):
<13> return {
<14> "lc": self.lc,
<15> "IsPlaintext?": True,
<16> "Plaintext": decryptedText,
<17> "Cipher": "Transposition",
<18> "Extra Information": f"The key is {key}",
<19> }
<20> return {
<21> "lc": self.lc,
<22> "IsPlaintext?": False,
<23> "Plaintext": None,
<24> "Cipher": "Transposition",
<25> "Extra Information": None,
<26> }
<27>
| ===========unchanged ref 0===========
at: ciphey.Decryptor.basicEncryption.transposition.Transposition
decryptMessage(self, key, message)
decryptMessage(key, message)
at: ciphey.Decryptor.basicEncryption.transposition.Transposition.__init__
self.lc = lc
===========unchanged ref 1===========
at: ciphey.Decryptor.basicEncryption.transposition.Transposition.main
myMessage = """Cb b rssti aieih rooaopbrtnsceee er es no npfgcwu plri
ch nitaalr eiuengiteehb(e1 hilincegeoamn fubehgtarndcstudmd nM eu eacBoltaetee
oinebcdkyremdteghn.aa2r81a condari fmps" tad l t oisn sit u1rnd stara nvhn fs
edbh ee,n e necrg6 8nmisv l nc muiftegiitm tutmg cm shSs9fcie ebintcaets h a
ihda cctrhe ele 1O7 aaoem waoaatdahretnhechaopnooeapece9etfncdbgsoeb uuteitgna.
rteoh add e,D7c1Etnpneehtn beete" evecoal lsfmcrl iu1cifgo ai. sl1rchdnheev sh
meBd ies e9t)nh,htcnoecplrrh ,ide hmtlme. pheaLem,toeinfgn t e9yce da' eN eMp a
ffn Fc1o ge eohg dere.eec s nfap yox hla yon. lnrnsreaBoa t,e eitsw il ulpbdofg
BRe bwlmprraio po droB wtinue r Pieno nc ayieeto'lulcih sfnc ownaSserbereiaSm
-eaiah, nnrttgcC maciiritvledastinideI nn rms iehn tsigaBmuoetcetias rn"""
===========changed ref 0===========
# module: ciphey.Decryptor.basicEncryption.transposition
-
-
class Transposition:
-
def decrypt(self, text):
+ # Brute-force by looping through every possible key.
- # Brute-force by looping through every possible key.
+ decryptedText = self.hackTransposition(text)
+ return decryptedText
- decryptedText = self.hackTransposition("""ehlol ym aftehrh ellom ym ohteXrX""")
===========changed ref 1===========
# module: ciphey.Decryptor.basicEncryption.transposition
-
-
class Transposition:
-
def main(self):
+ # this main exists so i can test it
+ myMessage = """Cb b rssti aieih rooaopbrtnsceee er es no npfgcwu plri
- myMessage = """Cb b rssti aieih rooaopbrtnsceee er es no npfgcwu plri
-
- ch nitaalr eiuengiteehb(e1 hilincegeoamn fubehgtarndcstudmd nM eu eacBoltaetee
-
- oinebcdkyremdteghn.aa2r81a condari fmps" tad l t oisn sit u1rnd stara nvhn fs
-
- edbh ee,n e necrg6 8nmisv l nc muiftegiitm tutmg cm shSs9fcie ebintcaets h a
-
- ihda cctrhe ele 1O7 aaoem waoaatdahretnhechaopnooeapece9etfncdbgsoeb uuteitgna.
-
- rteoh add e,D7c1Etnpneehtn beete" evecoal lsfmcrl iu1cifgo ai. sl1rchdnheev sh
-
- meBd ies e9t)nh,htcnoecplrrh ,ide hmtlme. pheaLem,toeinfgn t e9yce da' eN eMp a
-
- ffn Fc1o ge eohg dere.eec s nfap yox hla yon. lnrnsreaBoa t,e eitsw il ulpbdofg
-
- BRe bwlmprraio po droB wtinue r Pieno nc ayieeto'lulcih sfnc ownaSser</s>
===========changed ref 2===========
# module: ciphey.Decryptor.basicEncryption.transposition
-
-
class Transposition:
-
def main(self):
# offset: 1
<s>lmprraio po droB wtinue r Pieno nc ayieeto'lulcih sfnc ownaSserbereiaSm
-
- -eaiah, nnrttgcC maciiritvledastinideI nn rms iehn tsigaBmuoetcetias rn"""
-
- hackedMessage = self.hackTransposition(myMessage)
===========changed ref 3===========
+ # module: ciphey.Decryptor.basicEncryption.oldtransposition
+
+
+ class Transposition:
+
+ def getName(self):
+ return "Transposition"
+
===========changed ref 4===========
+ # module: ciphey.Decryptor.basicEncryption.oldtransposition
+
+
+ class Transposition:
+ def __init__(self, lc):
+ self.lc = lc
+
===========changed ref 5===========
+ # module: ciphey.Decryptor.basicEncryption.oldtransposition
+
+
+ if __name__ == "__main__":
+ t = Transposition("a")
+ t.main()
+
===========changed ref 6===========
+ # module: ciphey.Decryptor.basicEncryption.oldtransposition
+
+
+ class Transposition:
+
+ def decrypt(self, text):
+ # Brute-force by looping through every possible key.
+ decryptedText = self.hackTransposition("""ehlol ym aftehrh ellom ym ohteXrX""")
+
===========changed ref 7===========
+ # module: ciphey.Decryptor.basicEncryption.oldtransposition
+
+
+ class Transposition:
+
+ def hackTransposition(self, message):
+ print("Hacking...")
+
+ # Python programs can be stopped at any time by pressing Ctrl-C (on
+ # Windows) or Ctrl-D (on Mac and Linux)
+
+ # brute-force by looping through every possible key
+ for key in range(1, len(message)):
+
+ decryptedText = self.decryptMessage(key, message)
+
+ # if self.lc.checkLanguage(decryptedText):
+ # Check with user to see if the decrypted key has been found.
+ if self.lc.checkLanguage(decryptedText):
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": True,
+ "Plaintext": decryptedText,
+ "Cipher": "Transposition",
+ "Extra Information": f"The key is {key}",
+ }
+ return {
+ "lc": self.lc,
+ "IsPlaintext?": False,
+ "Plaintext": None,
+ "Cipher": "Transposition",
+ "Extra Information": None,
+ }
+ |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.