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
LanguageChecker/languageChecker.__init__
Modified
Ciphey~Ciphey
21adbd61fb2fb19bd135b1c0107c82b4f0c704bb
worked on chi squared and started building a new maths helper class
<5>:<add> self.average = 0.0 <add> self.totalDone = 0.0 <add> self.oldAverage = 0.0
# module: LanguageChecker class languageChecker: 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>
===========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: LanguageChecker + """ + β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— + β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β• + β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• + β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β• β•šβ–ˆβ–ˆβ•”β• + β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘οΏ½</s> ===========changed ref 1=========== # module: LanguageChecker # offset: 1 <s>οΏ½οΏ½β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ + Β© Brandon Skerritt + Github: brandonskerritt + + Class to determine whether somethine is English or not. + 1. Calculate the Chi Squared score of a sentence + 2. If the score is significantly lower than the average score, it _might_ be English + 3. + """ + """ {"E": 12.02, "T": 9.10, "A": 8.12, "O": 7.68, "I": 7.31, "N": 6.95, "S": 6.28, "R": 6.02, "H": 5.92, "D": 4.32, "L": 3.98, "U": 2.88, "C": 2.71, "M": 2.61, "F": 2.30, "Y": 2.11, "W": 2.09, "G": 2.03, "P": 1.82, "B": 1.49, "V": 1.11, "K": 0.69, "X": 0.17, "Q": 0.11, "J": 0.10, "Z": 0.07 } """ ===========changed ref 2=========== + # module: env.lib.python3.6.site-packages.pip.utils.appdirs + + ===========changed ref 3=========== + # module: env.lib.python3.6.site-packages.pip.commands.freeze + + ===========changed ref 4=========== + # module: env.lib.python3.6.site-packages.pip.commands.search + + ===========changed ref 5=========== + # module: env.lib.python3.6.site-packages.pip.utils.outdated + + ===========changed ref 6=========== + # module: env.lib.python3.6.site-packages.pip.req.req_file + + ===========changed ref 7=========== + # module: env.lib.python3.6.site-packages.pip.basecommand + + ===========changed ref 8=========== + # module: env.lib.python3.6.site-packages.pip.commands.uninstall + + ===========changed ref 9=========== + # module: env.lib.python3.6.site-packages.setuptools.command.setopt + + ===========changed ref 10=========== + # module: env.lib.python3.6.site-packages.setuptools.extension + + ===========changed ref 11=========== + # module: env.lib.python3.6.site-packages.pip.wheel + + ===========changed ref 12=========== + # module: env.lib.python3.6.site-packages.setuptools.command.bdist_wininst + + ===========changed ref 13=========== + # module: env.lib.python3.6.site-packages.pip.commands.show + + ===========changed ref 14=========== + # module: env.lib.python3.6.site-packages.setuptools.glibc + + ===========changed ref 15=========== + # module: env.lib.python3.6.site-packages.pip.compat + + ===========changed ref 16=========== + # module: env.lib.python3.6.site-packages.pip.req.req_set + + ===========changed ref 17=========== + # module: env.lib.python3.6.site-packages.pip.exceptions + + ===========changed ref 18=========== + # module: env.lib.python3.6.site-packages.pip.utils.packaging + + ===========changed ref 19=========== + # module: env.lib.python3.6.site-packages.setuptools.command.build_py + + ===========changed ref 20=========== + # module: env.lib.python3.6.site-packages.setuptools.msvc + + ===========changed ref 21=========== + # module: env.lib.python3.6.site-packages.setuptools.namespaces + + ===========changed ref 22=========== + # module: env.lib.python3.6.site-packages.setuptools.config + + ===========changed ref 23=========== + # module: env.lib.python3.6.site-packages.pip.commands.help + + ===========changed ref 24=========== + # module: env.lib.python3.6.site-packages.setuptools.command.build_ext + + ===========changed ref 25=========== + # module: env.lib.python3.6.site-packages.pkg_resources._vendor.packaging.requirements + + ===========changed ref 26=========== + # module: env.lib.python3.6.site-packages.pip.utils.deprecation + + ===========changed ref 27=========== + # module: env.lib.python3.6.site-packages.pip.commands.install + + ===========changed ref 28=========== + # module: env.lib.python3.6.site-packages.pkg_resources._vendor.packaging.markers + + ===========changed ref 29=========== + # module: env.lib.python3.6.site-packages.pip.utils.hashes + + ===========changed ref 30=========== + # module: env.lib.python3.6.site-packages.setuptools._vendor.packaging._compat + + ===========changed ref 31=========== + # module: env.lib.python3.6.site-packages.setuptools.command.upload + + ===========changed ref 32=========== + # module: env.lib.python3.6.site-packages.pkg_resources._vendor.packaging._compat + + ===========changed ref 33=========== + # module: env.lib.python3.6.site-packages.setuptools.command.easy_install + + ===========changed ref 34=========== + # module: env.lib.python3.6.site-packages.setuptools.lib2to3_ex + + ===========changed ref 35=========== + # module: env.lib.python3.6.site-packages.pip.commands.wheel + + ===========changed ref 36=========== + # module: env.lib.python3.6.site-packages.pip.utils + + ===========changed ref 37=========== + # module: env.lib.python3.6.site-packages.setuptools.command.install_scripts + + ===========changed ref 38=========== + # module: env.lib.python3.6.site-packages.setuptools.command.register + +
LanguageChecker/languageChecker.chiSquared
Modified
Ciphey~Ciphey
21adbd61fb2fb19bd135b1c0107c82b4f0c704bb
worked on chi squared and started building a new maths helper class
<8>:<add> # if letter is not puncuation, but it is still ascii <add> # it's probably a different language so add it to the dict <add> if letter not in punctuation and self.isAscii(letter) : <add> letterFreq[letter] = 1 <add> <del> continue <30>:<add> # calculates running average <add> self.oldAverage = self.average <add> self.totalDone += 1 <add> self.average = self.average + (chisquare / self.totalDone)
# module: LanguageChecker class languageChecker: def chiSquared(self, text): <0> print(text) <1> # creates letter frequency of the text <2> # do this so it matches up with the list <3> 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} <4> for letter in text: <5> if letter in letterFreq: <6> letterFreq[letter] +=1 <7> else: <8> continue <9> # so we dont have to calculate len more than once <10> # turns them into probabilities (frequency distribution) <11> lenOfString = len(text) <12> for key, value in letterFreq.items(): <13> try: <14> letterFreq[key] = value / lenOfString <15> except ZeroDivisionError as e: <16> print("Error, you have entered an empty string :( The error is \"" + str(e) +"\" on line 34 of LanguageChecker.py (function chiSquared)") <17> exit(1) <18> <19> # calculates chi squared of each language <20> maxChiSquare = 0.00 <21> languagesChi = {} <22> highestLanguage = "" <23> for language in self.languages: <24> #, list(languages[language].values()) <25> temp = self.myChi(letterFreq, self.languages[language]) <26> languagesChi[language] = temp <27> """if temp >= maxChiSquare: <28> #maxChiSquare = temp <29> highestLanguage = language""" <30> return(languagesChi) </s>
===========unchanged ref 0=========== at: LanguageChecker.languageChecker isAscii(letter) at: LanguageChecker.languageChecker.chiSquared self.oldAverage = self.average self.totalDone += 1 self.average = self.average + (chisquare / self.totalDone) at: string punctuation = r"""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~""" ===========changed ref 0=========== # module: LanguageChecker class languageChecker: 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} } + self.average = 0.0 + self.totalDone = 0.0 + self.oldAverage = 0.0 ===========changed ref 1=========== # module: LanguageChecker + """ + β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— + β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β• + β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• + β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β• β•šβ–ˆβ–ˆβ•”β• + β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘οΏ½</s> ===========changed ref 2=========== # module: LanguageChecker # offset: 1 <s>οΏ½οΏ½β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ + Β© Brandon Skerritt + Github: brandonskerritt + + Class to determine whether somethine is English or not. + 1. Calculate the Chi Squared score of a sentence + 2. If the score is significantly lower than the average score, it _might_ be English + 3. + """ + """ {"E": 12.02, "T": 9.10, "A": 8.12, "O": 7.68, "I": 7.31, "N": 6.95, "S": 6.28, "R": 6.02, "H": 5.92, "D": 4.32, "L": 3.98, "U": 2.88, "C": 2.71, "M": 2.61, "F": 2.30, "Y": 2.11, "W": 2.09, "G": 2.03, "P": 1.82, "B": 1.49, "V": 1.11, "K": 0.69, "X": 0.17, "Q": 0.11, "J": 0.10, "Z": 0.07 } """ ===========changed ref 3=========== + # module: env.lib.python3.6.site-packages.pip.utils.appdirs + + ===========changed ref 4=========== + # module: env.lib.python3.6.site-packages.pip.commands.freeze + + ===========changed ref 5=========== + # module: env.lib.python3.6.site-packages.pip.commands.search + + ===========changed ref 6=========== + # module: env.lib.python3.6.site-packages.pip.utils.outdated + + ===========changed ref 7=========== + # module: env.lib.python3.6.site-packages.pip.req.req_file + + ===========changed ref 8=========== + # module: env.lib.python3.6.site-packages.pip.basecommand + + ===========changed ref 9=========== + # module: env.lib.python3.6.site-packages.pip.commands.uninstall + + ===========changed ref 10=========== + # module: env.lib.python3.6.site-packages.setuptools.command.setopt + + ===========changed ref 11=========== + # module: env.lib.python3.6.site-packages.setuptools.extension + + ===========changed ref 12=========== + # module: env.lib.python3.6.site-packages.pip.wheel + + ===========changed ref 13=========== + # module: env.lib.python3.6.site-packages.setuptools.command.bdist_wininst + + ===========changed ref 14=========== + # module: env.lib.python3.6.site-packages.pip.commands.show + + ===========changed ref 15=========== + # module: env.lib.python3.6.site-packages.setuptools.glibc + + ===========changed ref 16=========== + # module: env.lib.python3.6.site-packages.pip.compat + + ===========changed ref 17=========== + # module: env.lib.python3.6.site-packages.pip.req.req_set + + ===========changed ref 18=========== + # module: env.lib.python3.6.site-packages.pip.exceptions + + ===========changed ref 19=========== + # module: env.lib.python3.6.site-packages.pip.utils.packaging + + ===========changed ref 20=========== + # module: env.lib.python3.6.site-packages.setuptools.command.build_py + + ===========changed ref 21=========== + # module: env.lib.python3.6.site-packages.setuptools.msvc + + ===========changed ref 22=========== + # module: env.lib.python3.6.site-packages.setuptools.namespaces + + ===========changed ref 23=========== + # module: env.lib.python3.6.site-packages.setuptools.config + + ===========changed ref 24=========== + # module: env.lib.python3.6.site-packages.pip.commands.help + +
LanguageChecker/languageChecker.__init__
Modified
Ciphey~Ciphey
5cc0944997e03729712b9f313350df9f045b7669
added dictionary and worked on english processor
<8>:<add> self.mh = mathsHelper.mathsHelper() <add> self.totalWordsTried = 0.0
# module: LanguageChecker class languageChecker: 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> self.average = 0.0 <6> self.totalDone = 0.0 <7> self.oldAverage = 0.0 <8>
===========unchanged ref 0=========== at: collections OrderedDict(map: Mapping[_KT, _VT], **kwargs: _VT) OrderedDict(**kwargs: _VT) OrderedDict(iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) at: string punctuation = r"""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~""" ===========changed ref 0=========== # module: mathsHelper + class mathsHelper: + def __init__(self): + print("nothing") + ===========changed ref 1=========== # module: mathsHelper + class mathsHelper: + def percentage(self, part, whole): + return 100 * float(part)/float(whole) + ===========changed ref 2=========== # module: mathsHelper - def percentage(self, part, whole): - return 100 * float(part)/float(whole) -
LanguageChecker/languageChecker.checkChi
Modified
Ciphey~Ciphey
5cc0944997e03729712b9f313350df9f045b7669
added dictionary and worked on english processor
<0>:<add> # TODO 20% isn't optimal <1>:<add> # the or statement is bc if the program has just started I don't want it to ignore the <add> # ones at the start <add> # TODO is 10 optimal? <add> # TODO is 45 optimal? <add> if self.mh.percentage(self.oldAverage, self.average) >= 20 or self.totalDone < 10: <del> if percentage(self.oldAverage, self.average) >= 20: <2>:<add> percetageOfEnglish = checkEnglish(text) <add> print("Ok, it's significant!") <del> print("Ok, it's significant!") <3>:<add> if percetageOfEnglish > 45: <add> print("I'm pretty sure this is English")
# module: LanguageChecker class languageChecker: def checkChi(self): <0> # runs after every chi squared to see if it's 1 significantly lower than averae <1> if percentage(self.oldAverage, self.average) >= 20: <2> print("Ok, it's significant!") <3>
===========unchanged ref 0=========== at: LanguageChecker.languageChecker.__init__ self.average = 0.0 self.totalDone = 0.0 self.oldAverage = 0.0 at: LanguageChecker.languageChecker.chiSquared languagesChi[language] = temp ===========changed ref 0=========== # module: LanguageChecker class languageChecker: 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} } self.average = 0.0 self.totalDone = 0.0 self.oldAverage = 0.0 + self.mh = mathsHelper.mathsHelper() + self.totalWordsTried = 0.0 ===========changed ref 1=========== # module: mathsHelper + class mathsHelper: + def __init__(self): + print("nothing") + ===========changed ref 2=========== # module: mathsHelper + class mathsHelper: + def percentage(self, part, whole): + return 100 * float(part)/float(whole) + ===========changed ref 3=========== # module: mathsHelper - def percentage(self, part, whole): - return 100 * float(part)/float(whole) -
ciphey-main/Ciphey.__init__
Modified
Ciphey~Ciphey
5cc0944997e03729712b9f313350df9f045b7669
added dictionary and worked on english processor
<0>:<del> print("hello!") <4>:<add> parser.add_argument('-g','--greppable', help='Are you grepping this output?', required=False) <add> <5>:<add> print(""" <add> β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— <add> β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆ
# module: ciphey-main class Ciphey: def __init__(self): <0> print("hello!") <1> parser = argparse.ArgumentParser(description='Blog') <2> parser.add_argument('-f','--file', help='File you want to decrypt', required=False) <3> parser.add_argument('-l','--level', help='How many levels of decryption you want (the more levels, the slower it is)', required=False) <4> args = vars(parser.parse_args()) <5> LanguageChecker.chisquare("hello this is a test I hope you have a good day") <6>
===========changed ref 0=========== # module: mathsHelper + class mathsHelper: + def __init__(self): + print("nothing") + ===========changed ref 1=========== # module: mathsHelper + class mathsHelper: + def percentage(self, part, whole): + return 100 * float(part)/float(whole) + ===========changed ref 2=========== # module: mathsHelper - def percentage(self, part, whole): - return 100 * float(part)/float(whole) - ===========changed ref 3=========== # module: LanguageChecker class languageChecker: + def checkEnglish(self, text): + # reads through most common words / passwords + # and calculates how much of that is in English + text = text.split(" ") + text = text.sort() + f = open("dictionary.txt", "r") + f = f.readlines() + counter = 0.00 + # dictionary is "word\n" so I remove the "\n" + for word[0:-2] in f: + if word == text: + counter = counter + 1 + counter = mh.percentage(counter, len(text)) + return counter + ===========changed ref 4=========== # module: LanguageChecker class languageChecker: def checkChi(self): + # TODO 20% isn't optimal # runs after every chi squared to see if it's 1 significantly lower than averae + # the or statement is bc if the program has just started I don't want it to ignore the + # ones at the start + # TODO is 10 optimal? + # TODO is 45 optimal? + if self.mh.percentage(self.oldAverage, self.average) >= 20 or self.totalDone < 10: - if percentage(self.oldAverage, self.average) >= 20: + percetageOfEnglish = checkEnglish(text) + print("Ok, it's significant!") - print("Ok, it's significant!") + if percetageOfEnglish > 45: + print("I'm pretty sure this is English") ===========changed ref 5=========== # module: LanguageChecker class languageChecker: 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} } self.average = 0.0 self.totalDone = 0.0 self.oldAverage = 0.0 + self.mh = mathsHelper.mathsHelper() + self.totalWordsTried = 0.0
app.mathsHelper/mathsHelper.percentage
Modified
Ciphey~Ciphey
4be6c646ae9966d006a1173b63a09e98c42fb417
wow would you believe this chi squared works
<1>:<add> # yeah uhm sometimes I'm a dummy dum dum and I think dividing by 0 is a good idea <add> # this if statememt is to stop my stupidity <add> if part or whole <= 0: <add> return 0 <add>
# module: app.mathsHelper class mathsHelper: def percentage(self, part, whole): <0> """Works with percentages""" <1> # works with percentages <2> return 100 * float(part)/float(whole) <3>
===========changed ref 0=========== + # module: mathsHelper + + ===========changed ref 1=========== + # module: mathsHelper + + ===========changed ref 2=========== + # module: mathsHelper + """ + β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— + β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β• + β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• + β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β• β•šβ–ˆβ–ˆβ•”β• + β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆοΏ½</s> ===========changed ref 3=========== + # module: mathsHelper # offset: 1 <s>οΏ½β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ + Β© Brandon Skerritt + Github: brandonskerritt + """ +
app.languageChecker.chisquared/chiSquared.__init__
Modified
Ciphey~Ciphey
4be6c646ae9966d006a1173b63a09e98c42fb417
wow would you believe this chi squared works
<10>:<add> self.totalChi = 0.0 <del>
# module: app.languageChecker.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> self.average = 0.0 <6> self.totalDone = 0.0 <7> self.oldAverage = 0.0 <8> self.mh = mathsHelper.mathsHelper() <9> self.highestLanguage = "" <10> <11> <12> # these are settings that may impact how the program works overall <13> self.chiSquaredSignificaneThreshold = 20 <14> self.totalDoneThreshold = 10 <15>
===========unchanged ref 0=========== at: app.languageChecker.chisquared.chiSquared.chiSquared self.oldAverage = self.average self.totalDone += 1 self.average = (self.totalChi + maxChiSquare) / self.totalDone ===========changed ref 0=========== + # module: mathsHelper + + ===========changed ref 1=========== + # module: mathsHelper + + ===========changed ref 2=========== + # module: app.runTests + test_chi_squared.tests() + ===========changed ref 3=========== + # module: app.runTests + sys.path.append("..") + ===========changed ref 4=========== + # module: app.languageChecker.test + ch = chisquared.chiSquared() + """ + Tests to see whether a sentene is classified as English or not + """ + result = chi.checkChi("Hello my name is Brandon and I'm a top secret message") + print(result) + ===========changed ref 5=========== # module: app.mathsHelper class mathsHelper: def percentage(self, part, whole): """Works with percentages""" + # yeah uhm sometimes I'm a dummy dum dum and I think dividing by 0 is a good idea + # this if statememt is to stop my stupidity + if part or whole <= 0: + return 0 + # works with percentages return 100 * float(part)/float(whole) ===========changed ref 6=========== + # module: mathsHelper + """ + β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— + β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β• + β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• + β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β• β•šβ–ˆβ–ˆβ•”β• + β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆοΏ½</s> ===========changed ref 7=========== + # module: mathsHelper # offset: 1 <s>οΏ½β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ + Β© Brandon Skerritt + Github: brandonskerritt + """ +
app.languageChecker.chisquared/chiSquared.checkChi
Modified
Ciphey~Ciphey
4be6c646ae9966d006a1173b63a09e98c42fb417
wow would you believe this chi squared works
<16>:<add> if self.mh.percentage(self.oldAverage, self.average) >= self.chiSquaredSignificaneThreshold or self.totalDone < self.totalDoneThreshold: <del> if self.mh.percentage(self.oldAverage, self.average) >= self.chiSquaredSignificaneThreshold or self.totalDone < totalDoneThreshold: <17>:<add> print("It's significant!") <del> percetageOfEnglish = checkEnglish(text)
# module: app.languageChecker.chisquared class chiSquared: def checkChi(self, text): <0> """Checks to see if the Chi score is good <1> if it is, it returns True <2> Call this when you want to determine whether something is likely to be Chi or not <3> <4> Arguments: <5> * text - the text you want to run a Chi Squared score on <6> <7> Outputs: <8> * True - if it has a significantly lower chi squared score <9> * False - if it doesn't have a significantly lower chi squared score <10> """ <11> # TODO 20% isn't optimal <12> # runs after every chi squared to see if it's 1 significantly lower than averae <13> # the or statement is bc if the program has just started I don't want it to ignore the <14> # ones at the start <15> self.chiSquared(text) <16> if self.mh.percentage(self.oldAverage, self.average) >= self.chiSquaredSignificaneThreshold or self.totalDone < totalDoneThreshold: <17> percetageOfEnglish = checkEnglish(text) <18> return(True) <19> else: <20> return(False) <21>
===========unchanged ref 0=========== at: app.languageChecker.chisquared.chiSquared.chiSquared self.highestLanguage = language ===========changed ref 0=========== # module: app.languageChecker.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} } self.average = 0.0 self.totalDone = 0.0 self.oldAverage = 0.0 self.mh = mathsHelper.mathsHelper() self.highestLanguage = "" + self.totalChi = 0.0 - # these are settings that may impact how the program works overall self.chiSquaredSignificaneThreshold = 20 self.totalDoneThreshold = 10 ===========changed ref 1=========== + # module: mathsHelper + + ===========changed ref 2=========== + # module: mathsHelper + + ===========changed ref 3=========== + # module: app.runTests + test_chi_squared.tests() + ===========changed ref 4=========== + # module: app.runTests + sys.path.append("..") + ===========changed ref 5=========== + # module: app.languageChecker.test + ch = chisquared.chiSquared() + """ + Tests to see whether a sentene is classified as English or not + """ + result = chi.checkChi("Hello my name is Brandon and I'm a top secret message") + print(result) + ===========changed ref 6=========== # module: app.mathsHelper class mathsHelper: def percentage(self, part, whole): """Works with percentages""" + # yeah uhm sometimes I'm a dummy dum dum and I think dividing by 0 is a good idea + # this if statememt is to stop my stupidity + if part or whole <= 0: + return 0 + # works with percentages return 100 * float(part)/float(whole) ===========changed ref 7=========== + # module: mathsHelper + """ + β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— + β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β• + β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• + β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β• β•šβ–ˆβ–ˆβ•”β• + β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆοΏ½</s> ===========changed ref 8=========== + # module: mathsHelper # offset: 1 <s>οΏ½β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ + Β© Brandon Skerritt + Github: brandonskerritt + """ +
app.languageChecker.chisquared/chiSquared.chiSquared
Modified
Ciphey~Ciphey
4be6c646ae9966d006a1173b63a09e98c42fb417
wow would you believe this chi squared works
<10>:<add> if letter not in punctuation and self.mh.isAscii(letter) : <del> if letter not in punctuation and self.isAscii(letter) :
# module: app.languageChecker.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> # This part creates a letter frequency of the text <3> 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} <4> for letter in text: <5> if letter in letterFreq: <6> letterFreq[letter] +=1 <7> else: <8> # if letter is not puncuation, but it is still ascii <9> # it's probably a different language so add it to the dict <10> if letter not in punctuation and self.isAscii(letter) : <11> letterFreq[letter] = 1 <12> <13> # so we dont have to calculate len more than once <14> # turns them into probabilities (frequency distribution) <15> lenOfString = len(text) <16> for key, value in letterFreq.items(): <17> try: <18> letterFreq[key] = value / lenOfString <19> except ZeroDivisionError as e: <20> print("Error, you have entered an empty string :( The error is \"" + str(e) +"\" on line 34 of LanguageChecker.py (function chiSquared)") <21> exit(1) <22> <23> # calculates chi squared of each language <24> maxChiSquare = 0.00 <25> languagesChi = {} <26> <27> for language in self.languages: <28> #, list(languages[language].values()) <29> temp = self.</s>
===========below chunk 0=========== # module: app.languageChecker.chisquared class chiSquared: def chiSquared(self, text): # offset: 1 languagesChi[language] = temp if temp > maxChiSquare: self.highestLanguage = language # calculates running average self.oldAverage = self.average self.totalDone += 1 self.average = (self.average + chisquare) / self.totalDone return(languagesChi) ===========unchanged ref 0=========== at: app.languageChecker.chisquared punctuation += " " at: app.languageChecker.chisquared.chiSquared myChi(text, distribution) myChi(self, text, distribution) at: app.languageChecker.chisquared.chiSquared.__init__ 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} } self.average = 0.0 self.totalDone = 0.0 self.oldAverage = 0.0 self.mh = mathsHelper.mathsHelper() self.chiSquaredSignificaneThreshold = 20 self.totalDoneThreshold = 10 at: app.languageChecker.chisquared.chiSquared.chiSquared self.oldAverage = self.average ===========unchanged ref 1=========== self.totalDone += 1 self.average = (self.totalChi + maxChiSquare) / self.totalDone ===========changed ref 0=========== # module: app.languageChecker.chisquared class chiSquared: def checkChi(self, text): """Checks to see if the Chi score is good if it is, it returns True Call this when you want to determine whether something is likely to be Chi or not Arguments: * text - the text you want to run a Chi Squared score on Outputs: * True - if it has a significantly lower chi squared score * False - if it doesn't have a significantly lower chi squared score """ # TODO 20% isn't optimal # runs after every chi squared to see if it's 1 significantly lower than averae # the or statement is bc if the program has just started I don't want it to ignore the # ones at the start self.chiSquared(text) + if self.mh.percentage(self.oldAverage, self.average) >= self.chiSquaredSignificaneThreshold or self.totalDone < self.totalDoneThreshold: - if self.mh.percentage(self.oldAverage, self.average) >= self.chiSquaredSignificaneThreshold or self.totalDone < totalDoneThreshold: + print("It's significant!") - percetageOfEnglish = checkEnglish(text) return(True) else: return(False) ===========changed ref 1=========== # module: app.languageChecker.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} } self.average = 0.0 self.totalDone = 0.0 self.oldAverage = 0.0 self.mh = mathsHelper.mathsHelper() self.highestLanguage = "" + self.totalChi = 0.0 - # these are settings that may impact how the program works overall self.chiSquaredSignificaneThreshold = 20 self.totalDoneThreshold = 10 ===========changed ref 2=========== + # module: mathsHelper + + ===========changed ref 3=========== + # module: mathsHelper + + ===========changed ref 4=========== + # module: app.runTests + test_chi_squared.tests() + ===========changed ref 5=========== + # module: app.runTests + sys.path.append("..") + ===========changed ref 6=========== + # module: app.languageChecker.test + ch = chisquared.chiSquared() + """ + Tests to see whether a sentene is classified as English or not + """ + result = chi.checkChi("Hello my name is Brandon and I'm a top secret message") + print(result) + ===========changed ref 7=========== # module: app.mathsHelper class mathsHelper: def percentage(self, part, whole): """Works with percentages""" + # yeah uhm sometimes I'm a dummy dum dum and I think dividing by 0 is a good idea + # this if statememt is to stop my stupidity + if part or whole <= 0: + return 0 + # works with percentages return 100 * float(part)/float(whole)
app.languageChecker.chisquared/chiSquared.myChi
Modified
Ciphey~Ciphey
4be6c646ae9966d006a1173b63a09e98c42fb417
wow would you believe this chi squared works
<5>:<add> print(len(text)) <add> print(len(distribution))
# module: app.languageChecker.chisquared class chiSquared: def myChi(self, text, distribution): <0> """My own implementation of Chi squared using the two resources mention in the comments on this definition as guidance""" <1> # chrome-extension://oemmndcbldboiebfnladdacbdfmadadm/https://cgi.csc.liv.ac.uk/~john/comp105resources/lecture10.pdf <2> # http://practicalcryptography.com/cryptanalysis/text-characterisation/chi-squared-statistic/ <3> # given a text frequency and a distribution, calculate it's Chi score <4> chiScore = 0.0 <5> for counter, letter in enumerate(text.values()): <6> chiScore = chiScore + ((letter - distribution[counter])**2) / distribution[counter] <7> return chiScore <8>
===========unchanged ref 0=========== at: app.languageChecker.chisquared.chiSquared.__init__ self.average = 0.0 self.totalDone = 0.0 self.oldAverage = 0.0 self.highestLanguage = "" self.totalChi = 0.0 at: app.languageChecker.chisquared.chiSquared.chiSquared maxChiSquare = 0.00 languagesChi[language] = temp languagesChi = {} ===========changed ref 0=========== # module: app.languageChecker.chisquared class chiSquared: def checkChi(self, text): """Checks to see if the Chi score is good if it is, it returns True Call this when you want to determine whether something is likely to be Chi or not Arguments: * text - the text you want to run a Chi Squared score on Outputs: * True - if it has a significantly lower chi squared score * False - if it doesn't have a significantly lower chi squared score """ # TODO 20% isn't optimal # runs after every chi squared to see if it's 1 significantly lower than averae # the or statement is bc if the program has just started I don't want it to ignore the # ones at the start self.chiSquared(text) + if self.mh.percentage(self.oldAverage, self.average) >= self.chiSquaredSignificaneThreshold or self.totalDone < self.totalDoneThreshold: - if self.mh.percentage(self.oldAverage, self.average) >= self.chiSquaredSignificaneThreshold or self.totalDone < totalDoneThreshold: + print("It's significant!") - percetageOfEnglish = checkEnglish(text) return(True) else: return(False) ===========changed ref 1=========== # module: app.languageChecker.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} } self.average = 0.0 self.totalDone = 0.0 self.oldAverage = 0.0 self.mh = mathsHelper.mathsHelper() self.highestLanguage = "" + self.totalChi = 0.0 - # these are settings that may impact how the program works overall self.chiSquaredSignificaneThreshold = 20 self.totalDoneThreshold = 10 ===========changed ref 2=========== # module: app.languageChecker.chisquared class chiSquared: def chiSquared(self, text): """Creates letter frequency of text and compares that to the letter frequency of the language""" # 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: 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 letter not in punctuation and self.mh.isAscii(letter) : - if letter not in punctuation and self.isAscii(letter) : letterFreq[letter] = 1 # so we dont have to calculate len more than once # turns them into probabilities (frequency distribution) lenOfString = len(text) for key, value in letterFreq.items(): try: letterFreq[key] = value / lenOfString except ZeroDivisionError as e: print("Error, you have entered an empty string :( The error is \"" + str(e) +"\" on line 34 of LanguageChecker.py (function chiSquared)") exit(1) # calculates chi squared of each language maxChiSquare = 0.00 languagesChi = {} for language in self.languages: #, list(languages[language].values()) temp = self.myChi(letterFreq, self</s> ===========changed ref 3=========== # module: app.languageChecker.chisquared class chiSquared: def chiSquared(self, text): # offset: 1 <s>languages: #, list(languages[language].values()) temp = self.myChi(letterFreq, self.languages[language]) languagesChi[language] = temp if temp > maxChiSquare: self.highestLanguage = language # calculates running average self.oldAverage = self.average self.totalDone += 1 + # calculates a running average, maxChiSquare is the new chi score we get + self.average = (self.totalChi + maxChiSquare) / self.totalDone - self.average = (self.average + chisquare) / self.totalDone return(languagesChi) ===========changed ref 4=========== + # module: mathsHelper + + ===========changed ref 5=========== + # module: mathsHelper + + ===========changed ref 6=========== + # module: app.runTests + test_chi_squared.tests() + ===========changed ref 7=========== + # module: app.runTests + sys.path.append("..") + ===========changed ref 8=========== + # module: app.languageChecker.test + ch = chisquared.chiSquared() + """ + Tests to see whether a sentene is classified as English or not + """ + result = chi.checkChi("Hello my name is Brandon and I'm a top secret message") + print(result) + ===========changed ref 9=========== # module: app.mathsHelper class mathsHelper: def percentage(self, part, whole): """Works with percentages""" + # yeah uhm sometimes I'm a dummy dum dum and I think dividing by 0 is a good idea + # this if statememt is to stop my stupidity + if part or whole <= 0: + return 0 + # works with percentages return 100 * float(part)/float(whole)
app.languageChecker.chisquared/chiSquared.checkChi
Modified
Ciphey~Ciphey
a5f06fe043ffab91227a2d9b259eb982d281254f
end of day
<17>:<del> print("It's significant!")
# module: app.languageChecker.chisquared class chiSquared: def checkChi(self, text): <0> """Checks to see if the Chi score is good <1> if it is, it returns True <2> Call this when you want to determine whether something is likely to be Chi or not <3> <4> Arguments: <5> * text - the text you want to run a Chi Squared score on <6> <7> Outputs: <8> * True - if it has a significantly lower chi squared score <9> * False - if it doesn't have a significantly lower chi squared score <10> """ <11> # TODO 20% isn't optimal <12> # runs after every chi squared to see if it's 1 significantly lower than averae <13> # the or statement is bc if the program has just started I don't want it to ignore the <14> # ones at the start <15> self.chiSquared(text) <16> if self.mh.percentage(self.oldAverage, self.average) >= self.chiSquaredSignificaneThreshold or self.totalDone < self.totalDoneThreshold: <17> print("It's significant!") <18> return(True) <19> else: <20> return(False) <21>
===========unchanged ref 0=========== at: app.languageChecker.chisquared.chiSquared.__init__ self.average = 0.0 self.totalDone = 0.0 self.oldAverage = 0.0 self.mh = mathsHelper.mathsHelper() self.chiSquaredSignificaneThreshold = 20 self.totalDoneThreshold = 10 at: app.languageChecker.chisquared.chiSquared.chiSquared self.oldAverage = self.average self.totalDone += 1 self.average = (self.totalChi + maxChiSquare) / self.totalDone
app.languageChecker.chisquared/chiSquared.chiSquared
Modified
Ciphey~Ciphey
a5f06fe043ffab91227a2d9b259eb982d281254f
end of day
<4>:<add> <add> for letter in text.lower(): <del> for letter in text:
# module: app.languageChecker.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> # This part creates a letter frequency of the text <3> 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} <4> for letter in text: <5> if letter in letterFreq: <6> letterFreq[letter] +=1 <7> else: <8> # if letter is not puncuation, but it is still ascii <9> # it's probably a different language so add it to the dict <10> if letter not in punctuation and self.mh.isAscii(letter) : <11> letterFreq[letter] = 1 <12> <13> # so we dont have to calculate len more than once <14> # turns them into probabilities (frequency distribution) <15> lenOfString = len(text) <16> for key, value in letterFreq.items(): <17> try: <18> letterFreq[key] = value / lenOfString <19> except ZeroDivisionError as e: <20> print("Error, you have entered an empty string :( The error is \"" + str(e) +"\" on line 34 of LanguageChecker.py (function chiSquared)") <21> exit(1) <22> <23> # calculates chi squared of each language <24> maxChiSquare = 0.00 <25> languagesChi = {} <26> <27> for language in self.languages: <28> #, list(languages[language].values()) <29> temp</s>
===========below chunk 0=========== # module: app.languageChecker.chisquared class chiSquared: def chiSquared(self, text): # offset: 1 languagesChi[language] = temp if temp > maxChiSquare: self.highestLanguage = language # calculates running average self.oldAverage = self.average self.totalDone += 1 # calculates a running average, maxChiSquare is the new chi score we get self.average = (self.totalChi + maxChiSquare) / self.totalDone return(languagesChi) ===========unchanged ref 0=========== at: app.languageChecker.chisquared punctuation += " " at: app.languageChecker.chisquared.chiSquared myChi(text, distribution) myChi(self, text, distribution) at: app.languageChecker.chisquared.chiSquared.__init__ 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} } self.average = 0.0 self.totalDone = 0.0 self.oldAverage = 0.0 self.mh = mathsHelper.mathsHelper() self.highestLanguage = "" self.totalChi = 0.0 ===========changed ref 0=========== # module: app.languageChecker.chisquared class chiSquared: def checkChi(self, text): """Checks to see if the Chi score is good if it is, it returns True Call this when you want to determine whether something is likely to be Chi or not Arguments: * text - the text you want to run a Chi Squared score on Outputs: * True - if it has a significantly lower chi squared score * False - if it doesn't have a significantly lower chi squared score """ # TODO 20% isn't optimal # runs after every chi squared to see if it's 1 significantly lower than averae # the or statement is bc if the program has just started I don't want it to ignore the # ones at the start self.chiSquared(text) if self.mh.percentage(self.oldAverage, self.average) >= self.chiSquaredSignificaneThreshold or self.totalDone < self.totalDoneThreshold: - print("It's significant!") return(True) else: return(False)
app.languageChecker.chisquared/chiSquared.myChi
Modified
Ciphey~Ciphey
a5f06fe043ffab91227a2d9b259eb982d281254f
end of day
<5>:<del> print(len(text)) <6>:<del> print(len(distribution))
# module: app.languageChecker.chisquared class chiSquared: def myChi(self, text, distribution): <0> """My own implementation of Chi squared using the two resources mention in the comments on this definition as guidance""" <1> # chrome-extension://oemmndcbldboiebfnladdacbdfmadadm/https://cgi.csc.liv.ac.uk/~john/comp105resources/lecture10.pdf <2> # http://practicalcryptography.com/cryptanalysis/text-characterisation/chi-squared-statistic/ <3> # given a text frequency and a distribution, calculate it's Chi score <4> chiScore = 0.0 <5> print(len(text)) <6> print(len(distribution)) <7> for counter, letter in enumerate(text.values()): <8> chiScore = chiScore + ((letter - distribution[counter])**2) / distribution[counter] <9> return chiScore <10>
===========unchanged ref 0=========== at: app.languageChecker.chisquared.chiSquared.chiSquared languagesChi[language] = temp languagesChi = {} ===========changed ref 0=========== # module: app.languageChecker.chisquared class chiSquared: def checkChi(self, text): """Checks to see if the Chi score is good if it is, it returns True Call this when you want to determine whether something is likely to be Chi or not Arguments: * text - the text you want to run a Chi Squared score on Outputs: * True - if it has a significantly lower chi squared score * False - if it doesn't have a significantly lower chi squared score """ # TODO 20% isn't optimal # runs after every chi squared to see if it's 1 significantly lower than averae # the or statement is bc if the program has just started I don't want it to ignore the # ones at the start self.chiSquared(text) if self.mh.percentage(self.oldAverage, self.average) >= self.chiSquaredSignificaneThreshold or self.totalDone < self.totalDoneThreshold: - print("It's significant!") return(True) else: return(False) ===========changed ref 1=========== # module: app.languageChecker.chisquared class chiSquared: def chiSquared(self, text): """Creates letter frequency of text and compares that to the letter frequency of the language""" # 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(): - for letter in text: 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 letter not in punctuation and self.mh.isAscii(letter) : letterFreq[letter] = 1 # so we dont have to calculate len more than once # turns them into probabilities (frequency distribution) lenOfString = len(text) for key, value in letterFreq.items(): try: letterFreq[key] = value / lenOfString except ZeroDivisionError as e: print("Error, you have entered an empty string :( The error is \"" + str(e) +"\" on line 34 of LanguageChecker.py (function chiSquared)") exit(1) # calculates chi squared of each language maxChiSquare = 0.00 languagesChi = {} for language in self.languages: #, list(languages[language].values()) temp = self.myChi(letterFreq, self.languages[</s> ===========changed ref 2=========== # module: app.languageChecker.chisquared class chiSquared: def chiSquared(self, text): # offset: 1 <s> #, list(languages[language].values()) temp = self.myChi(letterFreq, self.languages[language]) languagesChi[language] = temp if temp > maxChiSquare: self.highestLanguage = language + maxChiSquare = temp # calculates running average self.oldAverage = self.average self.totalDone += 1 # calculates a running average, maxChiSquare is the new chi score we get self.average = (self.totalChi + maxChiSquare) / self.totalDone return(languagesChi)
app.Tests.testchi_squared/TestChi.test_english_quckbrown
Modified
Ciphey~Ciphey
c4cb77e2599d520a2a6925a1959403df1635af6b
added standard deviation and fixed a bunch of bugs
# module: app.Tests.testchi_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 test_english_quckbrown(self): <0> self.chi = chisquared.chiSquared() <1> """ <2> Tests to see whether a sentene is classified as English or not <3> """ <4> result = self.chi.checkChi("So meat. Gathered may she'd god signs. Have form firmament seed so. Them whales. Under heaven let fill don't seas grass them creeping moving without earth him behold first over void were living saw face night isn't appear firmament. Living land beast good fill. Appear their creepeth, under form. Life thing cattle life. And light unto saying two kind their doesn't fish. Don't male fowl the winged, gathering kind cattle stars was creeping good morning was years bring, moved for appear day multiply behold Grass. Every give itself moved fifth spirit whose. Sixth kind it let together male Evening said.") <5> result = self.chi.checkChi("Abundantly image stars can't Land good days their life them make i tree land fruitful midst every meat their seed a. Were them creeping fourth a subdue tree don't there.") <6> result = self.chi.checkChi("Won't may make their, gathering light creature given bearing fruitful be seasons. Firmament creature greater. Above meat over brought i.") <7> result = self.chi.checkChi("Replenish. Were the be after set dry under midst. Also i greater living. Midst divided Day give female subdue fourth.") <8> result = self.chi.checkChi("Moving spirit have. Of said behold called, fill fruitful</s>
===========below chunk 0=========== # module: app.Tests.testchi_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 test_english_quckbrown(self): # offset: 1 result = self.chi.checkChi("Abundantly years land to winged lesser earth there their. In morning them life form man can't which winged him green.") result = self.chi.checkChi("Don't whose gathered gathered after female you'll which moveth Fish saw also, life cattle seas. After every moved blessed good.") result = self.chi.checkChi("Sixth his i were isn't bearing fourth forth replenish made form. Days of from isn't waters dry one. Waters, said.") result = self.chi.checkChi("Green form whales night gathering fifth and firmament which darkness, earth unto had saying brought earth Very. Under made his.") result = self.chi.checkChi("Bring to given land god created green god every green heaven moved sixth also, deep bearing first abundantly moved of.") result = self.chi.checkChi("Air god spirit over fifth second fowl good have had. Forth every day you called also fruitful spirit there two.") result = self.chi.checkChi("The quick brown fox jumped over the lazy dog") self.assertEqual(result, True) ===========unchanged ref 0=========== at: app.Tests.testchi_squared.TestChi.test_chi_english_caps self.chi = chisquared.chiSquared() at: app.Tests.testchi_squared.TestChi.test_chi_english_yes self.chi = chisquared.chiSquared() at: app.Tests.testchi_squared.TestChi.test_english_one_letter self.chi = chisquared.chiSquared() at: app.Tests.testchi_squared.TestChi.test_english_puncuation self.chi = chisquared.chiSquared() at: app.Tests.testchi_squared.TestChi.test_english_same_letter self.chi = chisquared.chiSquared() at: app.Tests.testchi_squared.TestChi.tests_english_no_words self.chi = chisquared.chiSquared() at: app.Tests.testchi_squared.TestChi.tests_english_overflow self.chi = chisquared.chiSquared() at: app.languageChecker.chisquared chiSquared() at: app.languageChecker.chisquared.chiSquared checkChi(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 ===========changed ref 0=========== # module: app.main + from tests import tests() - from tests import tests ===========changed ref 1=========== # module: app.mathsHelper class mathsHelper: + def checkEqual(self, a): + """checks if all items in an iterable are the same + https://stackoverflow.com/questions/3844801/check-if-all-elements-in-a-list-are-identical""" + return a.count(a[0]) == len(a) +
app.Tests.testchi_squared/TestChi.test_english_puncuation
Modified
Ciphey~Ciphey
c4cb77e2599d520a2a6925a1959403df1635af6b
added standard deviation and fixed a bunch of bugs
# module: app.Tests.testchi_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 test_english_puncuation(self): <0> self.chi = chisquared.chiSquared() <1> """ <2> Tests to see whether a sentene is classified as English or not <3> Returns False because exclamation marks aren't english <4> """ <5> result = self.chi.checkChi("So meat. Gathered may she'd god signs. Have form firmament seed so. Them whales. Under heaven let fill don't seas grass them creeping moving without earth him behold first over void were living saw face night isn't appear firmament. Living land beast good fill. Appear their creepeth, under form. Life thing cattle life. And light unto saying two kind their doesn't fish. Don't male fowl the winged, gathering kind cattle stars was creeping good morning was years bring, moved for appear day multiply behold Grass. Every give itself moved fifth spirit whose. Sixth kind it let together male Evening said.") <6> result = self.chi.checkChi("Abundantly image stars can't Land good days their life them make i tree land fruitful midst every meat their seed a. Were them creeping fourth a subdue tree don't there.") <7> result = self.chi.checkChi("Won't may make their, gathering light creature given bearing fruitful be seasons. Firmament creature greater. Above meat over brought i.") <8> result = self.chi.checkChi("Replenish. Were the be after set dry under midst. Also i greater living. Midst divided Day give female subdue fourth.") <9> result = self.chi.checkChi("Moving spirit</s>
===========below chunk 0=========== # module: app.Tests.testchi_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 test_english_puncuation(self): # offset: 1 result = self.chi.checkChi("Abundantly years land to winged lesser earth there their. In morning them life form man can't which winged him green.") result = self.chi.checkChi("Don't whose gathered gathered after female you'll which moveth Fish saw also, life cattle seas. After every moved blessed good.") result = self.chi.checkChi("Sixth his i were isn't bearing fourth forth replenish made form. Days of from isn't waters dry one. Waters, said.") result = self.chi.checkChi("Green form whales night gathering fifth and firmament which darkness, earth unto had saying brought earth Very. Under made his.") result = self.chi.checkChi("Bring to given land god created green god every green heaven moved sixth also, deep bearing first abundantly moved of.") result = self.chi.checkChi("Air god spirit over fifth second fowl good have had. Forth every day you called also fruitful spirit there two.") result = self.chi.checkChi("!!!!!!!!!!!!!!!!!!!!!!") self.assertEqual(result, False) ===========unchanged ref 0=========== at: app.Tests.testchi_squared.TestChi.test_chi_english_caps self.chi = chisquared.chiSquared() at: app.Tests.testchi_squared.TestChi.test_chi_english_yes self.chi = chisquared.chiSquared() at: app.Tests.testchi_squared.TestChi.test_english_one_letter self.chi = chisquared.chiSquared() at: app.Tests.testchi_squared.TestChi.test_english_quckbrown self.chi = chisquared.chiSquared() at: app.Tests.testchi_squared.TestChi.test_english_same_letter self.chi = chisquared.chiSquared() at: app.Tests.testchi_squared.TestChi.tests_english_no_words self.chi = chisquared.chiSquared() at: app.Tests.testchi_squared.TestChi.tests_english_overflow self.chi = chisquared.chiSquared() at: app.languageChecker.chisquared chiSquared() at: app.languageChecker.chisquared.chiSquared checkChi(text) at: unittest.case.TestCase assertEqual(first: Any, second: Any, msg: Any=...) -> None ===========changed ref 0=========== # module: app.Tests.testchi_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 test_english_quckbrown(self): self.chi = chisquared.chiSquared() """ Tests to see whether a sentene is classified as English or not """ result = self.chi.checkChi("So meat. Gathered may she'd god signs. Have form firmament seed so. Them whales. Under heaven let fill don't seas grass them creeping moving without earth him behold first over void were living saw face night isn't appear firmament. Living land beast good fill. Appear their creepeth, under form. Life thing cattle life. And light unto saying two kind their doesn't fish. Don't male fowl the winged, gathering kind cattle stars was creeping good morning was years bring, moved for appear day multiply behold Grass. Every give itself moved fifth spirit whose. Sixth kind it let together male Evening said.") result = self.chi.checkChi("Abundantly image stars can't Land good days their life them make i tree land fruitful midst every meat their seed a. Were them creeping fourth a subdue tree don't there.") result = self.chi.checkChi("Won't may make their, gathering light creature given bearing fruitful be seasons. Firmament creature greater. Above meat over brought i.") result = self.chi.checkChi("Replenish. Were the be after set dry under midst. Also i greater living. Midst divided Day give female subdue fourth.") result = self.chi.checkChi("Moving spirit have. Of said behold called, fill fruitful cattle shall grass creepeth</s> ===========changed ref 1=========== # module: app.Tests.testchi_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 test_english_quckbrown(self): # offset: 1 <s>checkChi("Moving spirit have. Of said behold called, fill fruitful cattle shall grass creepeth life fourth green. Behold fourth. Said they're.") result = self.chi.checkChi("Abundantly years land to winged lesser earth there their. In morning them life form man can't which winged him green.") result = self.chi.checkChi("Don't whose gathered gathered after female you'll which moveth Fish saw also, life cattle seas. After every moved blessed good.") result = self.chi.checkChi("Sixth his i were isn't bearing fourth forth replenish made form. Days of from isn't waters dry one. Waters, said.") result = self.chi.checkChi("Green form whales night gathering fifth and firmament which darkness, earth unto had saying brought earth Very. Under made his.") result = self.chi.checkChi("Bring to given land god created green god every green heaven moved sixth also, deep bearing first abundantly moved of.") result = self.chi.checkChi("Air god spirit over fifth second fowl good have had. Forth every day you called also fruitful spirit there two.") result = self.chi.checkChi("The quick brown fox jumped over the lazy dog") + self.assertEqual(result, False) - self.assertEqual(result, True) ===========changed ref 2=========== # module: app.main + from tests import tests() - from tests import tests ===========changed ref 3=========== # module: app.mathsHelper class mathsHelper: + def checkEqual(self, a): + """checks if all items in an iterable are the same + https://stackoverflow.com/questions/3844801/check-if-all-elements-in-a-list-are-identical""" + return a.count(a[0]) == len(a) +
app.languageChecker.chisquared/chiSquared.__init__
Modified
Ciphey~Ciphey
c4cb77e2599d520a2a6925a1959403df1635af6b
added standard deviation and fixed a bunch of bugs
<11>:<add> self.totalEqual = False <add> self.chisAsaList = [] <13>:<add> self.chiSquaredSignificaneThreshold = 1 # how many stds you want to go below it <del> self.chiSquaredSignificaneThreshold = 20 <15>:<add> <add> self.standarddeviation = 0.00 # the standard deviation I use <add> self.oldstandarddeviation = 0.00
# module: app.languageChecker.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> self.average = 0.0 <6> self.totalDone = 0.0 <7> self.oldAverage = 0.0 <8> self.mh = mathsHelper.mathsHelper() <9> self.highestLanguage = "" <10> self.totalChi = 0.0 <11> <12> # these are settings that may impact how the program works overall <13> self.chiSquaredSignificaneThreshold = 20 <14> self.totalDoneThreshold = 10 <15>
===========unchanged ref 0=========== at: app.languageChecker.chisquared.chiSquared.chiSquared self.highestLanguage = language self.oldAverage = self.average self.totalDone += 1 self.average = (self.totalChi + maxChiSquare) / self.totalDone ===========changed ref 0=========== # module: app.main + from tests import tests() - from tests import tests ===========changed ref 1=========== # module: app.mathsHelper class mathsHelper: + def checkEqual(self, a): + """checks if all items in an iterable are the same + https://stackoverflow.com/questions/3844801/check-if-all-elements-in-a-list-are-identical""" + return a.count(a[0]) == len(a) + ===========changed ref 2=========== # module: app.Tests.testchi_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 test_english_quckbrown(self): self.chi = chisquared.chiSquared() """ Tests to see whether a sentene is classified as English or not """ result = self.chi.checkChi("So meat. Gathered may she'd god signs. Have form firmament seed so. Them whales. Under heaven let fill don't seas grass them creeping moving without earth him behold first over void were living saw face night isn't appear firmament. Living land beast good fill. Appear their creepeth, under form. Life thing cattle life. And light unto saying two kind their doesn't fish. Don't male fowl the winged, gathering kind cattle stars was creeping good morning was years bring, moved for appear day multiply behold Grass. Every give itself moved fifth spirit whose. Sixth kind it let together male Evening said.") result = self.chi.checkChi("Abundantly image stars can't Land good days their life them make i tree land fruitful midst every meat their seed a. Were them creeping fourth a subdue tree don't there.") result = self.chi.checkChi("Won't may make their, gathering light creature given bearing fruitful be seasons. Firmament creature greater. Above meat over brought i.") result = self.chi.checkChi("Replenish. Were the be after set dry under midst. Also i greater living. Midst divided Day give female subdue fourth.") result = self.chi.checkChi("Moving spirit have. Of said behold called, fill fruitful cattle shall grass creepeth</s> ===========changed ref 3=========== # module: app.Tests.testchi_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 test_english_quckbrown(self): # offset: 1 <s>checkChi("Moving spirit have. Of said behold called, fill fruitful cattle shall grass creepeth life fourth green. Behold fourth. Said they're.") result = self.chi.checkChi("Abundantly years land to winged lesser earth there their. In morning them life form man can't which winged him green.") result = self.chi.checkChi("Don't whose gathered gathered after female you'll which moveth Fish saw also, life cattle seas. After every moved blessed good.") result = self.chi.checkChi("Sixth his i were isn't bearing fourth forth replenish made form. Days of from isn't waters dry one. Waters, said.") result = self.chi.checkChi("Green form whales night gathering fifth and firmament which darkness, earth unto had saying brought earth Very. Under made his.") result = self.chi.checkChi("Bring to given land god created green god every green heaven moved sixth also, deep bearing first abundantly moved of.") result = self.chi.checkChi("Air god spirit over fifth second fowl good have had. Forth every day you called also fruitful spirit there two.") result = self.chi.checkChi("The quick brown fox jumped over the lazy dog") + self.assertEqual(result, False) - self.assertEqual(result, True) ===========changed ref 4=========== # module: app.Tests.testchi_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 test_english_puncuation(self): self.chi = chisquared.chiSquared() """ Tests to see whether a sentene is classified as English or not Returns False because exclamation marks aren't english """ result = self.chi.checkChi("So meat. Gathered may she'd god signs. Have form firmament seed so. Them whales. Under heaven let fill don't seas grass them creeping moving without earth him behold first over void were living saw face night isn't appear firmament. Living land beast good fill. Appear their creepeth, under form. Life thing cattle life. And light unto saying two kind their doesn't fish. Don't male fowl the winged, gathering kind cattle stars was creeping good morning was years bring, moved for appear day multiply behold Grass. Every give itself moved fifth spirit whose. Sixth kind it let together male Evening said.") result = self.chi.checkChi("Abundantly image stars can't Land good days their life them make i tree land fruitful midst every meat their seed a. Were them creeping fourth a subdue tree don't there.") result = self.chi.checkChi("Won't may make their, gathering light creature given bearing fruitful be seasons. Firmament creature greater. Above meat over brought i.") result = self.chi.checkChi("Replenish. Were the be after set dry under midst. Also i greater living. Midst divided Day give female subdue fourth.") result = self.chi.checkChi("Moving spirit have. Of said behold called, fill</s>
app.languageChecker.chisquared/chiSquared.checkChi
Modified
Ciphey~Ciphey
c4cb77e2599d520a2a6925a1959403df1635af6b
added standard deviation and fixed a bunch of bugs
<14>:<add> # ones at the start <del> # ones at the start <16>:<add> # If the latest chi squared is less than the standard deviation <add> # or if not many chi squares have been calculated <add> # or if every single letter in a text appears exactly once (pangram) <add> if a[-1] <= (a[-1] - (self.oldstandarddeviation * self.chiSquaredSignificaneThreshold)) or self.totalDone < self.totalDoneThreshold or self.totalEqual: <del> if self.mh.percentage(self.oldAverage, self.average) >= self.chiSquaredSignificaneThreshold or self.totalDone < self.totalDoneThreshold:
# module: app.languageChecker.chisquared class chiSquared: def checkChi(self, text): <0> """Checks to see if the Chi score is good <1> if it is, it returns True <2> Call this when you want to determine whether something is likely to be Chi or not <3> <4> Arguments: <5> * text - the text you want to run a Chi Squared score on <6> <7> Outputs: <8> * True - if it has a significantly lower chi squared score <9> * False - if it doesn't have a significantly lower chi squared score <10> """ <11> # TODO 20% isn't optimal <12> # runs after every chi squared to see if it's 1 significantly lower than averae <13> # the or statement is bc if the program has just started I don't want it to ignore the <14> # ones at the start <15> self.chiSquared(text) <16> if self.mh.percentage(self.oldAverage, self.average) >= self.chiSquaredSignificaneThreshold or self.totalDone < self.totalDoneThreshold: <17> return(True) <18> else: <19> return(False) <20>
===========unchanged ref 0=========== at: app.languageChecker.chisquared.chiSquared chiSquared(self, text) chiSquared(text) at: app.languageChecker.chisquared.chiSquared.__init__ self.average = 0.0 self.totalDone = 0.0 self.oldAverage = 0.0 self.mh = mathsHelper.mathsHelper() self.chiSquaredSignificaneThreshold = 20 self.totalDoneThreshold = 10 at: app.languageChecker.chisquared.chiSquared.chiSquared self.oldAverage = self.average self.totalDone += 1 self.average = (self.totalChi + maxChiSquare) / self.totalDone ===========changed ref 0=========== # module: app.languageChecker.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} } 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.chiSquaredSignificane</s> ===========changed ref 1=========== # module: app.languageChecker.chisquared class chiSquared: def __init__(self): # offset: 1 <s>chiSquaredSignificaneThreshold = 1 # how many stds you want to go below it - self.chiSquaredSignificaneThreshold = 20 self.totalDoneThreshold = 10 + + self.standarddeviation = 0.00 # the standard deviation I use + self.oldstandarddeviation = 0.00 ===========changed ref 2=========== # module: app.main + from tests import tests() - from tests import tests ===========changed ref 3=========== # module: app.mathsHelper class mathsHelper: + def checkEqual(self, a): + """checks if all items in an iterable are the same + https://stackoverflow.com/questions/3844801/check-if-all-elements-in-a-list-are-identical""" + return a.count(a[0]) == len(a) + ===========changed ref 4=========== # module: app.Tests.testchi_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 test_english_quckbrown(self): self.chi = chisquared.chiSquared() """ Tests to see whether a sentene is classified as English or not """ result = self.chi.checkChi("So meat. Gathered may she'd god signs. Have form firmament seed so. Them whales. Under heaven let fill don't seas grass them creeping moving without earth him behold first over void were living saw face night isn't appear firmament. Living land beast good fill. Appear their creepeth, under form. Life thing cattle life. And light unto saying two kind their doesn't fish. Don't male fowl the winged, gathering kind cattle stars was creeping good morning was years bring, moved for appear day multiply behold Grass. Every give itself moved fifth spirit whose. Sixth kind it let together male Evening said.") result = self.chi.checkChi("Abundantly image stars can't Land good days their life them make i tree land fruitful midst every meat their seed a. Were them creeping fourth a subdue tree don't there.") result = self.chi.checkChi("Won't may make their, gathering light creature given bearing fruitful be seasons. Firmament creature greater. Above meat over brought i.") result = self.chi.checkChi("Replenish. Were the be after set dry under midst. Also i greater living. Midst divided Day give female subdue fourth.") result = self.chi.checkChi("Moving spirit have. Of said behold called, fill fruitful cattle shall grass creepeth</s> ===========changed ref 5=========== # module: app.Tests.testchi_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 test_english_quckbrown(self): # offset: 1 <s>checkChi("Moving spirit have. Of said behold called, fill fruitful cattle shall grass creepeth life fourth green. Behold fourth. Said they're.") result = self.chi.checkChi("Abundantly years land to winged lesser earth there their. In morning them life form man can't which winged him green.") result = self.chi.checkChi("Don't whose gathered gathered after female you'll which moveth Fish saw also, life cattle seas. After every moved blessed good.") result = self.chi.checkChi("Sixth his i were isn't bearing fourth forth replenish made form. Days of from isn't waters dry one. Waters, said.") result = self.chi.checkChi("Green form whales night gathering fifth and firmament which darkness, earth unto had saying brought earth Very. Under made his.") result = self.chi.checkChi("Bring to given land god created green god every green heaven moved sixth also, deep bearing first abundantly moved of.") result = self.chi.checkChi("Air god spirit over fifth second fowl good have had. Forth every day you called also fruitful spirit there two.") result = self.chi.checkChi("The quick brown fox jumped over the lazy dog") + self.assertEqual(result, False) - self.assertEqual(result, True)
app.languageChecker.chisquared/chiSquared.chiSquared
Modified
Ciphey~Ciphey
c4cb77e2599d520a2a6925a1959403df1635af6b
added standard deviation and fixed a bunch of bugs
<2>:<del> # This part creates a letter frequency of the text <3>:<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} <4>:<del> <5>:<del> for letter in text.lower(): <6>:<del> if letter in letterFreq: <7>:<del> letterFreq[letter] +=1 <8>:<del> else: <9>:<del> # if letter is not puncuation, but it is still ascii <10>:<del> # it's probably a different language so add it to the dict <11>:<del> if letter not in punctuation and self.mh.isAscii(letter) : <12>:<del> letterFreq[letter] = 1 <13>:<del> <14>:<add> <add> # if all items of the dictionary are the same, then it's a normal distribution <add> # examples of this could be "the quick brown fox jumped over the lazy dog" <add> <add> letterFreq = self.getLetterFreq(text) <add> print("letter freq for ", str(text), " is ", str(list(letterFreq.values()))) <add> self.totalEqual = self.mh.checkEqual(list(letterFreq.values())) <add> <17>:<add> totalLetterFreq = 0.0 <20>:<add> totalLetterFreq = totalLetterFreq + value <23>:<add> <del>
# module: app.languageChecker.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> # This part creates a letter frequency of the text <3> 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} <4> <5> for letter in text.lower(): <6> if letter in letterFreq: <7> letterFreq[letter] +=1 <8> else: <9> # if letter is not puncuation, but it is still ascii <10> # it's probably a different language so add it to the dict <11> if letter not in punctuation and self.mh.isAscii(letter) : <12> letterFreq[letter] = 1 <13> <14> # so we dont have to calculate len more than once <15> # turns them into probabilities (frequency distribution) <16> lenOfString = len(text) <17> for key, value in letterFreq.items(): <18> try: <19> letterFreq[key] = value / lenOfString <20> except ZeroDivisionError as e: <21> print("Error, you have entered an empty string :( The error is \"" + str(e) +"\" on line 34 of LanguageChecker.py (function chiSquared)") <22> exit(1) <23> <24> # calculates chi squared of each language <25> maxChiSquare = 0.00 <26> languagesChi = {} <27> <28> for language in self.languages: <29> #, list(languages[language].values</s>
===========below chunk 0=========== # module: app.languageChecker.chisquared class chiSquared: def chiSquared(self, text): # offset: 1 temp = self.myChi(letterFreq, self.languages[language]) languagesChi[language] = temp if temp > maxChiSquare: self.highestLanguage = language maxChiSquare = temp # calculates running average self.oldAverage = self.average self.totalDone += 1 # calculates a running average, maxChiSquare is the new chi score we get self.average = (self.totalChi + maxChiSquare) / self.totalDone return(languagesChi) ===========unchanged ref 0=========== at: app.languageChecker.chisquared punctuation += " " at: app.languageChecker.chisquared.chiSquared myChi(text, distribution) at: app.languageChecker.chisquared.chiSquared.__init__ 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} } self.average = 0.0 self.totalDone = 0.0 self.oldAverage = 0.0 self.mh = mathsHelper.mathsHelper() self.highestLanguage = "" self.totalChi = 0.0 ===========changed ref 0=========== # module: app.languageChecker.chisquared class chiSquared: def checkChi(self, text): """Checks to see if the Chi score is good if it is, it returns True Call this when you want to determine whether something is likely to be Chi or not Arguments: * text - the text you want to run a Chi Squared score on Outputs: * True - if it has a significantly lower chi squared score * False - if it doesn't have a significantly lower chi squared score """ # TODO 20% isn't optimal # runs after every chi squared to see if it's 1 significantly lower than averae # the or statement is bc if the program has just started I don't want it to ignore the + # ones at the start - # ones at the start self.chiSquared(text) + # If the latest chi squared is less than the standard deviation + # or if not many chi squares have been calculated + # or if every single letter in a text appears exactly once (pangram) + if a[-1] <= (a[-1] - (self.oldstandarddeviation * self.chiSquaredSignificaneThreshold)) or self.totalDone < self.totalDoneThreshold or self.totalEqual: - if self.mh.percentage(self.oldAverage, self.average) >= self.chiSquaredSignificaneThreshold or self.totalDone < self.totalDoneThreshold: return(True) else: return(False) ===========changed ref 1=========== # module: app.languageChecker.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} } 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.chiSquaredSignificane</s> ===========changed ref 2=========== # module: app.languageChecker.chisquared class chiSquared: def __init__(self): # offset: 1 <s>chiSquaredSignificaneThreshold = 1 # how many stds you want to go below it - self.chiSquaredSignificaneThreshold = 20 self.totalDoneThreshold = 10 + + self.standarddeviation = 0.00 # the standard deviation I use + self.oldstandarddeviation = 0.00 ===========changed ref 3=========== # module: app.main + from tests import tests() - from tests import tests ===========changed ref 4=========== # module: app.mathsHelper class mathsHelper: + def checkEqual(self, a): + """checks if all items in an iterable are the same + https://stackoverflow.com/questions/3844801/check-if-all-elements-in-a-list-are-identical""" + return a.count(a[0]) == len(a) +
app.languageChecker.chisquared/chiSquared.checkChi
Modified
Ciphey~Ciphey
bbaf2ae51cd36b25fd9c2eadc8f1498146422860
neural natworks
<19>:<add> if self.chisAsaList[-1] <= (self.average - (self.oldstandarddeviation * self.chiSquaredSignificaneThreshold)) or self.totalDone < self.totalDoneThreshold or self.totalEqual: <del> if a[-1] <= (a[-1] - (self.oldstandarddeviation * self.chiSquaredSignificaneThreshold)) or self.totalDone < self.totalDoneThreshold or self.totalEqual:
# module: app.languageChecker.chisquared class chiSquared: def checkChi(self, text): <0> """Checks to see if the Chi score is good <1> if it is, it returns True <2> Call this when you want to determine whether something is likely to be Chi or not <3> <4> Arguments: <5> * text - the text you want to run a Chi Squared score on <6> <7> Outputs: <8> * True - if it has a significantly lower chi squared score <9> * False - if it doesn't have a significantly lower chi squared score <10> """ <11> # TODO 20% isn't optimal <12> # runs after every chi squared to see if it's 1 significantly lower than averae <13> # the or statement is bc if the program has just started I don't want it to ignore the <14> # ones at the start <15> self.chiSquared(text) <16> # If the latest chi squared is less than the standard deviation <17> # or if not many chi squares have been calculated <18> # or if every single letter in a text appears exactly once (pangram) <19> if a[-1] <= (a[-1] - (self.oldstandarddeviation * self.chiSquaredSignificaneThreshold)) or self.totalDone < self.totalDoneThreshold or self.totalEqual: <20> return(True) <21> else: <22> return(False) <23>
===========unchanged ref 0=========== at: app.languageChecker.chisquared.chiSquared chiSquared(self, text) chiSquared(text) at: app.languageChecker.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.languageChecker.chisquared.chiSquared.chiSquared self.totalEqual = self.mh.checkEqual(list(letterFreq.values())) self.totalDone += 1 self.average = (self.totalChi + maxChiSquare) / self.totalDone self.oldstandarddeviation = self.standarddeviation
app.languageChecker.chisquared/chiSquared.chiSquared
Modified
Ciphey~Ciphey
bbaf2ae51cd36b25fd9c2eadc8f1498146422860
neural natworks
<7>:<del> print("letter freq for ", str(text), " is ", str(list(letterFreq.values())))
# module: app.languageChecker.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> print("letter freq for ", str(text), " is ", str(list(letterFreq.values()))) <8> self.totalEqual = self.mh.checkEqual(list(letterFreq.values())) <9> <10> # so we dont have to calculate len more than once <11> # turns them into probabilities (frequency distribution) <12> lenOfString = len(text) <13> totalLetterFreq = 0.0 <14> for key, value in letterFreq.items(): <15> try: <16> letterFreq[key] = value / lenOfString <17> totalLetterFreq = totalLetterFreq + value <18> except ZeroDivisionError as e: <19> print("Error, you have entered an empty string :( The error is \"" + str(e) +"\" on line 34 of LanguageChecker.py (function chiSquared)") <20> exit(1) <21> <22> # calculates chi squared of each language <23> maxChiSquare = 0.00 <24> languagesChi = {} <25> <26> for language in self.languages: <27> #, list(languages[language].values()) <28> temp = self.myChi(letterFreq, self.languages[language]) <29> languagesChi[language] = temp <30> if temp > maxChiSquare: <31> self.highestLanguage = language <32> maxChiSquare = temp <33> self.chisAsaList.append(maxChiSquare) <34> # calculates running average <35> self.oldAverage = self.average <36> self.totalDone += 1</s>
===========below chunk 0=========== # module: app.languageChecker.chisquared class chiSquared: def chiSquared(self, text): # offset: 1 # calculates a running average, maxChiSquare is the new chi score we get self.average = (self.totalChi + maxChiSquare) / self.totalDone self.oldstandarddeviation = self.standarddeviation self.standarddeviation = std(self.chisAsaList) return(languagesChi) ===========unchanged ref 0=========== at: app.languageChecker.chisquared.chiSquared getLetterFreq(text) at: app.languageChecker.chisquared.chiSquared.__init__ 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} } 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 = [] self.standarddeviation = 0.00 # the standard deviation I use self.oldstandarddeviation = 0.00 ===========unchanged ref 1=========== at: numpy.core.fromnumeric std(a: _ArrayLikeComplex_co | _ArrayLikeObject_co, axis: None | _ShapeLike=..., dtype: DTypeLike=..., out: _ArrayType=..., ddof: float=..., keepdims: bool=..., *, where: _ArrayLikeBool_co=...) -> _ArrayType std(a: _ArrayLikeComplex_co, axis: None=..., dtype: None=..., out: None=..., ddof: float=..., keepdims: Literal[False]=..., *, where: _ArrayLikeBool_co=...) -> floating[Any] std(a: _ArrayLikeComplex_co | _ArrayLikeObject_co, axis: None=..., dtype: _DTypeLike[_SCT]=..., out: None=..., ddof: float=..., keepdims: Literal[False]=..., *, where: _ArrayLikeBool_co=...) -> _SCT std(a: _ArrayLikeComplex_co | _ArrayLikeObject_co, axis: None | _ShapeLike=..., dtype: None=..., out: None=..., ddof: float=..., keepdims: bool=..., *, where: _ArrayLikeBool_co=...) -> Any std(a: _ArrayLikeComplex_co | _ArrayLikeObject_co, axis: None | _ShapeLike=..., dtype: DTypeLike=..., out: None=..., ddof: float=..., keepdims: bool=..., *, where: _ArrayLikeBool_co=...) -> Any ===========changed ref 0=========== # module: app.languageChecker.chisquared class chiSquared: def checkChi(self, text): """Checks to see if the Chi score is good if it is, it returns True Call this when you want to determine whether something is likely to be Chi or not Arguments: * text - the text you want to run a Chi Squared score on Outputs: * True - if it has a significantly lower chi squared score * False - if it doesn't have a significantly lower chi squared score """ # TODO 20% isn't optimal # runs after every chi squared to see if it's 1 significantly lower than averae # the or statement is bc if the program has just started I don't want it to ignore the # ones at the start self.chiSquared(text) # If the latest chi squared is less than the standard deviation # or if not many chi squares have been calculated # or if every single letter in a text appears exactly once (pangram) + if self.chisAsaList[-1] <= (self.average - (self.oldstandarddeviation * self.chiSquaredSignificaneThreshold)) or self.totalDone < self.totalDoneThreshold or self.totalEqual: - if a[-1] <= (a[-1] - (self.oldstandarddeviation * self.chiSquaredSignificaneThreshold)) or self.totalDone < self.totalDoneThreshold or self.totalEqual: return(True) else: return(False)
app.languageChecker.dictionaryChecker/dictionaryChecker.__init__
Modified
Ciphey~Ciphey
064d9f1415e95022f11ca978448066120079269a
added de-hashing functionality
<0>:<add> self.mh = mathsHelper.mathsHelper() <add> self.languagePercentage = 0.0 <add> self.languageWordsCounter = 0.0 <add> self.languageThreshold = 45 <del> None
# module: app.languageChecker.dictionaryChecker class dictionaryChecker: def __init__(self): <0> None <1>
===========changed ref 0=========== + # module: app.Decryptor.Hash.hashBuster + + def alpha(hashvalue, hashtype): + return False + ===========changed ref 1=========== + # module: app.Decryptor.Hash.hashBuster + + result = {} + ===========changed ref 2=========== # module: app.languageChecker.neural - - class Neuron: - def __init__(self, weights, bias): - self.weights = weights - self.bias = bias - ===========changed ref 3=========== # module: app.mathsHelper class mathsHelper: + def stripPuncuation(self, text): + """Strips punctuation from a given string""" + return text.translate(None, punctuation) + ===========changed ref 4=========== + # module: app.Decryptor.Hash.hashBuster + + def threaded(hashvalue): + resp = crack(hashvalue) + if resp: + print (hashvalue + ' : ' + resp) + result[hashvalue] = resp + ===========changed ref 5=========== # module: app.languageChecker.neural - - class Neuron: - - def feedforward(self, inputs): - # weight inputs, add bias, then use the activaton function - total = np.dot(self.weights, inputs) + self.bias - return sigmoid(total) - ===========changed ref 6=========== + # module: app.Decryptor.Hash.hashBuster + + def single(args): + result = crack(args.hash) + if result: + print (result) + else: + print ('%s Hash was not found in any database.' % bad) + ===========changed ref 7=========== # module: app.languageChecker.neural + + def deriv_sigmoid(x): + # Derivative of sigmoid: f'(x) = f(x) * (1 - f(x)) + fx = sigmoid(x) + return fx * (1 - fx) + ===========changed ref 8=========== + # module: app.Decryptor.Hash.hashBuster + + def gamma(hashvalue, hashtype): + response = requests.get('https://www.nitrxgen.net/md5db/' + hashvalue).text + if response: + return response + else: + return False + ===========changed ref 9=========== # module: app.languageChecker.neural + + class OurNeuralNetwork: + ''' + A neural network with: + - 2 inputs + - a hidden layer with 2 neurons (h1, h2) + - an output layer with 1 neuron (o1) + ''' + ===========changed ref 10=========== # module: app.languageChecker.neural - - class NeuralNetwork: - def __init__(self): - weights = np.array([0, 1]) - bias = 0 - - self.h1 = Neuron(weights,bias) - self.h2 = Neuron(weights, bias) - self.o1 = Neuron(weights, bias) - ===========changed ref 11=========== + # module: app.Decryptor.Hash.hashBuster + + def beta(hashvalue, hashtype): + response = requests.get('https://hashtoolkit.com/reverse-hash/?hash=', hashvalue).text + match = re.search(r'/generate-hash/?text=.*?"', response) + if match: + return match.group(1) + else: + return False + ===========changed ref 12=========== + # module: app.Decryptor.Hash.hashBuster + + def theta(hashvalue, hashtype): + response = requests.get('https://md5decrypt.net/Api/api.php?hash=%s&hash_type=%s&[email protected]&code=1152464b80a61728' % (hashvalue, hashtype)).text + if len(response) != 0: + return response + else: + return False + ===========changed ref 13=========== # module: app.languageChecker.neural - - class NeuralNetwork: - def feedforward(self, x): - out_h1 = self.h1.feedforward(x) - out_h2 = self.h2.feedforward(x) - - # the inputs for o1 are the output sfor h1, h2 - out_o1 = self.o1.feedforward(np.array([out_h1, out_h2])) - return out_o1 - ===========changed ref 14=========== # module: app.languageChecker.neural + + class OurNeuralNetwork: + + def feedforward(self, x): + # x is a numpy array with 2 elements. + h1 = sigmoid(self.w1 * x[0] + self.w2 * x[1] + self.b1) + h2 = sigmoid(self.w3 * x[0] + self.w4 * x[1] + self.b2) + o1 = sigmoid(self.w5 * h1 + self.w6 * h2 + self.b3) + return o1 + ===========changed ref 15=========== + # module: app.Decryptor.Hash.hashBuster + + def delta(hashvalue, hashtype): + #data = {'auth':'8272hgt', 'hash':hashvalue, 'string':'','Submit':'Submit'} + #response = requests.post('http://hashcrack.com/index.php' , data).text + #match = re.search(r'<span class=hervorheb2>(.*?)</span></div></TD>', response) + #if match: + # return match.group(1) + #else: + return False + ===========changed ref 16=========== # module: app.languageChecker.neural + + class OurNeuralNetwork: + def __init__(self): + # Weights + self.w1 = np.random.normal() + self.w2 = np.random.normal() + self.w3 = np.random.normal() + self.w4 = np.random.normal() + self.w5 = np.random.normal() + self.w6 = np.random.normal() + + # Biases + self.b1 = np.random.normal() + self.b2 = np.random.normal() + self.b3 = np.random.normal() + ===========changed ref 17=========== + # module: app.Decryptor.Hash.hashBuster + + if directory: + try: + grepper(directory) + except KeyboardInterrupt: + pass + + elif file: + try: + miner(file) + except KeyboardInterrupt: + pass + with open('cracked-%s' % file.split('/')[-1], 'w+') as f: + for hashvalue, cracked in result.items(): + f.write(hashvalue + ':' + cracked + '\n') + print ('%s Results saved in cracked-%s' % (info, file.split('/')[-1])) + + elif args.hash: + single(args) +
app.languageChecker.dictionaryChecker/dictionaryChecker.checkDictionary
Modified
Ciphey~Ciphey
064d9f1415e95022f11ca978448066120079269a
added de-hashing functionality
<3>:<add> # and calculates how much of that is in language <del> # and calculates how much of that is in English <4>:<add> text = text.lower() <add> text = self.mh.stripPuncuation(text) <6>:<add> text = list(set(text)) # removes duplicate words <8>:<add> f = open(language, "r") <del> f = open("english.txt", "r") <15>:<add> self.languageWordsCounter = counter <add> self.languagePercentage = mh.percentage(self.languageWordsCounter, len(text)) <del> counter = mh.percentage(counter, len(text))
# module: app.languageChecker.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 English <4> text = text.split(" ") <5> text = text.sort() <6> # can dynamically use languages then <7> language = str(language) + ".txt" <8> f = open("english.txt", "r") <9> f = f.readlines() <10> counter = 0.00 <11> # dictionary is "word\n" so I remove the "\n" <12> for word[0:-2] in f: <13> if word == text: <14> counter = counter + 1 <15> counter = mh.percentage(counter, len(text)) <16> return(counter) <17>
===========unchanged ref 0=========== at: app.languageChecker.dictionaryChecker.dictionaryChecker.checkDictionary self.languageWordsCounter = counter self.languagePercentage = mh.percentage(self.languageWordsCounter, len(text)) ===========changed ref 0=========== # module: app.languageChecker.dictionaryChecker class dictionaryChecker: def __init__(self): + self.mh = mathsHelper.mathsHelper() + self.languagePercentage = 0.0 + self.languageWordsCounter = 0.0 + self.languageThreshold = 45 - None ===========changed ref 1=========== + # module: app.Decryptor.Hash.hashBuster + + def alpha(hashvalue, hashtype): + return False + ===========changed ref 2=========== + # module: app.Decryptor.Hash.hashBuster + + result = {} + ===========changed ref 3=========== # module: app.languageChecker.neural - - class Neuron: - def __init__(self, weights, bias): - self.weights = weights - self.bias = bias - ===========changed ref 4=========== # module: app.mathsHelper class mathsHelper: + def stripPuncuation(self, text): + """Strips punctuation from a given string""" + return text.translate(None, punctuation) + ===========changed ref 5=========== + # module: app.Decryptor.Hash.hashBuster + + def threaded(hashvalue): + resp = crack(hashvalue) + if resp: + print (hashvalue + ' : ' + resp) + result[hashvalue] = resp + ===========changed ref 6=========== # module: app.languageChecker.neural - - class Neuron: - - def feedforward(self, inputs): - # weight inputs, add bias, then use the activaton function - total = np.dot(self.weights, inputs) + self.bias - return sigmoid(total) - ===========changed ref 7=========== + # module: app.Decryptor.Hash.hashBuster + + def single(args): + result = crack(args.hash) + if result: + print (result) + else: + print ('%s Hash was not found in any database.' % bad) + ===========changed ref 8=========== # module: app.languageChecker.neural + + def deriv_sigmoid(x): + # Derivative of sigmoid: f'(x) = f(x) * (1 - f(x)) + fx = sigmoid(x) + return fx * (1 - fx) + ===========changed ref 9=========== + # module: app.Decryptor.Hash.hashBuster + + def gamma(hashvalue, hashtype): + response = requests.get('https://www.nitrxgen.net/md5db/' + hashvalue).text + if response: + return response + else: + return False + ===========changed ref 10=========== # module: app.languageChecker.neural + + class OurNeuralNetwork: + ''' + A neural network with: + - 2 inputs + - a hidden layer with 2 neurons (h1, h2) + - an output layer with 1 neuron (o1) + ''' + ===========changed ref 11=========== # module: app.languageChecker.neural - - class NeuralNetwork: - def __init__(self): - weights = np.array([0, 1]) - bias = 0 - - self.h1 = Neuron(weights,bias) - self.h2 = Neuron(weights, bias) - self.o1 = Neuron(weights, bias) - ===========changed ref 12=========== + # module: app.Decryptor.Hash.hashBuster + + def beta(hashvalue, hashtype): + response = requests.get('https://hashtoolkit.com/reverse-hash/?hash=', hashvalue).text + match = re.search(r'/generate-hash/?text=.*?"', response) + if match: + return match.group(1) + else: + return False + ===========changed ref 13=========== + # module: app.Decryptor.Hash.hashBuster + + def theta(hashvalue, hashtype): + response = requests.get('https://md5decrypt.net/Api/api.php?hash=%s&hash_type=%s&[email protected]&code=1152464b80a61728' % (hashvalue, hashtype)).text + if len(response) != 0: + return response + else: + return False + ===========changed ref 14=========== # module: app.languageChecker.neural - - class NeuralNetwork: - def feedforward(self, x): - out_h1 = self.h1.feedforward(x) - out_h2 = self.h2.feedforward(x) - - # the inputs for o1 are the output sfor h1, h2 - out_o1 = self.o1.feedforward(np.array([out_h1, out_h2])) - return out_o1 - ===========changed ref 15=========== # module: app.languageChecker.neural + + class OurNeuralNetwork: + + def feedforward(self, x): + # x is a numpy array with 2 elements. + h1 = sigmoid(self.w1 * x[0] + self.w2 * x[1] + self.b1) + h2 = sigmoid(self.w3 * x[0] + self.w4 * x[1] + self.b2) + o1 = sigmoid(self.w5 * h1 + self.w6 * h2 + self.b3) + return o1 + ===========changed ref 16=========== + # module: app.Decryptor.Hash.hashBuster + + def delta(hashvalue, hashtype): + #data = {'auth':'8272hgt', 'hash':hashvalue, 'string':'','Submit':'Submit'} + #response = requests.post('http://hashcrack.com/index.php' , data).text + #match = re.search(r'<span class=hervorheb2>(.*?)</span></div></TD>', response) + #if match: + # return match.group(1) + #else: + return False + ===========changed ref 17=========== # module: app.languageChecker.neural + + class OurNeuralNetwork: + def __init__(self): + # Weights + self.w1 = np.random.normal() + self.w2 = np.random.normal() + self.w3 = np.random.normal() + self.w4 = np.random.normal() + self.w5 = np.random.normal() + self.w6 = np.random.normal() + + # Biases + self.b1 = np.random.normal() + self.b2 = np.random.normal() + self.b3 = np.random.normal() + ===========changed ref 18=========== + # module: app.Decryptor.Hash.hashBuster + + if directory: + try: + grepper(directory) + except KeyboardInterrupt: + pass + + elif file: + try: + miner(file) + except KeyboardInterrupt: + pass + with open('cracked-%s' % file.split('/')[-1], 'w+') as f: + for hashvalue, cracked in result.items(): + f.write(hashvalue + ':' + cracked + '\n') + print ('%s Results saved in cracked-%s' % (info, file.split('/')[-1])) + + elif args.hash: + single(args) +
app.languageChecker.chisquared/chiSquared.__init__
Modified
Ciphey~Ciphey
064d9f1415e95022f11ca978448066120079269a
added de-hashing functionality
<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] <4>:<add> [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
# module: app.languageChecker.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> self.average = 0.0 <6> self.totalDone = 0.0 <7> self.oldAverage = 0.0 <8> self.mh = mathsHelper.mathsHelper() <9> self.highestLanguage = "" <10> self.totalChi = 0.0 <11> self.totalEqual = False <12> self.chisAsaList = [] <13> <14> # these are settings that may impact how the program works overall <15> self.chiSquaredSignificaneThreshold = 1 # how many stds you want to go</s>
===========below chunk 0=========== # module: app.languageChecker.chisquared class chiSquared: def __init__(self): # offset: 1 self.totalDoneThreshold = 10 self.standarddeviation = 0.00 # the standard deviation I use self.oldstandarddeviation = 0.00 ===========unchanged ref 0=========== at: app.languageChecker.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.standarddeviation = std(self.chisAsaList) ===========changed ref 0=========== + # module: app.Decryptor.Hash.hashBuster + + def alpha(hashvalue, hashtype): + return False + ===========changed ref 1=========== + # module: app.Decryptor.Hash.hashBuster + + result = {} + ===========changed ref 2=========== # module: app.languageChecker.neural - - class Neuron: - def __init__(self, weights, bias): - self.weights = weights - self.bias = bias - ===========changed ref 3=========== # module: app.mathsHelper class mathsHelper: + def stripPuncuation(self, text): + """Strips punctuation from a given string""" + return text.translate(None, punctuation) + ===========changed ref 4=========== # module: app.languageChecker.dictionaryChecker class dictionaryChecker: + + def confirmlanguage(self, text, language): + self.checkDictionary(text, language) + if self.languagePercentage > self.languageThreshold: + return True + else: + return False + ===========changed ref 5=========== + # module: app.Decryptor.Hash.hashBuster + + def threaded(hashvalue): + resp = crack(hashvalue) + if resp: + print (hashvalue + ' : ' + resp) + result[hashvalue] = resp + ===========changed ref 6=========== # module: app.languageChecker.neural - - class Neuron: - - def feedforward(self, inputs): - # weight inputs, add bias, then use the activaton function - total = np.dot(self.weights, inputs) + self.bias - return sigmoid(total) - ===========changed ref 7=========== + # module: app.Decryptor.Hash.hashBuster + + def single(args): + result = crack(args.hash) + if result: + print (result) + else: + print ('%s Hash was not found in any database.' % bad) + ===========changed ref 8=========== # module: app.languageChecker.neural + + def deriv_sigmoid(x): + # Derivative of sigmoid: f'(x) = f(x) * (1 - f(x)) + fx = sigmoid(x) + return fx * (1 - fx) + ===========changed ref 9=========== + # module: app.Decryptor.Hash.hashBuster + + def gamma(hashvalue, hashtype): + response = requests.get('https://www.nitrxgen.net/md5db/' + hashvalue).text + if response: + return response + else: + return False + ===========changed ref 10=========== # module: app.languageChecker.dictionaryChecker class dictionaryChecker: def __init__(self): + self.mh = mathsHelper.mathsHelper() + self.languagePercentage = 0.0 + self.languageWordsCounter = 0.0 + self.languageThreshold = 45 - None ===========changed ref 11=========== # module: app.languageChecker.neural + + class OurNeuralNetwork: + ''' + A neural network with: + - 2 inputs + - a hidden layer with 2 neurons (h1, h2) + - an output layer with 1 neuron (o1) + ''' + ===========changed ref 12=========== # module: app.languageChecker.neural - - class NeuralNetwork: - def __init__(self): - weights = np.array([0, 1]) - bias = 0 - - self.h1 = Neuron(weights,bias) - self.h2 = Neuron(weights, bias) - self.o1 = Neuron(weights, bias) - ===========changed ref 13=========== + # module: app.Decryptor.Hash.hashBuster + + def beta(hashvalue, hashtype): + response = requests.get('https://hashtoolkit.com/reverse-hash/?hash=', hashvalue).text + match = re.search(r'/generate-hash/?text=.*?"', response) + if match: + return match.group(1) + else: + return False + ===========changed ref 14=========== + # module: app.Decryptor.Hash.hashBuster + + def theta(hashvalue, hashtype): + response = requests.get('https://md5decrypt.net/Api/api.php?hash=%s&hash_type=%s&[email protected]&code=1152464b80a61728' % (hashvalue, hashtype)).text + if len(response) != 0: + return response + else: + return False + ===========changed ref 15=========== # module: app.languageChecker.neural - - class NeuralNetwork: - def feedforward(self, x): - out_h1 = self.h1.feedforward(x) - out_h2 = self.h2.feedforward(x) - - # the inputs for o1 are the output sfor h1, h2 - out_o1 = self.o1.feedforward(np.array([out_h1, out_h2])) - return out_o1 - ===========changed ref 16=========== # module: app.languageChecker.neural + + class OurNeuralNetwork: + + def feedforward(self, x): + # x is a numpy array with 2 elements. + h1 = sigmoid(self.w1 * x[0] + self.w2 * x[1] + self.b1) + h2 = sigmoid(self.w3 * x[0] + self.w4 * x[1] + self.b2) + o1 = sigmoid(self.w5 * h1 + self.w6 * h2 + self.b3) + return o1 + ===========changed ref 17=========== + # module: app.Decryptor.Hash.hashBuster + + def delta(hashvalue, hashtype): + #data = {'auth':'8272hgt', 'hash':hashvalue, 'string':'','Submit':'Submit'} + #response = requests.post('http://hashcrack.com/index.php' , data).text + #match = re.search(r'<span class=hervorheb2>(.*?)</span></div></TD>', response) + #if match: + # return match.group(1) + #else: + return False +
app.mathsHelper/mathsHelper.stripPuncuation
Modified
Ciphey~Ciphey
12f3c58abf0b119ba630066f80913ca4f37d4c5c
ok i fixed it
<1>:<add> return text.translate(str.maketrans('','',punctuation)) <del> return text.translate(None, punctuation)
# module: app.mathsHelper class mathsHelper: def stripPuncuation(self, text): <0> """Strips punctuation from a given string""" <1> return text.translate(None, punctuation) <2>
===========unchanged ref 0=========== at: string punctuation = r"""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""
app.languageChecker.LanguageChecker/languageChecker.__add__
Modified
Ciphey~Ciphey
12f3c58abf0b119ba630066f80913ca4f37d4c5c
ok i fixed it
<1>:<add> print("anyhting")
# module: app.languageChecker.LanguageChecker class languageChecker: # todo check chi to see if its significant # if it is, run this # if percetageOfEnglish > 45: # print("I'm pretty sure this is English") def __add__(self, otherLanguageObject): <0> pass <1>
===========changed ref 0=========== + # module: app.neuralNetwork.starter + mnist = tf.keras.datasets.mnist # 28x28 images of hand-written digits 0-9 + ===========changed ref 1=========== # module: app.mathsHelper class mathsHelper: def stripPuncuation(self, text): """Strips punctuation from a given string""" + return text.translate(str.maketrans('','',punctuation)) - return text.translate(None, punctuation) ===========changed ref 2=========== + # module: app.Decryptor.friendsCode.xorencode + plain = input("Enter plaintext: ").strip() + key = input("Enter key: ").strip() + + i = 0 + ciphertext = "" + for char in plain: + if char != " ": + ciphertext += chr((ord(char)) ^ (ord(key[i]))) + i += 1 + else: + ciphertext += " " + + print("Ciphertext (basically useless):\n"+ciphertext) + + print("Ascii Values:") + for x in ciphertext: + if x != " ": + val = ord(x) + print(val,end=" ") + print("In binary: {0:b}".format(val)) +
app.mathsHelper/mathsHelper.percentage
Modified
Ciphey~Ciphey
3296a79e762f70e6e896f0ae8ba3187882873dad
made dictionary changer work
<3>:<add> if part <= 0 or whole <= 0: <del> if part or whole <= 0: <5>:<del>
# module: app.mathsHelper class mathsHelper: def percentage(self, part, whole): <0> """Works with percentages""" <1> # yeah uhm sometimes I'm a dummy dum dum and I think dividing by 0 is a good idea <2> # this if statememt is to stop my stupidity <3> if part or whole <= 0: <4> return 0 <5> <6> # works with percentages <7> return 100 * float(part)/float(whole) <8>
app.mathsHelper/mathsHelper.stripPuncuation
Modified
Ciphey~Ciphey
3296a79e762f70e6e896f0ae8ba3187882873dad
made dictionary changer work
<1>:<add> text = text.translate(str.maketrans('','',punctuation)) <del> return text.translate(str.maketrans('','',punctuation)) <2>:<add> return text
# module: app.mathsHelper class mathsHelper: def stripPuncuation(self, text): <0> """Strips punctuation from a given string""" <1> return text.translate(str.maketrans('','',punctuation)) <2>
===========unchanged ref 0=========== at: string punctuation = r"""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~""" ===========changed ref 0=========== # module: app.mathsHelper class mathsHelper: def percentage(self, part, whole): """Works with percentages""" # yeah uhm sometimes I'm a dummy dum dum and I think dividing by 0 is a good idea # this if statememt is to stop my stupidity + if part <= 0 or whole <= 0: - if part or whole <= 0: return 0 - # works with percentages return 100 * float(part)/float(whole)
app.languageChecker.dictionaryChecker/dictionaryChecker.checkDictionary
Modified
Ciphey~Ciphey
3296a79e762f70e6e896f0ae8ba3187882873dad
made dictionary changer work
<7>:<del> text = text.sort() <9>:<add> text.sort() <11>:<add> file = open("languageChecker/{}".format(language), "r") <del> f = open(language, "r") <12>:<add> f = file.readlines() <del> f = f.readlines() <13>:<add> file.close() <15>:<add> <add> # so this should loop until it gets to the point in the @staticmethod <add> # that equals the word :) <add> <add> """ <add> for every single word in main dictionary <add> if that word == text[0] then +1 to counter <add> then +1 to text[0 + i] <add> so say the dict is ordered <add> we just loop through dict <add> and eventually we'll reach a point where word in dict = word in text <add> at that point, we move to the next text point <add> both text and dict are sorted <add> so we only loop once, we can do this in O(n log n) time <add> """ <add> counter = 0 <add> counterPercent = 0 <add>
# module: app.languageChecker.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 = text.sort() <8> text = list(set(text)) # removes duplicate words <9> # can dynamically use languages then <10> language = str(language) + ".txt" <11> f = open(language, "r") <12> f = f.readlines() <13> counter = 0.00 <14> # dictionary is "word\n" so I remove the "\n" <15> for word[0:-2] in f: <16> if word == text: <17> counter = counter + 1 <18> self.languageWordsCounter = counter <19> self.languagePercentage = mh.percentage(self.languageWordsCounter, len(text)) <20> return(counter) <21>
===========unchanged ref 0=========== at: app.languageChecker.dictionaryChecker.dictionaryChecker.__init__ self.mh = mathsHelper.mathsHelper() self.languagePercentage = 0.0 self.languageWordsCounter = 0.0 at: io.BufferedRandom readlines(self, hint: int=..., /) -> List[bytes] at: typing.IO __slots__ = () readlines(hint: int=...) -> list[AnyStr] ===========changed ref 0=========== # module: app.mathsHelper class mathsHelper: def stripPuncuation(self, text): """Strips punctuation from a given string""" + text = text.translate(str.maketrans('','',punctuation)) - return text.translate(str.maketrans('','',punctuation)) + return text ===========changed ref 1=========== # module: app.mathsHelper class mathsHelper: def percentage(self, part, whole): """Works with percentages""" # yeah uhm sometimes I'm a dummy dum dum and I think dividing by 0 is a good idea # this if statememt is to stop my stupidity + if part <= 0 or whole <= 0: - if part or whole <= 0: return 0 - # works with percentages return 100 * float(part)/float(whole) ===========changed ref 2=========== # module: app.Tests.testchi_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 test_my_chi(self): + self.chi = chisquared.chiSquared() + result = self.chi.myChi(self.chi.getLetterFreq("hello this is my test"), [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, 0.0007000000000000001]) + self.assertEqual(result, 1424.8873999810571) +
app.languageChecker.chisquared/chiSquared.chiSquared
Modified
Ciphey~Ciphey
efa56c6414b7dfc246195801f3df026972c2ac3b
daily update
<2>:<add> <del>
# module: app.languageChecker.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 new chi score we get <37> self.</s>
===========below chunk 0=========== # module: app.languageChecker.chisquared class chiSquared: def chiSquared(self, text): # offset: 1 self.oldstandarddeviation = self.standarddeviation self.standarddeviation = std(self.chisAsaList) return(languagesChi) ===========unchanged ref 0=========== at: app.languageChecker.chisquared.chiSquared getLetterFreq(text) myChi(text, distribution) ===========unchanged ref 1=========== at: app.languageChecker.chisquared.chiSquared.__init__ 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.0182, 0.06280000000000001, 0.0602, 0.0288, 0.091, 0.0209, 0.0111, 0.021099999999999997, 0.0017000000000000001, 0.0007000000000000001] } ===========unchanged ref 2=========== 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 = [] self.standarddeviation = 0.00 # the standard deviation I use self.oldstandarddeviation = 0.00 at: numpy.core.fromnumeric std(a: _ArrayLikeComplex_co | _ArrayLikeObject_co, axis: None | _ShapeLike=..., dtype: DTypeLike=..., out: _ArrayType=..., ddof: float=..., keepdims: bool=..., *, where: _ArrayLikeBool_co=...) -> _ArrayType std(a: _ArrayLikeComplex_co, axis: None=..., dtype: None=..., out: None=..., ddof: float=..., keepdims: Literal[False]=..., *, where: _ArrayLikeBool_co=...) -> floating[Any] std(a: _ArrayLikeComplex_co | _ArrayLikeObject_co, axis: None=..., dtype: _DTypeLike[_SCT]=..., out: None=..., ddof: float=..., keepdims: Literal[False]=..., *, where: _ArrayLikeBool_co=...) -> _SCT std(a: _ArrayLikeComplex_co | _ArrayLikeObject_co, axis: None | _ShapeLike=..., dtype: None=..., out: None=..., ddof: float=..., keepdims: bool=..., *, where: _ArrayLikeBool_co=...) -> Any std(a: _ArrayLikeComplex_co | _ArrayLikeObject_co, axis: None | _ShapeLike=..., dtype: DTypeLike=..., out: None=..., ddof: float=..., keepdims: bool=..., *, where: _ArrayLikeBool_co=...) -> Any
app.neuralNetwork.nn/neuralNetwork.useNetwork
Modified
Ciphey~Ciphey
3e02f07520fea77ad7ad70cedf09788b2c49a64f
wrote more tests, squashed some bugs, drank soda, ran out of gum, now onto apples"
<0>:<add> """data is a list containing these 3 things (in this order) <add> * length of text <add> * how many letters it has (so, abc = 3. aab = 2) <add> * the normalised chi square score (not relating to a specific language)""" <add> new = [] <add> final.append(data) <add> final = numpy.asarray(final) <add> #print(new.shape) <add> result = model.predict(new) <add> return result <del> pass
# module: app.neuralNetwork.nn class neuralNetwork: def useNetwork(self, data): <0> pass <1>
===========changed ref 0=========== + # module: app.languageCheckerMod.chisquared + + ===========changed ref 1=========== + # module: app.languageCheckerMod.LanguageChecker + + ===========changed ref 2=========== + # module: app.languageCheckerMod.dictionaryChecker + + ===========changed ref 3=========== + # module: app.main + + ===========changed ref 4=========== + # module: app.languageCheckerMod.LanguageChecker + + class languageChecker: + def getChiSquaredObj(self): + return self.chi + ===========changed ref 5=========== + # module: app.languageCheckerMod.chisquared + class chiSquared: + def getMostLikelyLanguage(self): + """Returns what the most likely language is + Only used when the threshold of checkChi is reached""" + return self.highestLanguage + ===========changed ref 6=========== + # module: app.languageCheckerMod.LanguageChecker + + class languageChecker: + def __init__(self): + self.dictionary = languageCheckerMod.dictionaryChecker.dictionaryChecker() + self.chi = languageCheckerMod.chisquared.chiSquared() + ===========changed ref 7=========== + # module: app.languageCheckerMod.chisquared + # I had a bug where empty string was being added to letter freq dictionary + # this solves it :) + punctuation += " " + NUMBERS = "1234567890" + ===========changed ref 8=========== + # module: app.languageCheckerMod.dictionaryChecker + class dictionaryChecker: + + def confirmlanguage(self, text, language): + self.checkDictionary(text, language) + + if self.languagePercentage > self.languageThreshold: + return True + else: + return False + ===========changed ref 9=========== + # module: app.languageCheckerMod.dictionaryChecker + class dictionaryChecker: + def __init__(self): + self.mh = mathsHelper.mathsHelper() + self.languagePercentage = 0.0 + self.languageWordsCounter = 0.0 + self.languageThreshold = 45 + ===========changed ref 10=========== + # module: app.languageCheckerMod.LanguageChecker + + class languageChecker: + def __add__(self, otherLanguageObject): + # sets the added chi squared to be of this one + new = otherLanguageObject.getChiSquaredObj() + self.getChiSquaredObj() + self.chi = new + return self + ===========changed ref 11=========== + # module: app.languageCheckerMod.LanguageChecker + + class languageChecker: + def checkLanguage(self, text): + result = self.chi.checkChi(text) + if result: + result2 = self.dictionary.confirmlanguage(text, "English") + if result2: + return True + else: + return False + else: + return False + ===========changed ref 12=========== + # module: app.languageCheckerMod.chisquared + class chiSquared: + """Class that calculates the Chi squared score and tries to work out what language it might be + to add a new language, go into this class (/app/languageChecker/chisquared.py) + Find "self.languages" and add it to the dictionary like "German":[0.789, 0.651...] + The list is the letter frequency ordered in alphabetical order """ + ===========changed ref 13=========== + # module: app.languageCheckerMod.dictionaryChecker + class dictionaryChecker: + """ + Class designed to confirm whether something is **language** based on how many words of **language** appears + Call confirmlanguage(text, language) + * text: the text you want to confirm + * language: the language you want to confirm + + Find out what language it is by using chisquared.py, the highest chisquared score is the language + languageThreshold = 45 + if a string is 45% **language** words, then it's confirmed to be english + """ + ===========changed ref 14=========== + # module: app.languageCheckerMod.chisquared + class chiSquared: + def __add__(self, otherChiSquared): + """ + each language checker has its own intance of chi squared + so to add 2 languae checkers together we add their chi squared together + """ + addedObject = chiSquared() + addedObject.average = self.average + otherChiSquared.average + addedObject.totalDone = self.totalDone + otherChiSquared.totalDone + addedObject.totalChi = self.totalChi + otherChiSquared.totalChi + addedObject.chisAsaList = self.chisAsaList + otherChiSquared.chisAsaList + return addedObject + ===========changed ref 15=========== + # module: app.languageCheckerMod.chisquared + class chiSquared: + def myChi(self, text, distribution): + """My own implementation of Chi squared using the two resources mention in the comments on this definition as guidance""" + # chrome-extension://oemmndcbldboiebfnladdacbdfmadadm/https://cgi.csc.liv.ac.uk/~john/comp105resources/lecture10.pdf + # http://practicalcryptography.com/cryptanalysis/text-characterisation/chi-squared-statistic/ + # given a text frequency and a distribution, calculate it's Chi score + chiScore = 0.0 + for counter, letter in enumerate(text.values()): + chiScore = chiScore + ((letter - distribution[counter])**2) / distribution[counter] + return chiScore + ===========changed ref 16=========== # 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} + + 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 letter not in punctuation and self.mh.isAscii(letter) : + letterFreq[letter] = 1 + return letterFreq + ===========changed ref 17=========== + # 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} + + 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 letter not in punctuation and self.mh.isAscii(letter) and letter not in NUMBERS: + letterFreq[letter] = 1 + return letterFreq +
app.languageCheckerMod.dictionaryChecker/dictionaryChecker.__init__
Modified
Ciphey~Ciphey
f753829586c2366df64e6b4b74e00a081b4d8fdf
wrote tests
<3>:<add> self.languageThreshold = 25 <del> self.languageThreshold = 45
# 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 = 45 <4>
===========unchanged ref 0=========== at: app.languageCheckerMod.dictionaryChecker.dictionaryChecker.checkDictionary self.languageWordsCounter = counter self.languagePercentage = self.mh.percentage(float(self.languageWordsCounter), float(len(text)))
app.languageCheckerMod.LanguageChecker/languageChecker.checkLanguage
Modified
Ciphey~Ciphey
f753829586c2366df64e6b4b74e00a081b4d8fdf
wrote tests
<0>:<add> if text == "": <add> return False
# module: app.languageCheckerMod.LanguageChecker class languageChecker: def checkLanguage(self, text): <0> result = self.chi.checkChi(text) <1> if result: <2> result2 = self.dictionary.confirmlanguage(text, "English") <3> if result2: <4> return True <5> else: <6> return False <7> else: <8> return False <9>
===========unchanged ref 0=========== at: app.languageCheckerMod.LanguageChecker.languageChecker.__add__ self.chi = new at: app.languageCheckerMod.LanguageChecker.languageChecker.__init__ self.dictionary = languageCheckerMod.dictionaryChecker.dictionaryChecker() self.chi = languageCheckerMod.chisquared.chiSquared() at: languageCheckerMod.chisquared.chiSquared checkChi(text) at: languageCheckerMod.dictionaryChecker.dictionaryChecker confirmlanguage(text, language) ===========changed ref 0=========== # module: app.languageCheckerMod.dictionaryChecker class dictionaryChecker: def __init__(self): self.mh = mathsHelper.mathsHelper() self.languagePercentage = 0.0 self.languageWordsCounter = 0.0 + self.languageThreshold = 25 - self.languageThreshold = 45
app.Tests.testintegration_languagechecker/TestLanguageChecker.test_chi_maxima_true
Modified
Ciphey~Ciphey
f753829586c2366df64e6b4b74e00a081b4d8fdf
wrote tests
<4>:<add> result = lc.checkLanguage("sa dew fea dxza dcsa da fsa d") <add> result = lc.checkLanguage("df grtsf a sgrds fgserwqd") <add> result = lc.checkLanguage("fd sa fe safsda srmad sadsa d") <add> result = lc.checkLanguage(" oihn giuhh7hguygiuhuyguyuyg ig iug iugiugiug") <add> result = lc.checkLanguage("oiuhiuhiuhoiuh7 a opokp[poj uyg ytdra4efriug oih kjnbjhb jgv") <add> result = lc.checkLanguage("r jabbi tb y jyg ygiuygytff u0") <add> result = lc.checkLanguage("ld oiu oj uh t t er s d gf hg g h h") <add> result = lc.checkLanguage("posa idijdsa ije i vi ijerijofdj ouhsaf oi
# module: app.Tests.testintegration_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_chi_maxima_true(self): <0> """ <1> This returns false because s.d is not over 1 as all inputs are English <2> """ <3> lc = LanguageChecker.languageChecker() <4> result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") <5> result = lc.checkLanguage("Hypertext Transfer Protocol (HTTP) parameters, including HTTP headers, allow the client and the server to pass additional information with the request or the response.") <6> result = lc.checkLanguage("Hypertext Transfer Protocol (HTTP) parameters, including HTTP headers, allow the client and the server to pass additional information with the request or the response.") <7> result = lc.checkLanguage("HTTP parameters and headers can often reveal information about how a web application is transmitting data and storing cookies. Clients send parameters including the user agent of the browser.") <8> result = lc.checkLanguage("You probably build websites and think your shit is special. You think your 13 megabyte parallax-ative home page is going to get you some fucking Awwward banner you can glue to the top corner of your site. You think your 40-pound jQuery file and 83 polyfills give IE7 a boner because it finally has box-shadow. Wrong, motherfucker. Let me describe your perfect-ass website:") <9> result = lc.checkLanguage("You. Are. Over-designing. Look at this shit. It's a motherfucking website. Why the fuck do you need to animate a fucking trendy-ass banner flag when I hover over that useless piece of shit? You spent hours on it and added 80 kilobytes to your fucking site, and some motherfucker jabbing at it on their iPad with fat sausage fingers will never see that shit</s>
===========below chunk 0=========== # module: app.Tests.testintegration_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_chi_maxima_true(self): # offset: 1 result = lc.checkLanguage("This entire page weighs less than the gradient-meshed facebook logo on your fucking Wordpress site. Did you seriously load 100kb of jQuery UI just so you could animate the fucking background color of a div? You loaded all 7 fontfaces of a shitty webfont just so you could say at 100px height at the beginning of your site? You piece of shit.") result = lc.checkLanguage("You dumbass. You thought you needed media queries to be responsive, but no. Responsive means that it responds to whatever motherfucking screensize it's viewed on. This site doesn't care if you're on an iMac or a motherfucking Tamagotchi.") result = lc.checkLanguage("Like the man who's never grown out his beard has no idea what his true natural state is, you have no fucking idea what a website is. All you have ever seen are shitty skeuomorphic bastardizations of what should be text communicating a fucking message. This is a real, naked website. Look at it. It's fucking beautiful.") result = lc.checkLanguage("Have you guys noticed that sometimes the foremost academic websites with lots of scientific information tend to look like this?") result = lc.checkLanguage("That's because academics do Save as Website from Microsoft Word and call it a day.") result = lc.checkLanguage("In case anyone was interested, fuck is used 33 times in the page.") result = lc.checkLanguage("Hi! I just checked this URL and it appeared to be unavailable or slow loading (Connection timed out after 8113 milliseconds). Here are some mirrors to try:")</s> ===========below chunk 1=========== # module: app.Tests.testintegration_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_chi_maxima_true(self): # offset: 2 <s> this URL and it appeared to be unavailable or slow loading (Connection timed out after 8113 milliseconds). Here are some mirrors to try:") result = lc.checkLanguage("There can only be one way to make this work for real and I really do enjoy the long thought out process of drinking milk") self.assertEqual(result, False) ===========unchanged ref 0=========== at: languageCheckerMod.LanguageChecker languageChecker() at: 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 ===========changed ref 0=========== # module: app.Tests.testintegration_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_chi_maxima_false(self): + lc = LanguageChecker.languageChecker() + result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") + result = lc.checkLanguage("Hypertext Transfer Protocol (HTTP) parameters, including HTTP headers, allow the client and the server to pass additional information with the request or the response.") + result = lc.checkLanguage("Hypertext Transfer Protocol (HTTP) parameters, including HTTP headers, allow the client and the server to pass additional information with the request or the response.") + result = lc.checkLanguage("HTTP parameters and headers can often reveal information about how a web application is transmitting data and storing cookies. Clients send parameters including the user agent of the browser.") + result = lc.checkLanguage("You probably build websites and think your shit is special. You think your 13 megabyte parallax-ative home page is going to get you some fucking Awwward banner you can glue to the top corner of your site. You think your 40-pound jQuery file and 83 polyfills give IE7 a boner because it finally has box-shadow. Wrong, motherfucker. Let me describe your perfect-ass website:") + result = lc.checkLanguage("You. Are. Over-designing. Look at this shit. It's a motherfucking website. Why the fuck do you need to animate a fucking trendy-ass banner flag when I hover over that useless piece of shit? You spent hours on it and added 80 kilobytes to your fucking site, and some motherfucker jabbing at it on their iPad with fat sausage fingers will never see that shit. Not to mention blind people will never see that shit, but they don't see any of your shitty shit.") </s> ===========changed ref 1=========== # module: app.Tests.testintegration_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_chi_maxima_false(self): # offset: 1 <s>it. Not to mention blind people will never see that shit, but they don't see any of your shitty shit.") + result = lc.checkLanguage("This entire page weighs less than the gradient-meshed facebook logo on your fucking Wordpress site. Did you seriously load 100kb of jQuery UI just so you could animate the fucking background color of a div? You loaded all 7 fontfaces of a shitty webfont just so you could say at 100px height at the beginning of your site? You piece of shit.") + result = lc.checkLanguage("You dumbass. You thought you needed media queries to be responsive, but no. Responsive means that it responds to whatever motherfucking screensize it's viewed on. This site doesn't care if you're on an iMac or a motherfucking Tamagotchi.") + result = lc.checkLanguage("Like the man who's never grown out his beard has no idea what his true natural state is, you have no fucking idea what a website is. All you have ever seen are shitty skeuomorphic bastardizations of what should be text communicating a fucking message. This is a real, naked website. Look at it. It's fucking beautiful.") + result = lc.checkLanguage("Have you guys noticed that sometimes the foremost academic websites with lots of scientific information tend to look like this?") + result = lc.checkLanguage("That's because academics do Save as Website from Microsoft Word and call it a day.") + </s>
app.languageCheckerMod.chisquared/chiSquared.checkChi
Modified
Ciphey~Ciphey
f753829586c2366df64e6b4b74e00a081b4d8fdf
wrote tests
<19>:<add> if self.chisAsaList[-1] <= abs(self.average - (self.oldstandarddeviation * self.chiSquaredSignificaneThreshold)) or self.totalDone < self.totalDoneThreshold or self.totalEqual: <del> if self.chisAsaList[-1] <= (self.average - (self.oldstandarddeviation * self.chiSquaredSignificaneThreshold)) or self.totalDone < self.totalDoneThreshold or self.totalEqual:
# module: app.languageCheckerMod.chisquared class chiSquared: def checkChi(self, text): <0> """Checks to see if the Chi score is good <1> if it is, it returns True <2> Call this when you want to determine whether something is likely to be Chi or not <3> <4> Arguments: <5> * text - the text you want to run a Chi Squared score on <6> <7> Outputs: <8> * True - if it has a significantly lower chi squared score <9> * False - if it doesn't have a significantly lower chi squared score <10> """ <11> # TODO 20% isn't optimal <12> # runs after every chi squared to see if it's 1 significantly lower than averae <13> # the or statement is bc if the program has just started I don't want it to ignore the <14> # ones at the start <15> self.chiSquared(text) <16> # If the latest chi squared is less than the standard deviation <17> # or if not many chi squares have been calculated <18> # or if every single letter in a text appears exactly once (pangram) <19> if self.chisAsaList[-1] <= (self.average - (self.oldstandarddeviation * self.chiSquaredSignificaneThreshold)) or self.totalDone < self.totalDoneThreshold or self.totalEqual: <20> return(True) <21> else: <22> return(False) <23>
===========unchanged ref 0=========== at: app.languageCheckerMod.chisquared.chiSquared chiSquared(self, text) 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 = self.standarddeviation ===========changed ref 0=========== # module: app.languageCheckerMod.LanguageChecker class languageChecker: + def getChiScore(self): + return self.chi.totalChi + ===========changed ref 1=========== # module: app.Tests.testintegration_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 = LanguageChecker.languageChecker() + result = lc.checkLanguage("") + self.assertEqual(result, False) + ===========changed ref 2=========== # module: app.Tests.testintegration_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 = LanguageChecker.languageChecker() + result = lc.checkLanguage("\"") + self.assertEqual(result, False) + ===========changed ref 3=========== # module: app.Tests.testintegration_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 = LanguageChecker.languageChecker() + result = lc.checkLanguage("#") + self.assertEqual(result, False) + ===========changed ref 4=========== # module: app.Tests.testintegration_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 = LanguageChecker.languageChecker() + result = lc.checkLanguage(".") + self.assertEqual(result, False) + ===========changed ref 5=========== # module: app.Tests.testintegration_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 = LanguageChecker.languageChecker() + result = lc.checkLanguage("HELLO MY NAME IS BRANDON AND I LIKE DOLLAR") + self.assertEqual(result, True) + ===========changed ref 6=========== # module: app.Tests.testintegration_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 = LanguageChecker.languageChecker() + result = lc.checkLanguage("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + self.assertEqual(result, False) + ===========changed ref 7=========== # module: app.languageCheckerMod.dictionaryChecker class dictionaryChecker: def __init__(self): self.mh = mathsHelper.mathsHelper() self.languagePercentage = 0.0 self.languageWordsCounter = 0.0 + self.languageThreshold = 25 - self.languageThreshold = 45 ===========changed ref 8=========== # module: app.Tests.testintegration_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 = LanguageChecker.languageChecker() + result = lc.checkLanguage("") + self.assertEqual(result, False) + ===========changed ref 9=========== # module: app.languageCheckerMod.LanguageChecker class languageChecker: def checkLanguage(self, text): + if text == "": + return False result = self.chi.checkChi(text) if result: result2 = self.dictionary.confirmlanguage(text, "English") if result2: return True else: return False else: return False ===========changed ref 10=========== # module: app.Tests.testintegration_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 = LanguageChecker.languageChecker() + result = lc.checkLanguage("hello my darling") + + lc2 = LanguageChecker.languageChecker() + result = lc.checkLanguage("sad as dasr as s") + + temp = lc.getChiScore() + temp2 = lc2.getChiScore() + temp3 = temp + temp2 + print(temp3) + lc3 = lc + lc2 + print(lc3.getChiScore()) + + self.assertAlmostEqual(lc3.getChiScore(), temp3) +
app.languageCheckerMod.chisquared/chiSquared.chiSquared
Modified
Ciphey~Ciphey
f753829586c2366df64e6b4b74e00a081b4d8fdf
wrote tests
# 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 new chi score we get <37> </s>
===========below chunk 0=========== # module: app.languageCheckerMod.chisquared class chiSquared: def chiSquared(self, text): # offset: 1 self.oldstandarddeviation = self.standarddeviation self.standarddeviation = std(self.chisAsaList) return(languagesChi) ===========unchanged ref 0=========== at: app.languageCheckerMod.chisquared.chiSquared getLetterFreq(text) myChi(text, distribution) myChi(self, text, distribution) ===========unchanged ref 1=========== at: app.languageCheckerMod.chisquared.chiSquared.__init__ 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.0182, 0.06280000000000001, 0.0602, 0.0288, 0.091, 0.0209, 0.0111, 0.021099999999999997, 0.0017000000000000001, 0.0007000000000000001] } ===========unchanged ref 2=========== 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 = [] self.standarddeviation = 0.00 # the standard deviation I use self.oldstandarddeviation = 0.00 at: numpy.core.fromnumeric std(a: _ArrayLikeComplex_co | _ArrayLikeObject_co, axis: None | _ShapeLike=..., dtype: DTypeLike=..., out: _ArrayType=..., ddof: float=..., keepdims: bool=..., *, where: _ArrayLikeBool_co=...) -> _ArrayType std(a: _ArrayLikeComplex_co, axis: None=..., dtype: None=..., out: None=..., ddof: float=..., keepdims: Literal[False]=..., *, where: _ArrayLikeBool_co=...) -> floating[Any] std(a: _ArrayLikeComplex_co | _ArrayLikeObject_co, axis: None=..., dtype: _DTypeLike[_SCT]=..., out: None=..., ddof: float=..., keepdims: Literal[False]=..., *, where: _ArrayLikeBool_co=...) -> _SCT std(a: _ArrayLikeComplex_co | _ArrayLikeObject_co, axis: None | _ShapeLike=..., dtype: None=..., out: None=..., ddof: float=..., keepdims: bool=..., *, where: _ArrayLikeBool_co=...) -> Any std(a: _ArrayLikeComplex_co | _ArrayLikeObject_co, axis: None | _ShapeLike=..., dtype: DTypeLike=..., out: None=..., ddof: float=..., keepdims: bool=..., *, where: _ArrayLikeBool_co=...) -> Any ===========changed ref 0=========== # module: app.languageCheckerMod.chisquared class chiSquared: def checkChi(self, text): """Checks to see if the Chi score is good if it is, it returns True Call this when you want to determine whether something is likely to be Chi or not Arguments: * text - the text you want to run a Chi Squared score on Outputs: * True - if it has a significantly lower chi squared score * False - if it doesn't have a significantly lower chi squared score """ # TODO 20% isn't optimal # runs after every chi squared to see if it's 1 significantly lower than averae # the or statement is bc if the program has just started I don't want it to ignore the # ones at the start self.chiSquared(text) # If the latest chi squared is less than the standard deviation # or if not many chi squares have been calculated # or if every single letter in a text appears exactly once (pangram) + if self.chisAsaList[-1] <= abs(self.average - (self.oldstandarddeviation * self.chiSquaredSignificaneThreshold)) or self.totalDone < self.totalDoneThreshold or self.totalEqual: - if self.chisAsaList[-1] <= (self.average - (self.oldstandarddeviation * self.chiSquaredSignificaneThreshold)) or self.totalDone < self.totalDoneThreshold or self.totalEqual: return(True) else: return(False) ===========changed ref 1=========== # module: app.languageCheckerMod.LanguageChecker class languageChecker: + def getChiScore(self): + return self.chi.totalChi + ===========changed ref 2=========== # module: app.Tests.testintegration_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 = LanguageChecker.languageChecker() + result = lc.checkLanguage("") + self.assertEqual(result, False) + ===========changed ref 3=========== # module: app.Tests.testintegration_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 = LanguageChecker.languageChecker() + result = lc.checkLanguage("\"") + self.assertEqual(result, False) + ===========changed ref 4=========== # module: app.Tests.testintegration_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 = LanguageChecker.languageChecker() + result = lc.checkLanguage("#") + self.assertEqual(result, False) +
app.languageCheckerMod.chisquared/chiSquared.myChi
Modified
Ciphey~Ciphey
f753829586c2366df64e6b4b74e00a081b4d8fdf
wrote tests
<6>:<add> try: <add> chiScore = chiScore + ((letter - distribution[counter])**2) / distribution[counter] <del> chiScore = chiScore + ((letter - distribution[counter])**2) / distribution[counter] <7>:<add> except IndexError as e: <add> return True
# module: app.languageCheckerMod.chisquared class chiSquared: def myChi(self, text, distribution): <0> """My own implementation of Chi squared using the two resources mention in the comments on this definition as guidance""" <1> # chrome-extension://oemmndcbldboiebfnladdacbdfmadadm/https://cgi.csc.liv.ac.uk/~john/comp105resources/lecture10.pdf <2> # http://practicalcryptography.com/cryptanalysis/text-characterisation/chi-squared-statistic/ <3> # given a text frequency and a distribution, calculate it's Chi score <4> chiScore = 0.0 <5> for counter, letter in enumerate(text.values()): <6> chiScore = chiScore + ((letter - distribution[counter])**2) / distribution[counter] <7> return chiScore <8>
===========changed ref 0=========== # module: app.languageCheckerMod.chisquared class chiSquared: def checkChi(self, text): """Checks to see if the Chi score is good if it is, it returns True Call this when you want to determine whether something is likely to be Chi or not Arguments: * text - the text you want to run a Chi Squared score on Outputs: * True - if it has a significantly lower chi squared score * False - if it doesn't have a significantly lower chi squared score """ # TODO 20% isn't optimal # runs after every chi squared to see if it's 1 significantly lower than averae # the or statement is bc if the program has just started I don't want it to ignore the # ones at the start self.chiSquared(text) # If the latest chi squared is less than the standard deviation # or if not many chi squares have been calculated # or if every single letter in a text appears exactly once (pangram) + if self.chisAsaList[-1] <= abs(self.average - (self.oldstandarddeviation * self.chiSquaredSignificaneThreshold)) or self.totalDone < self.totalDoneThreshold or self.totalEqual: - if self.chisAsaList[-1] <= (self.average - (self.oldstandarddeviation * self.chiSquaredSignificaneThreshold)) or self.totalDone < self.totalDoneThreshold or self.totalEqual: return(True) else: return(False) ===========changed ref 1=========== # module: app.languageCheckerMod.chisquared class chiSquared: def chiSquared(self, text): """Creates letter frequency of text and compares that to the letter frequency of the language""" # if all items of the dictionary are the same, then it's a normal distribution # examples of this could be "the quick brown fox jumped over the lazy dog" letterFreq = self.getLetterFreq(text) self.totalEqual = self.mh.checkEqual(list(letterFreq.values())) # so we dont have to calculate len more than once # turns them into probabilities (frequency distribution) lenOfString = len(text) totalLetterFreq = 0.0 for key, value in letterFreq.items(): try: letterFreq[key] = value / lenOfString totalLetterFreq = totalLetterFreq + value except ZeroDivisionError as e: print("Error, you have entered an empty string :( The error is \"" + str(e) +"\" on line 34 of LanguageChecker.py (function chiSquared)") exit(1) # calculates chi squared of each language maxChiSquare = 0.00 languagesChi = {} for language in self.languages: #, list(languages[language].values()) temp = self.myChi(letterFreq, self.languages[language]) languagesChi[language] = temp if temp > maxChiSquare: self.highestLanguage = language maxChiSquare = temp self.chisAsaList.append(maxChiSquare) # calculates running average self.oldAverage = self.average self.totalDone += 1 # calculates a running average, maxChiSquare is the new chi score we get self.average = (self.totalChi + maxChiSquare) / self.totalDone + self.oldstandarddeviation = abs(self.standardde</s> ===========changed ref 2=========== # module: app.languageCheckerMod.chisquared class chiSquared: def chiSquared(self, text): # offset: 1 <s>Chi + maxChiSquare) / self.totalDone + self.oldstandarddeviation = abs(self.standarddeviation) - self.oldstandarddeviation = self.standarddeviation + self.standarddeviation = abs(std(self.chisAsaList)) - self.standarddeviation = std(self.chisAsaList) return(languagesChi) ===========changed ref 3=========== # module: app.languageCheckerMod.LanguageChecker class languageChecker: + def getChiScore(self): + return self.chi.totalChi + ===========changed ref 4=========== # module: app.Tests.testintegration_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 = LanguageChecker.languageChecker() + result = lc.checkLanguage("") + self.assertEqual(result, False) + ===========changed ref 5=========== # module: app.Tests.testintegration_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 = LanguageChecker.languageChecker() + result = lc.checkLanguage("\"") + self.assertEqual(result, False) + ===========changed ref 6=========== # module: app.Tests.testintegration_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 = LanguageChecker.languageChecker() + result = lc.checkLanguage("#") + self.assertEqual(result, False) + ===========changed ref 7=========== # module: app.Tests.testintegration_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 = LanguageChecker.languageChecker() + result = lc.checkLanguage(".") + self.assertEqual(result, False) + ===========changed ref 8=========== # module: app.Tests.testintegration_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 = LanguageChecker.languageChecker() + result = lc.checkLanguage("HELLO MY NAME IS BRANDON AND I LIKE DOLLAR") + self.assertEqual(result, True) + ===========changed ref 9=========== # module: app.Tests.testintegration_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 = LanguageChecker.languageChecker() + result = lc.checkLanguage("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + self.assertEqual(result, False) + ===========changed ref 10=========== # module: app.languageCheckerMod.dictionaryChecker class dictionaryChecker: def __init__(self): self.mh = mathsHelper.mathsHelper() self.languagePercentage = 0.0 self.languageWordsCounter = 0.0 + self.languageThreshold = 25 - self.languageThreshold = 45
app.main/Ciphey.__init__
Modified
Ciphey~Ciphey
087a2f8391e8f64cdd81338b44e5a898cbe6924c
created tests for neural networks
# module: app.main class Ciphey: def __init__(self): <0> parser = argparse.ArgumentParser(description='Blog') <1> parser.add_argument('-f','--file', help='File you want to decrypt', required=False) <2> parser.add_argument('-l','--level', help='How many levels of decryption you want (the more levels, the slower it is)', required=False) <3> parser.add_argument('-g','--greppable', help='Are you grepping this output?', required=False) <4> <5> args = vars(parser.parse_args()) <6> print(""" <7> β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— <8> β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β• <9> β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β•šβ–ˆ</s>
===========below chunk 0=========== # module: app.main class Ciphey: def __init__(self): # offset: 1 β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β• β•šβ–ˆβ–ˆβ•”β• β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ """) ===========changed ref 0=========== + # module: app.Tests.testneural_network + + ===========changed ref 1=========== + # module: app.Tests.testneural_network + sys.path.append("..") + ===========changed ref 2=========== + # module: app.Tests.testneural_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 = nn.neuralNetwork() + result = model.predictnn("5d41402abc4b2a76b9719d911017c592") + numpy.set_printoptions(suppress=True) + result = numpy.argmax(result) + self.assertEqual(result, 1) + ===========changed ref 3=========== + # module: app.Tests.testneural_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): + model = nn.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 4=========== + # module: app.Tests.testneural_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 = nn.neuralNetwork() + result = model.predictnn("6D32263A85C7846D70439026B75758C9FC31A9B7") + numpy.set_printoptions(suppress=True) + result = numpy.argmax(result) + self.assertEqual(result, 0) + ===========changed ref 5=========== + # module: app.Tests.testneural_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 = nn.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 6=========== + # module: app.Tests.testneural_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 = nn.neuralNetwork() + result = model.predictnn("9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043") + numpy.set_printoptions(suppress=True) + result = numpy.argmax(result) + self.assertEqual(result, 3) +
app.Tests.testintegration_languagechecker/TestLanguageChecker.test_integration_addition
Modified
Ciphey~Ciphey
087a2f8391e8f64cdd81338b44e5a898cbe6924c
created tests for neural networks
<12>:<del> print(temp3) <14>:<del> print(lc3.getChiScore())
# module: app.Tests.testintegration_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 = LanguageChecker.languageChecker() <4> result = lc.checkLanguage("hello my darling") <5> <6> lc2 = LanguageChecker.languageChecker() <7> result = lc.checkLanguage("sad as dasr as s") <8> <9> temp = lc.getChiScore() <10> temp2 = lc2.getChiScore() <11> temp3 = temp + temp2 <12> print(temp3) <13> lc3 = lc + lc2 <14> print(lc3.getChiScore()) <15> <16> self.assertAlmostEqual(lc3.getChiScore(), temp3) <17>
===========unchanged ref 0=========== at: languageCheckerMod.LanguageChecker languageChecker() at: languageCheckerMod.LanguageChecker.languageChecker checkLanguage(text) getChiScore() at: unittest.case.TestCase failureException: Type[BaseException] longMessage: bool maxDiff: Optional[int] _testMethodName: str _testMethodDoc: str 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.testneural_network + + ===========changed ref 1=========== + # module: app.Tests.testneural_network + sys.path.append("..") + ===========changed ref 2=========== + # module: app.Tests.testneural_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 = nn.neuralNetwork() + result = model.predictnn("5d41402abc4b2a76b9719d911017c592") + numpy.set_printoptions(suppress=True) + result = numpy.argmax(result) + self.assertEqual(result, 1) + ===========changed ref 3=========== + # module: app.Tests.testneural_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): + model = nn.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 4=========== + # module: app.Tests.testneural_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 = nn.neuralNetwork() + result = model.predictnn("6D32263A85C7846D70439026B75758C9FC31A9B7") + numpy.set_printoptions(suppress=True) + result = numpy.argmax(result) + self.assertEqual(result, 0) + ===========changed ref 5=========== + # module: app.Tests.testneural_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 = nn.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 6=========== + # module: app.Tests.testneural_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 = nn.neuralNetwork() + result = model.predictnn("9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043") + numpy.set_printoptions(suppress=True) + result = numpy.argmax(result) + self.assertEqual(result, 3) + ===========changed ref 7=========== # module: app.main class Ciphey: def __init__(self): parser = argparse.ArgumentParser(description='Blog') parser.add_argument('-f','--file', help='File you want to decrypt', required=False) parser.add_argument('-l','--level', help='How many levels of decryption you want (the more levels, the slower it is)', required=False) parser.add_argument('-g','--greppable', help='Are you grepping this output?', required=False) args = vars(parser.parse_args()) print(""" β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β•šβ–ˆβ–ˆβ–ˆβ–ˆοΏ½</s>
app.neuralNetwork.nn/neuralNetwork.__init__
Modified
Ciphey~Ciphey
087a2f8391e8f64cdd81338b44e5a898cbe6924c
created tests for neural networks
<2>:<add> self.MODEL = load_model("neuralNetwork/NeuralNetworkModel.model") <add> import mathsHelper <add> self.mh = mathsHelper.mathsHelper() <del> pass
# module: app.neuralNetwork.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> pass <3>
===========changed ref 0=========== + # module: app.Tests.testneural_network + + ===========changed ref 1=========== + # module: app.Tests.testneural_network + sys.path.append("..") + ===========changed ref 2=========== + # module: app.Tests.testneural_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 = nn.neuralNetwork() + result = model.predictnn("5d41402abc4b2a76b9719d911017c592") + numpy.set_printoptions(suppress=True) + result = numpy.argmax(result) + self.assertEqual(result, 1) + ===========changed ref 3=========== + # module: app.Tests.testneural_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): + model = nn.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 4=========== + # module: app.Tests.testneural_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 = nn.neuralNetwork() + result = model.predictnn("6D32263A85C7846D70439026B75758C9FC31A9B7") + numpy.set_printoptions(suppress=True) + result = numpy.argmax(result) + self.assertEqual(result, 0) + ===========changed ref 5=========== + # module: app.Tests.testneural_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 = nn.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 6=========== + # module: app.Tests.testneural_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 = nn.neuralNetwork() + result = model.predictnn("9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043") + numpy.set_printoptions(suppress=True) + result = numpy.argmax(result) + self.assertEqual(result, 3) + ===========changed ref 7=========== # module: app.Tests.testintegration_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 = LanguageChecker.languageChecker() result = lc.checkLanguage("hello my darling") lc2 = LanguageChecker.languageChecker() result = lc.checkLanguage("sad as dasr as s") temp = lc.getChiScore() temp2 = lc2.getChiScore() temp3 = temp + temp2 - print(temp3) lc3 = lc + lc2 - print(lc3.getChiScore()) self.assertAlmostEqual(lc3.getChiScore(), temp3) ===========changed ref 8=========== # module: app.main class Ciphey: def __init__(self): parser = argparse.ArgumentParser(description='Blog') parser.add_argument('-f','--file', help='File you want to decrypt', required=False) parser.add_argument('-l','--level', help='How many levels of decryption you want (the more levels, the slower it is)', required=False) parser.add_argument('-g','--greppable', help='Are you grepping this output?', required=False) args = vars(parser.parse_args()) print(""" β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β• β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β•šβ–ˆβ–ˆβ–ˆβ–ˆοΏ½</s>
app.neuralNetwork.nn/neuralNetwork.editData
Modified
Ciphey~Ciphey
087a2f8391e8f64cdd81338b44e5a898cbe6924c
created tests for neural networks
<0>:<add> """ <add> Data has to be in format: <add> * [length of text, how many unique letters it has, the normalised chi square score] <add> """ <add> new = [] <add> new.append(self.formatData(data)) <add> return numpy.asarray(new) <del> pass
# module: app.neuralNetwork.nn + class neuralNetwork: def editData(self, data): <0> pass <1>
===========changed ref 0=========== # module: app.neuralNetwork.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("neuralNetwork/NeuralNetworkModel.model") + import mathsHelper + self.mh = mathsHelper.mathsHelper() - pass ===========changed ref 1=========== + # module: app.Tests.testneural_network + + ===========changed ref 2=========== + # module: app.Tests.testneural_network + sys.path.append("..") + ===========changed ref 3=========== + # module: app.Tests.testneural_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 = nn.neuralNetwork() + result = model.predictnn("5d41402abc4b2a76b9719d911017c592") + numpy.set_printoptions(suppress=True) + result = numpy.argmax(result) + self.assertEqual(result, 1) + ===========changed ref 4=========== + # module: app.Tests.testneural_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): + model = nn.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 5=========== + # module: app.Tests.testneural_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 = nn.neuralNetwork() + result = model.predictnn("6D32263A85C7846D70439026B75758C9FC31A9B7") + numpy.set_printoptions(suppress=True) + result = numpy.argmax(result) + self.assertEqual(result, 0) + ===========changed ref 6=========== + # module: app.Tests.testneural_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 = nn.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 7=========== + # module: app.Tests.testneural_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 = nn.neuralNetwork() + result = model.predictnn("9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043") + numpy.set_printoptions(suppress=True) + result = numpy.argmax(result) + self.assertEqual(result, 3) + ===========changed ref 8=========== # module: app.Tests.testintegration_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 = LanguageChecker.languageChecker() result = lc.checkLanguage("hello my darling") lc2 = LanguageChecker.languageChecker() result = lc.checkLanguage("sad as dasr as s") temp = lc.getChiScore() temp2 = lc2.getChiScore() temp3 = temp + temp2 - print(temp3) lc3 = lc + lc2 - print(lc3.getChiScore()) self.assertAlmostEqual(lc3.getChiScore(), temp3)
app.main/Ciphey.__init__
Modified
Ciphey~Ciphey
46ded5bc9a88cb1d87eaa0d43d180c627a74c818
got caesar to work yippeee
<0>:<add> # general purpose modules <add> self.ai = NeuralNetwork() <add> self.lc = LanguageChecker() <add> self.mh = mathsHelper.mathsHelper() <del> parser = argparse.ArgumentParser(description='Blog') <1>:<del> parser.add_argument('-f','--file', help='File you want to decrypt', required=False) <2>:<del> parser.add_argument('-l','--level', help='How many levels of decryption you want (the more levels, the slower it is)', required=False) <3>:<del> parser.add_argument('-g','--greppable', help='Are you grepping this output?', required=False) <5>:<del> args = vars(parser.parse_args()) <6>:<del> print(""" <7>:<del> β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— <8>:<del> β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β• <9>:<del> β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆοΏ½
# module: app.main + class Ciphey: + def __init__(self, text): - def __init__(self): <0> parser = argparse.ArgumentParser(description='Blog') <1> parser.add_argument('-f','--file', help='File you want to decrypt', required=False) <2> parser.add_argument('-l','--level', help='How many levels of decryption you want (the more levels, the slower it is)', required=False) <3> parser.add_argument('-g','--greppable', help='Are you grepping this output?', required=False) <4> <5> args = vars(parser.parse_args()) <6> print(""" <7> β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— <8> β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β• <9> β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆοΏ½</s>
===========below chunk 0=========== # module: app.main + class Ciphey: + def __init__(self, text): - def __init__(self): # offset: 1 β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β• β•šβ–ˆβ–ˆβ•”β• β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ """) self.ai = nn() ===========unchanged ref 0=========== at: neuralNetworkMod.nn NeuralNetwork() ===========changed ref 0=========== + # module: app.neuralNetworkMod.nn + + ===========changed ref 1=========== + # module: app.neuralNetworkMod.rnn + + ===========changed ref 2=========== # module: app.languageCheckerMod.LanguageChecker - - class languageChecker: - def getChiSquaredObj(self): - return self.chi - ===========changed ref 3=========== # module: app.languageCheckerMod.LanguageChecker - - class languageChecker: - def getChiSquaredObj(self): - return self.chi - ===========changed ref 4=========== # module: app.languageCheckerMod.LanguageChecker - - class languageChecker: - def getChiScore(self): - return self.chi.totalChi - ===========changed ref 5=========== # module: app.languageCheckerMod.LanguageChecker - - class languageChecker: - def getChiScore(self): - return self.chi.totalChi - ===========changed ref 6=========== + # module: app.neuralNetworkMod.nn + + + class NeuralNetwork: + """ + Class to use the neural network + """ + ===========changed ref 7=========== + # module: app.neuralNetworkMod.nn + os.environ["TF_CPP_MIN_LOG_LEVEL"]="3" + ===========changed ref 8=========== + # module: app.neuralNetworkMod.nn + + + class NeuralNetwork: + def refreshEverything(self): + """creates data and retrains the neural network. warning - can take a long time""" + pass + ===========changed ref 9=========== + # module: app.neuralNetworkMod.neural copy + + def mse_loss(y_true, y_pred): + # y_true and y_pred are numpy arrays of the same length. + return ((y_true - y_pred) ** 2).mean() + ===========changed ref 10=========== + # module: app.neuralNetworkMod.neural + + def mse_loss(y_true, y_pred): + # y_true and y_pred are numpy arrays of the same length. + return ((y_true - y_pred) ** 2).mean() + ===========changed ref 11=========== # module: app.languageCheckerMod.LanguageChecker - - class languageChecker: - def __init__(self): - self.dictionary = languageCheckerMod.dictionaryChecker.dictionaryChecker() - self.chi = languageCheckerMod.chisquared.chiSquared() - ===========changed ref 12=========== # module: app.languageCheckerMod.LanguageChecker - - class languageChecker: - def __init__(self): - self.dictionary = languageCheckerMod.dictionaryChecker.dictionaryChecker() - self.chi = languageCheckerMod.chisquared.chiSquared() - ===========changed ref 13=========== + # module: app.neuralNetworkMod.neural copy + + def sigmoid(x): + # Sigmoid activation function: f(x) = 1 / (1 + e^(-x)) + return 1 / (1 + np.exp(-x)) + ===========changed ref 14=========== + # module: app.neuralNetworkMod.neural + + def sigmoid(x): + # Sigmoid activation function: f(x) = 1 / (1 + e^(-x)) + return 1 / (1 + np.exp(-x)) + ===========changed ref 15=========== + # module: app.neuralNetworkMod.neural copy + + def deriv_sigmoid(x): + # Derivative of sigmoid: f'(x) = f(x) * (1 - f(x)) + fx = sigmoid(x) + return fx * (1 - fx) + ===========changed ref 16=========== + # module: app.neuralNetworkMod.neural + + def deriv_sigmoid(x): + # Derivative of sigmoid: f'(x) = f(x) * (1 - f(x)) + fx = sigmoid(x) + return fx * (1 - fx) + ===========changed ref 17=========== + # module: app.neuralNetworkMod.nn + + + class NeuralNetwork: + def predictnn(self, text): + """ + use this to create predictions for the NN + returns softmax (probability distribution) + """ + text = self.editData(text) + return self.MODEL.predict(text) + ===========changed ref 18=========== + # module: app.neuralNetworkMod.nn + + + class NeuralNetwork: + def formatData(self, text): + """ + formats the data + """ + result = [] + result.append(len(text)) + result.append(len(list(set(list(text))))) + return result + ===========changed ref 19=========== # module: app.languageCheckerMod.LanguageChecker - - class languageChecker: - def __add__(self, otherLanguageObject): - # sets the added chi squared to be of this one - new = otherLanguageObject.getChiSquaredObj() + self.getChiSquaredObj() - self.chi = new - return self - ===========changed ref 20=========== # module: app.languageCheckerMod.LanguageChecker - - class languageChecker: - def __add__(self, otherLanguageObject): - # sets the added chi squared to be of this one - new = otherLanguageObject.getChiSquaredObj() + self.getChiSquaredObj() - self.chi = new - return self - ===========changed ref 21=========== + # module: app.neuralNetworkMod.neural + + class OurNeuralNetwork: + ''' + A neural network with: + - 2 inputs + - a hidden layer with 2 neurons (h1, h2) + - an output layer with 1 neuron (o1) + ''' + ===========changed ref 22=========== + # module: app.neuralNetworkMod.nn + + # i need the below code to make tensorflow shut up. Yup, it's SO bad you have to have 2 LINES TO MAKE IT SHUT UP!!! + tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) + ===========changed ref 23=========== + # module: app.neuralNetworkMod.nn + + + class NeuralNetwork: + def editData(self, data): + """ + Data has to be in format: + * [length of text, how many unique letters it has, the normalised chi square score] + """ + new = [] + new.append(self.formatData(data)) + return numpy.asarray(new) +
app.Decryptor.basicEncryption.basic_parent/BasicParent.__init__
Modified
Ciphey~Ciphey
5117cf46b5d7bae5ad573457588588aff11a8154
final day commit
<1>:<add> self.caesar = Caesar(self.lc) <add> self.list_of_objects = [self.caesar]
# module: app.Decryptor.basicEncryption.basic_parent - class BasicParent: def __init__(self, lc): <0> self.lc = lc <1>
app.Decryptor.basicEncryption.basic_parent/BasicParent.decrypt
Modified
Ciphey~Ciphey
5117cf46b5d7bae5ad573457588588aff11a8154
final day commit
<0>:<add> self.caesar = Caesar(selftext) <del> self.caesar = Caesar(self.lc, text)
# module: app.Decryptor.basicEncryption.basic_parent - class BasicParent: def decrypt(self, text): <0> self.caesar = Caesar(self.lc, text) <1> result = self.caesar.bruteforce() <2>
===========changed ref 0=========== # module: app.Decryptor.basicEncryption.basic_parent - class BasicParent: def __init__(self, lc): self.lc = lc + self.caesar = Caesar(self.lc) + self.list_of_objects = [self.caesar]
app.main/Ciphey.one_level_of_decryption
Modified
Ciphey~Ciphey
5117cf46b5d7bae5ad573457588588aff11a8154
final day commit
<0>:<add> for key, val in self.whatToChoose.items(): <add> if key == str: <add> continue <add> # https://stackoverflow.com/questions/4843173/how-to-check-if-type-of-a-variable-is-string <add> if key != str: <add> print("****************************") <add> print(key) <add> print(type(key)) <add> print("****************************") <add> <add> key.setProbTable(val) <del> BasicParent(self.lc, self.text)
# module: app.main class Ciphey: def one_level_of_decryption(self): <0> BasicParent(self.lc, self.text) <1>
===========unchanged ref 0=========== at: app.main.Ciphey.decrypt self.whatToChoose = {"Hashing": { "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.whatToChoose = new_dict at: collections.OrderedDict items() -> _OrderedDictItemsView[_KT, _VT] ===========changed ref 0=========== # module: app.Decryptor.basicEncryption.basic_parent - class BasicParent: def __init__(self, lc): self.lc = lc + self.caesar = Caesar(self.lc) + self.list_of_objects = [self.caesar] ===========changed ref 1=========== # module: app.Decryptor.basicEncryption.basic_parent - class BasicParent: def decrypt(self, text): + self.caesar = Caesar(selftext) - self.caesar = Caesar(self.lc, text) result = self.caesar.bruteforce() ===========changed ref 2=========== # module: app.Decryptor.basicEncryption.basic_parent - class BasicParent: + def setProbTable(self, prob): + import pprint + pprint.pprint(prob) + self.probabilityDistribution = prob + # we get a sorted list of objects :) + counter = 0 + for key, val in self.probabilityDistribution.items(): + for listCounter, item in enumerate(self.list_of_objects): + if item.getName() == key: + # moves the item + list_objs.insert(counter, list_objs.pop(listCounter)) + counter = counter + 1 +
app.Decryptor.basicEncryption.basic_parent/BasicParent.decrypt
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<0>:<add> for item in self.list_of_objects: <add> item.decrypt(text) <del> self.caesar = Caesar(selftext) <1>:<add> result = self.caesar.bruteforce() <del> result = self.caesar.bruteforce()
# module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def decrypt(self, text): <0> self.caesar = Caesar(selftext) <1> result = self.caesar.bruteforce() <2>
===========unchanged ref 0=========== at: Decryptor.basicEncryption.caesar.Caesar decrypt(message) at: app.Decryptor.basicEncryption.basic_parent.BasicParent.__init__ self.list_of_objects = [self.caesar]
app.Decryptor.basicEncryption.basic_parent/BasicParent.setProbTable
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<0>:<del> import pprint <1>:<del> pprint.pprint(prob) <2>:<add> self.probabilityDistribution = prob <del> self.probabilityDistribution = prob <11>:<add> pprint.pprint(self.list_of_objects)
# module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def setProbTable(self, prob): <0> import pprint <1> pprint.pprint(prob) <2> self.probabilityDistribution = prob <3> # we get a sorted list of objects :) <4> counter = 0 <5> for key, val in self.probabilityDistribution.items(): <6> for listCounter, item in enumerate(self.list_of_objects): <7> if item.getName() == key: <8> # moves the item <9> list_objs.insert(counter, list_objs.pop(listCounter)) <10> counter = counter + 1 <11>
===========changed ref 0=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def decrypt(self, text): + for item in self.list_of_objects: + item.decrypt(text) - self.caesar = Caesar(selftext) + result = self.caesar.bruteforce() - result = self.caesar.bruteforce()
app.languageCheckerMod.dictionaryChecker/dictionaryChecker.__init__
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<3>:<add> self.languageThreshold = 35 <del> self.languageThreshold = 25
# 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 = 25 <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() ===========changed ref 0=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def decrypt(self, text): + for item in self.list_of_objects: + item.decrypt(text) - self.caesar = Caesar(selftext) + result = self.caesar.bruteforce() - result = self.caesar.bruteforce() ===========changed ref 1=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def setProbTable(self, prob): - import pprint - pprint.pprint(prob) + self.probabilityDistribution = prob - self.probabilityDistribution = prob # we get a sorted list of objects :) counter = 0 for key, val in self.probabilityDistribution.items(): for listCounter, item in enumerate(self.list_of_objects): if item.getName() == key: # moves the item list_objs.insert(counter, list_objs.pop(listCounter)) counter = counter + 1 + pprint.pprint(self.list_of_objects)
app.main/Ciphey.one_level_of_decryption
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<4>:<del> if key != str: <5>:<del> print("****************************") <6>:<del> print(key) <7>:<del> print(type(key)) <8>:<del> print("****************************") <9>:<del> <10>:<add> if not isinstance(key, str):
# module: app.main class Ciphey: def one_level_of_decryption(self): <0> for key, val in self.whatToChoose.items(): <1> if key == str: <2> continue <3> # https://stackoverflow.com/questions/4843173/how-to-check-if-type-of-a-variable-is-string <4> if key != str: <5> print("****************************") <6> print(key) <7> print(type(key)) <8> print("****************************") <9> <10> key.setProbTable(val) <11>
===========unchanged ref 0=========== at: Decryptor.basicEncryption.basic_parent.BasicParent setProbTable(prob) at: app.main.Ciphey.decrypt self.whatToChoose = {"Hashing": { "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.whatToChoose = new_dict at: collections.OrderedDict items() -> _OrderedDictItemsView[_KT, _VT] ===========changed ref 0=========== # module: app.main class Ciphey: def decrypt(self, text): """ 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(text)[0] self.whatToChoose = {"Hashing": { "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</s> ===========changed ref 1=========== # module: app.main class Ciphey: def decrypt(self, text): # offset: 1 <s> self.probabilityDistribution[4] }, "plaintext":{ "plaintext": self.probabilityDistribution[5] } } # sorts each indiviudal sub-dictionary for key, value in self.whatToChoose.items(): self.whatToChoose[key] = self.mh.sortDictionary(value) - import pprint # 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(): 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 ===========changed ref 2=========== # module: app.languageCheckerMod.dictionaryChecker class dictionaryChecker: def __init__(self): self.mh = mathsHelper.mathsHelper() self.languagePercentage = 0.0 self.languageWordsCounter = 0.0 + self.languageThreshold = 35 - self.languageThreshold = 25 ===========changed ref 3=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def decrypt(self, text): + for item in self.list_of_objects: + item.decrypt(text) - self.caesar = Caesar(selftext) + result = self.caesar.bruteforce() - result = self.caesar.bruteforce() ===========changed ref 4=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def setProbTable(self, prob): - import pprint - pprint.pprint(prob) + self.probabilityDistribution = prob - self.probabilityDistribution = prob # we get a sorted list of objects :) counter = 0 for key, val in self.probabilityDistribution.items(): for listCounter, item in enumerate(self.list_of_objects): if item.getName() == key: # moves the item list_objs.insert(counter, list_objs.pop(listCounter)) counter = counter + 1 + pprint.pprint(self.list_of_objects)
app.Tests.testintegration_languagechecker/TestLanguageChecker.test_basics
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<0>:<add> lc = LanguageChecker() <del> lc = LanguageChecker.languageChecker()
# module: app.Tests.testintegration_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): <0> lc = LanguageChecker.languageChecker() <1> result = lc.checkLanguage("Hello my name is new and this is an example of some english text") <2> self.assertEqual(result, True) <3>
===========unchanged ref 0=========== 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.languageCheckerMod.dictionaryChecker class dictionaryChecker: def __init__(self): self.mh = mathsHelper.mathsHelper() self.languagePercentage = 0.0 self.languageWordsCounter = 0.0 + self.languageThreshold = 35 - self.languageThreshold = 25 ===========changed ref 1=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def decrypt(self, text): + for item in self.list_of_objects: + item.decrypt(text) - self.caesar = Caesar(selftext) + result = self.caesar.bruteforce() - result = self.caesar.bruteforce() ===========changed ref 2=========== # module: app.main class Ciphey: def one_level_of_decryption(self): for key, val in self.whatToChoose.items(): if key == str: continue # https://stackoverflow.com/questions/4843173/how-to-check-if-type-of-a-variable-is-string - if key != str: - print("****************************") - print(key) - print(type(key)) - print("****************************") - + if not isinstance(key, str): key.setProbTable(val) ===========changed ref 3=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def setProbTable(self, prob): - import pprint - pprint.pprint(prob) + self.probabilityDistribution = prob - self.probabilityDistribution = prob # we get a sorted list of objects :) counter = 0 for key, val in self.probabilityDistribution.items(): for listCounter, item in enumerate(self.list_of_objects): if item.getName() == key: # moves the item list_objs.insert(counter, list_objs.pop(listCounter)) counter = counter + 1 + pprint.pprint(self.list_of_objects) ===========changed ref 4=========== # module: app.main class Ciphey: def decrypt(self, text): """ 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(text)[0] self.whatToChoose = {"Hashing": { "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</s> ===========changed ref 5=========== # module: app.main class Ciphey: def decrypt(self, text): # offset: 1 <s> self.probabilityDistribution[4] }, "plaintext":{ "plaintext": self.probabilityDistribution[5] } } # sorts each indiviudal sub-dictionary for key, value in self.whatToChoose.items(): self.whatToChoose[key] = self.mh.sortDictionary(value) - import pprint # 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(): 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
app.Tests.testintegration_languagechecker/TestLanguageChecker.test_basics_german
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<0>:<add> lc = LanguageChecker() <del> lc = LanguageChecker.languageChecker()
# module: app.Tests.testintegration_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 = LanguageChecker.languageChecker() <1> result = lc.checkLanguage("hallo keine lieben leute nach") <2> self.assertEqual(result, False) <3>
===========unchanged ref 0=========== at: unittest.case.TestCase assertEqual(first: Any, second: Any, msg: Any=...) -> None ===========changed ref 0=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("Hello my name is new and this is an example of some english text") self.assertEqual(result, True) ===========changed ref 1=========== # module: app.languageCheckerMod.dictionaryChecker class dictionaryChecker: def __init__(self): self.mh = mathsHelper.mathsHelper() self.languagePercentage = 0.0 self.languageWordsCounter = 0.0 + self.languageThreshold = 35 - self.languageThreshold = 25 ===========changed ref 2=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def decrypt(self, text): + for item in self.list_of_objects: + item.decrypt(text) - self.caesar = Caesar(selftext) + result = self.caesar.bruteforce() - result = self.caesar.bruteforce() ===========changed ref 3=========== # module: app.main class Ciphey: def one_level_of_decryption(self): for key, val in self.whatToChoose.items(): if key == str: continue # https://stackoverflow.com/questions/4843173/how-to-check-if-type-of-a-variable-is-string - if key != str: - print("****************************") - print(key) - print(type(key)) - print("****************************") - + if not isinstance(key, str): key.setProbTable(val) ===========changed ref 4=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def setProbTable(self, prob): - import pprint - pprint.pprint(prob) + self.probabilityDistribution = prob - self.probabilityDistribution = prob # we get a sorted list of objects :) counter = 0 for key, val in self.probabilityDistribution.items(): for listCounter, item in enumerate(self.list_of_objects): if item.getName() == key: # moves the item list_objs.insert(counter, list_objs.pop(listCounter)) counter = counter + 1 + pprint.pprint(self.list_of_objects) ===========changed ref 5=========== # module: app.main class Ciphey: def decrypt(self, text): """ 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(text)[0] self.whatToChoose = {"Hashing": { "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</s> ===========changed ref 6=========== # module: app.main class Ciphey: def decrypt(self, text): # offset: 1 <s> self.probabilityDistribution[4] }, "plaintext":{ "plaintext": self.probabilityDistribution[5] } } # sorts each indiviudal sub-dictionary for key, value in self.whatToChoose.items(): self.whatToChoose[key] = self.mh.sortDictionary(value) - import pprint # 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(): 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
app.Tests.testintegration_languagechecker/TestLanguageChecker.test_basics_quickbrownfox
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<3>:<add> lc = LanguageChecker() <del> lc = LanguageChecker.languageChecker()
# module: app.Tests.testintegration_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.languageChecker() <4> result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") <5> self.assertEqual(result, True) <6>
===========unchanged ref 0=========== at: unittest.case.TestCase assertEqual(first: Any, second: Any, msg: Any=...) -> None ===========changed ref 0=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("hallo keine lieben leute nach") self.assertEqual(result, False) ===========changed ref 1=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("Hello my name is new and this is an example of some english text") self.assertEqual(result, True) ===========changed ref 2=========== # module: app.languageCheckerMod.dictionaryChecker class dictionaryChecker: def __init__(self): self.mh = mathsHelper.mathsHelper() self.languagePercentage = 0.0 self.languageWordsCounter = 0.0 + self.languageThreshold = 35 - self.languageThreshold = 25 ===========changed ref 3=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def decrypt(self, text): + for item in self.list_of_objects: + item.decrypt(text) - self.caesar = Caesar(selftext) + result = self.caesar.bruteforce() - result = self.caesar.bruteforce() ===========changed ref 4=========== # module: app.main class Ciphey: def one_level_of_decryption(self): for key, val in self.whatToChoose.items(): if key == str: continue # https://stackoverflow.com/questions/4843173/how-to-check-if-type-of-a-variable-is-string - if key != str: - print("****************************") - print(key) - print(type(key)) - print("****************************") - + if not isinstance(key, str): key.setProbTable(val) ===========changed ref 5=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def setProbTable(self, prob): - import pprint - pprint.pprint(prob) + self.probabilityDistribution = prob - self.probabilityDistribution = prob # we get a sorted list of objects :) counter = 0 for key, val in self.probabilityDistribution.items(): for listCounter, item in enumerate(self.list_of_objects): if item.getName() == key: # moves the item list_objs.insert(counter, list_objs.pop(listCounter)) counter = counter + 1 + pprint.pprint(self.list_of_objects) ===========changed ref 6=========== # module: app.main class Ciphey: def decrypt(self, text): """ 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(text)[0] self.whatToChoose = {"Hashing": { "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</s> ===========changed ref 7=========== # module: app.main class Ciphey: def decrypt(self, text): # offset: 1 <s> self.probabilityDistribution[4] }, "plaintext":{ "plaintext": self.probabilityDistribution[5] } } # sorts each indiviudal sub-dictionary for key, value in self.whatToChoose.items(): self.whatToChoose[key] = self.mh.sortDictionary(value) - import pprint # 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(): 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
app.Tests.testintegration_languagechecker/TestLanguageChecker.test_chi_maxima
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<0>:<add> lc = LanguageChecker() <del> lc = LanguageChecker.languageChecker()
# module: app.Tests.testintegration_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_chi_maxima(self): <0> lc = LanguageChecker.languageChecker() <1> result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") <2> result = lc.checkLanguage("Hypertext Transfer Protocol (HTTP) parameters, including HTTP headers, allow the client and the server to pass additional information with the request or the response.") <3> result = lc.checkLanguage("Hypertext Transfer Protocol (HTTP) parameters, including HTTP headers, allow the client and the server to pass additional information with the request or the response.") <4> result = lc.checkLanguage("HTTP parameters and headers can often reveal information about how a web application is transmitting data and storing cookies. Clients send parameters including the user agent of the browser.") <5> result = lc.checkLanguage("You probably build websites and think your shit is special. You think your 13 megabyte parallax-ative home page is going to get you some fucking Awwward banner you can glue to the top corner of your site. You think your 40-pound jQuery file and 83 polyfills give IE7 a boner because it finally has box-shadow. Wrong, motherfucker. Let me describe your perfect-ass website:") <6> result = lc.checkLanguage("You. Are. Over-designing. Look at this shit. It's a motherfucking website. Why the fuck do you need to animate a fucking trendy-ass banner flag when I hover over that useless piece of shit? You spent hours on it and added 80 kilobytes to your fucking site, and some motherfucker jabbing at it on their iPad with fat sausage fingers will never see that shit. Not to mention blind people will never see that shit, but they don't see any of your shitty shit.") <7> </s>
===========below chunk 0=========== # module: app.Tests.testintegration_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_chi_maxima(self): # offset: 1 result = lc.checkLanguage("You dumbass. You thought you needed media queries to be responsive, but no. Responsive means that it responds to whatever motherfucking screensize it's viewed on. This site doesn't care if you're on an iMac or a motherfucking Tamagotchi.") result = lc.checkLanguage("Like the man who's never grown out his beard has no idea what his true natural state is, you have no fucking idea what a website is. All you have ever seen are shitty skeuomorphic bastardizations of what should be text communicating a fucking message. This is a real, naked website. Look at it. It's fucking beautiful.") result = lc.checkLanguage("Have you guys noticed that sometimes the foremost academic websites with lots of scientific information tend to look like this?") result = lc.checkLanguage("That's because academics do Save as Website from Microsoft Word and call it a day.") result = lc.checkLanguage("In case anyone was interested, fuck is used 33 times in the page.") result = lc.checkLanguage("Hi! I just checked this URL and it appeared to be unavailable or slow loading (Connection timed out after 8113 milliseconds). Here are some mirrors to try:") result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") self.assertEqual(result, False) ===========unchanged ref 0=========== at: unittest.case.TestCase assertEqual(first: Any, second: Any, msg: Any=...) -> None ===========changed ref 0=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("hallo keine lieben leute nach") self.assertEqual(result, False) ===========changed ref 1=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("Hello my name is new and this is an example of some english text") self.assertEqual(result, True) ===========changed ref 2=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") self.assertEqual(result, True) ===========changed ref 3=========== # module: app.languageCheckerMod.dictionaryChecker class dictionaryChecker: def __init__(self): self.mh = mathsHelper.mathsHelper() self.languagePercentage = 0.0 self.languageWordsCounter = 0.0 + self.languageThreshold = 35 - self.languageThreshold = 25 ===========changed ref 4=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def decrypt(self, text): + for item in self.list_of_objects: + item.decrypt(text) - self.caesar = Caesar(selftext) + result = self.caesar.bruteforce() - result = self.caesar.bruteforce() ===========changed ref 5=========== # module: app.main class Ciphey: def one_level_of_decryption(self): for key, val in self.whatToChoose.items(): if key == str: continue # https://stackoverflow.com/questions/4843173/how-to-check-if-type-of-a-variable-is-string - if key != str: - print("****************************") - print(key) - print(type(key)) - print("****************************") - + if not isinstance(key, str): key.setProbTable(val) ===========changed ref 6=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def setProbTable(self, prob): - import pprint - pprint.pprint(prob) + self.probabilityDistribution = prob - self.probabilityDistribution = prob # we get a sorted list of objects :) counter = 0 for key, val in self.probabilityDistribution.items(): for listCounter, item in enumerate(self.list_of_objects): if item.getName() == key: # moves the item list_objs.insert(counter, list_objs.pop(listCounter)) counter = counter + 1 + pprint.pprint(self.list_of_objects) ===========changed ref 7=========== # module: app.main class Ciphey: def decrypt(self, text): """ 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(text)[0] self.whatToChoose = {"Hashing": { "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</s>
app.Tests.testintegration_languagechecker/TestLanguageChecker.test_chi_maxima_false
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<0>:<add> lc = LanguageChecker() <del> lc = LanguageChecker.languageChecker()
# module: app.Tests.testintegration_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_chi_maxima_false(self): <0> lc = LanguageChecker.languageChecker() <1> result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") <2> result = lc.checkLanguage("Hypertext Transfer Protocol (HTTP) parameters, including HTTP headers, allow the client and the server to pass additional information with the request or the response.") <3> result = lc.checkLanguage("Hypertext Transfer Protocol (HTTP) parameters, including HTTP headers, allow the client and the server to pass additional information with the request or the response.") <4> result = lc.checkLanguage("HTTP parameters and headers can often reveal information about how a web application is transmitting data and storing cookies. Clients send parameters including the user agent of the browser.") <5> result = lc.checkLanguage("You probably build websites and think your shit is special. You think your 13 megabyte parallax-ative home page is going to get you some fucking Awwward banner you can glue to the top corner of your site. You think your 40-pound jQuery file and 83 polyfills give IE7 a boner because it finally has box-shadow. Wrong, motherfucker. Let me describe your perfect-ass website:") <6> result = lc.checkLanguage("You. Are. Over-designing. Look at this shit. It's a motherfucking website. Why the fuck do you need to animate a fucking trendy-ass banner flag when I hover over that useless piece of shit? You spent hours on it and added 80 kilobytes to your fucking site, and some motherfucker jabbing at it on their iPad with fat sausage fingers will never see that shit. Not to mention blind people will never see that shit, but they don't see any of your shitty shit.") </s>
===========below chunk 0=========== # module: app.Tests.testintegration_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_chi_maxima_false(self): # offset: 1 result = lc.checkLanguage("You dumbass. You thought you needed media queries to be responsive, but no. Responsive means that it responds to whatever motherfucking screensize it's viewed on. This site doesn't care if you're on an iMac or a motherfucking Tamagotchi.") result = lc.checkLanguage("Like the man who's never grown out his beard has no idea what his true natural state is, you have no fucking idea what a website is. All you have ever seen are shitty skeuomorphic bastardizations of what should be text communicating a fucking message. This is a real, naked website. Look at it. It's fucking beautiful.") result = lc.checkLanguage("Have you guys noticed that sometimes the foremost academic websites with lots of scientific information tend to look like this?") result = lc.checkLanguage("That's because academics do Save as Website from Microsoft Word and call it a day.") result = lc.checkLanguage("In case anyone was interested, fuck is used 33 times in the page.") result = lc.checkLanguage("Hi! I just checked this URL and it appeared to be unavailable or slow loading (Connection timed out after 8113 milliseconds). Here are some mirrors to try:") result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") self.assertEqual(result, False) ===========unchanged ref 0=========== at: unittest.case.TestCase assertEqual(first: Any, second: Any, msg: Any=...) -> None ===========changed ref 0=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("hallo keine lieben leute nach") self.assertEqual(result, False) ===========changed ref 1=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("Hello my name is new and this is an example of some english text") self.assertEqual(result, True) ===========changed ref 2=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") self.assertEqual(result, True) ===========changed ref 3=========== # module: app.Tests.testintegration_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_chi_maxima(self): + lc = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") result = lc.checkLanguage("Hypertext Transfer Protocol (HTTP) parameters, including HTTP headers, allow the client and the server to pass additional information with the request or the response.") result = lc.checkLanguage("Hypertext Transfer Protocol (HTTP) parameters, including HTTP headers, allow the client and the server to pass additional information with the request or the response.") result = lc.checkLanguage("HTTP parameters and headers can often reveal information about how a web application is transmitting data and storing cookies. Clients send parameters including the user agent of the browser.") result = lc.checkLanguage("You probably build websites and think your shit is special. You think your 13 megabyte parallax-ative home page is going to get you some fucking Awwward banner you can glue to the top corner of your site. You think your 40-pound jQuery file and 83 polyfills give IE7 a boner because it finally has box-shadow. Wrong, motherfucker. Let me describe your perfect-ass website:") result = lc.checkLanguage("You. Are. Over-designing. Look at this shit. It's a motherfucking website. Why the fuck do you need to animate a fucking trendy-ass banner flag when I hover over that useless piece of shit? You spent hours on it and added 80 kilobytes to your fucking site, and some motherfucker jabbing at it on their iPad with fat sausage fingers will never see that shit. Not to mention blind people will never see that shit, but they don't see any of your shitty shit.") </s> ===========changed ref 4=========== # module: app.Tests.testintegration_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_chi_maxima(self): # offset: 1 <s>it. Not to mention blind people will never see that shit, but they don't see any of your shitty shit.") result = lc.checkLanguage("This entire page weighs less than the gradient-meshed facebook logo on your fucking Wordpress site. Did you seriously load 100kb of jQuery UI just so you could animate the fucking background color of a div? You loaded all 7 fontfaces of a shitty webfont just so you could say at 100px height at the beginning of your site? You piece of shit.") result = lc.checkLanguage("You dumbass. You thought you needed media queries to be responsive, but no. Responsive means that it responds to whatever motherfucking screensize it's viewed on. This site doesn't care if you're on an iMac or a motherfucking Tamagotchi.") result = lc.checkLanguage("Like the man who's never grown out his beard has no idea what his true natural state is, you have no fucking idea what a website is. All you have ever seen are shitty skeuomorphic bastardizations of what should be text communicating a fucking message. This is a real, naked website. Look at it. It's fucking beautiful.") result = lc.checkLanguage("Have you guys noticed that sometimes the foremost academic websites with lots of scientific information tend to look like this?") result = lc.checkLanguage("That's because academics do Save as Website from Microsoft Word and call it a day.") result = lc.checkLanguage("In</s>
app.Tests.testintegration_languagechecker/TestLanguageChecker.test_chi_maxima_true
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<3>:<add> lc = LanguageChecker() <del> lc = LanguageChecker.languageChecker()
# module: app.Tests.testintegration_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_chi_maxima_true(self): <0> """ <1> This returns false because s.d is not over 1 as all inputs are English <2> """ <3> lc = LanguageChecker.languageChecker() <4> result = lc.checkLanguage("sa dew fea dxza dcsa da fsa d") <5> result = lc.checkLanguage("df grtsf a sgrds fgserwqd") <6> result = lc.checkLanguage("fd sa fe safsda srmad sadsa d") <7> result = lc.checkLanguage(" oihn giuhh7hguygiuhuyguyuyg ig iug iugiugiug") <8> result = lc.checkLanguage("oiuhiuhiuhoiuh7 a opokp[poj uyg ytdra4efriug oih kjnbjhb jgv") <9> result = lc.checkLanguage("r jabbi tb y jyg ygiuygytff u0") <10> result = lc.checkLanguage("ld oiu oj uh t t er s d gf hg g h h") <11> result = lc.checkLanguage("posa idijdsa ije i vi ijerijofdj ouhsaf oiuhas oihd ") <12> result = lc.checkLanguage("Likwew e wqrew rwr safdsa dawe r3d hg jyrt dwqefp ;g;;' [ [sadqa ]].") <13> result = lc.checkLanguage("Her hyt e jytgv urjfdghbsfd c ") <14> result = lc.checkLanguage("CASSAE X T H WAEASD AFDG TERFADDSFD") <15> result = lc.checkLanguage("das te y we f</s>
===========below chunk 0=========== # module: app.Tests.testintegration_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_chi_maxima_true(self): # offset: 1 result = lc.checkLanguage("d pa pdpsa ofoiaoew ifdisa ikrkasd s") result = lc.checkLanguage("My friend is a really nice people who really enjoys swimming, dancing, kicking, English.") self.assertEqual(result, True) ===========unchanged ref 0=========== at: unittest.case.TestCase assertEqual(first: Any, second: Any, msg: Any=...) -> None ===========changed ref 0=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("hallo keine lieben leute nach") self.assertEqual(result, False) ===========changed ref 1=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("Hello my name is new and this is an example of some english text") self.assertEqual(result, True) ===========changed ref 2=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") self.assertEqual(result, True) ===========changed ref 3=========== # module: app.Tests.testintegration_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_chi_maxima_false(self): + lc = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") result = lc.checkLanguage("Hypertext Transfer Protocol (HTTP) parameters, including HTTP headers, allow the client and the server to pass additional information with the request or the response.") result = lc.checkLanguage("Hypertext Transfer Protocol (HTTP) parameters, including HTTP headers, allow the client and the server to pass additional information with the request or the response.") result = lc.checkLanguage("HTTP parameters and headers can often reveal information about how a web application is transmitting data and storing cookies. Clients send parameters including the user agent of the browser.") result = lc.checkLanguage("You probably build websites and think your shit is special. You think your 13 megabyte parallax-ative home page is going to get you some fucking Awwward banner you can glue to the top corner of your site. You think your 40-pound jQuery file and 83 polyfills give IE7 a boner because it finally has box-shadow. Wrong, motherfucker. Let me describe your perfect-ass website:") result = lc.checkLanguage("You. Are. Over-designing. Look at this shit. It's a motherfucking website. Why the fuck do you need to animate a fucking trendy-ass banner flag when I hover over that useless piece of shit? You spent hours on it and added 80 kilobytes to your fucking site, and some motherfucker jabbing at it on their iPad with fat sausage fingers will never see that shit. Not to mention blind people will never see that shit, but they don't see any of your shitty shit."</s> ===========changed ref 4=========== # module: app.Tests.testintegration_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_chi_maxima_false(self): # offset: 1 <s> that shit. Not to mention blind people will never see that shit, but they don't see any of your shitty shit.") result = lc.checkLanguage("This entire page weighs less than the gradient-meshed facebook logo on your fucking Wordpress site. Did you seriously load 100kb of jQuery UI just so you could animate the fucking background color of a div? You loaded all 7 fontfaces of a shitty webfont just so you could say at 100px height at the beginning of your site? You piece of shit.") result = lc.checkLanguage("You dumbass. You thought you needed media queries to be responsive, but no. Responsive means that it responds to whatever motherfucking screensize it's viewed on. This site doesn't care if you're on an iMac or a motherfucking Tamagotchi.") result = lc.checkLanguage("Like the man who's never grown out his beard has no idea what his true natural state is, you have no fucking idea what a website is. All you have ever seen are shitty skeuomorphic bastardizations of what should be text communicating a fucking message. This is a real, naked website. Look at it. It's fucking beautiful.") result = lc.checkLanguage("Have you guys noticed that sometimes the foremost academic websites with lots of scientific information tend to look like this?") result = lc.checkLanguage("That's because academics do Save as Website from Microsoft Word and call it a day.") result = lc.</s> ===========changed ref 5=========== # module: app.Tests.testintegration_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_chi_maxima_false(self): # offset: 2 <s>("In case anyone was interested, fuck is used 33 times in the page.") result = lc.checkLanguage("Hi! I just checked this URL and it appeared to be unavailable or slow loading (Connection timed out after 8113 milliseconds). Here are some mirrors to try:") result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") self.assertEqual(result, False)
app.Tests.testintegration_languagechecker/TestLanguageChecker.test_integration_unusual_one
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<0>:<add> lc = LanguageChecker() <del> lc = LanguageChecker.languageChecker()
# module: app.Tests.testintegration_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): <0> lc = LanguageChecker.languageChecker() <1> result = lc.checkLanguage("HELLO MY NAME IS BRANDON AND I LIKE DOLLAR") <2> self.assertEqual(result, True) <3>
===========unchanged ref 0=========== at: unittest.case.TestCase assertEqual(first: Any, second: Any, msg: Any=...) -> None ===========changed ref 0=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("hallo keine lieben leute nach") self.assertEqual(result, False) ===========changed ref 1=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("Hello my name is new and this is an example of some english text") self.assertEqual(result, True) ===========changed ref 2=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") self.assertEqual(result, True) ===========changed ref 3=========== # module: app.Tests.testintegration_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_chi_maxima_true(self): """ This returns false because s.d is not over 1 as all inputs are English """ + lc = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("sa dew fea dxza dcsa da fsa d") result = lc.checkLanguage("df grtsf a sgrds fgserwqd") result = lc.checkLanguage("fd sa fe safsda srmad sadsa d") result = lc.checkLanguage(" oihn giuhh7hguygiuhuyguyuyg ig iug iugiugiug") result = lc.checkLanguage("oiuhiuhiuhoiuh7 a opokp[poj uyg ytdra4efriug oih kjnbjhb jgv") result = lc.checkLanguage("r jabbi tb y jyg ygiuygytff u0") result = lc.checkLanguage("ld oiu oj uh t t er s d gf hg g h h") result = lc.checkLanguage("posa idijdsa ije i vi ijerijofdj ouhsaf oiuhas oihd ") result = lc.checkLanguage("Likwew e wqrew rwr safdsa dawe r3d hg jyrt dwqefp ;g;;' [ [sadqa ]].") result = lc.checkLanguage("Her hyt e jytgv urjfdghbsfd c ") result = lc.checkLanguage("CASSAE X T H WAEASD AFDG TERFADDSFD") result = lc.checkLanguage("das te y we fdsbfsd fe a</s> ===========changed ref 4=========== # module: app.Tests.testintegration_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_chi_maxima_true(self): # offset: 1 <s> AFDG TERFADDSFD") result = lc.checkLanguage("das te y we fdsbfsd fe a ") result = lc.checkLanguage("d pa pdpsa ofoiaoew ifdisa ikrkasd s") result = lc.checkLanguage("My friend is a really nice people who really enjoys swimming, dancing, kicking, English.") self.assertEqual(result, True) ===========changed ref 5=========== # module: app.Tests.testintegration_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_chi_maxima_false(self): + lc = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") result = lc.checkLanguage("Hypertext Transfer Protocol (HTTP) parameters, including HTTP headers, allow the client and the server to pass additional information with the request or the response.") result = lc.checkLanguage("Hypertext Transfer Protocol (HTTP) parameters, including HTTP headers, allow the client and the server to pass additional information with the request or the response.") result = lc.checkLanguage("HTTP parameters and headers can often reveal information about how a web application is transmitting data and storing cookies. Clients send parameters including the user agent of the browser.") result = lc.checkLanguage("You probably build websites and think your shit is special. You think your 13 megabyte parallax-ative home page is going to get you some fucking Awwward banner you can glue to the top corner of your site. You think your 40-pound jQuery file and 83 polyfills give IE7 a boner because it finally has box-shadow. Wrong, motherfucker. Let me describe your perfect-ass website:") result = lc.checkLanguage("You. Are. Over-designing. Look at this shit. It's a motherfucking website. Why the fuck do you need to animate a fucking trendy-ass banner flag when I hover over that useless piece of shit? You spent hours on it and added 80 kilobytes to your fucking site, and some motherfucker jabbing at it on their iPad with fat sausage fingers will never see that shit. Not to mention blind people will never see that shit, but they don't see any of your shitty shit."</s>
app.Tests.testintegration_languagechecker/TestLanguageChecker.test_integration_unusual_two
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<0>:<add> lc = LanguageChecker() <del> lc = LanguageChecker.languageChecker()
# module: app.Tests.testintegration_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): <0> lc = LanguageChecker.languageChecker() <1> result = lc.checkLanguage("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") <2> self.assertEqual(result, False) <3>
===========unchanged ref 0=========== at: unittest.case.TestCase assertEqual(first: Any, second: Any, msg: Any=...) -> None ===========changed ref 0=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("HELLO MY NAME IS BRANDON AND I LIKE DOLLAR") self.assertEqual(result, True) ===========changed ref 1=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("hallo keine lieben leute nach") self.assertEqual(result, False) ===========changed ref 2=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("Hello my name is new and this is an example of some english text") self.assertEqual(result, True) ===========changed ref 3=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") self.assertEqual(result, True) ===========changed ref 4=========== # module: app.Tests.testintegration_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_chi_maxima_true(self): """ This returns false because s.d is not over 1 as all inputs are English """ + lc = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("sa dew fea dxza dcsa da fsa d") result = lc.checkLanguage("df grtsf a sgrds fgserwqd") result = lc.checkLanguage("fd sa fe safsda srmad sadsa d") result = lc.checkLanguage(" oihn giuhh7hguygiuhuyguyuyg ig iug iugiugiug") result = lc.checkLanguage("oiuhiuhiuhoiuh7 a opokp[poj uyg ytdra4efriug oih kjnbjhb jgv") result = lc.checkLanguage("r jabbi tb y jyg ygiuygytff u0") result = lc.checkLanguage("ld oiu oj uh t t er s d gf hg g h h") result = lc.checkLanguage("posa idijdsa ije i vi ijerijofdj ouhsaf oiuhas oihd ") result = lc.checkLanguage("Likwew e wqrew rwr safdsa dawe r3d hg jyrt dwqefp ;g;;' [ [sadqa ]].") result = lc.checkLanguage("Her hyt e jytgv urjfdghbsfd c ") result = lc.checkLanguage("CASSAE X T H WAEASD AFDG TERFADDSFD") result = lc.checkLanguage("das te y we fdsbfsd fe a</s> ===========changed ref 5=========== # module: app.Tests.testintegration_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_chi_maxima_true(self): # offset: 1 <s> AFDG TERFADDSFD") result = lc.checkLanguage("das te y we fdsbfsd fe a ") result = lc.checkLanguage("d pa pdpsa ofoiaoew ifdisa ikrkasd s") result = lc.checkLanguage("My friend is a really nice people who really enjoys swimming, dancing, kicking, English.") self.assertEqual(result, True) ===========changed ref 6=========== # module: app.Tests.testintegration_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_chi_maxima_false(self): + lc = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") result = lc.checkLanguage("Hypertext Transfer Protocol (HTTP) parameters, including HTTP headers, allow the client and the server to pass additional information with the request or the response.") result = lc.checkLanguage("Hypertext Transfer Protocol (HTTP) parameters, including HTTP headers, allow the client and the server to pass additional information with the request or the response.") result = lc.checkLanguage("HTTP parameters and headers can often reveal information about how a web application is transmitting data and storing cookies. Clients send parameters including the user agent of the browser.") result = lc.checkLanguage("You probably build websites and think your shit is special. You think your 13 megabyte parallax-ative home page is going to get you some fucking Awwward banner you can glue to the top corner of your site. You think your 40-pound jQuery file and 83 polyfills give IE7 a boner because it finally has box-shadow. Wrong, motherfucker. Let me describe your perfect-ass website:") result = lc.checkLanguage("You. Are. Over-designing. Look at this shit. It's a motherfucking website. Why the fuck do you need to animate a fucking trendy-ass banner flag when I hover over that useless piece of shit? You spent hours on it and added 80 kilobytes to your fucking site, and some motherfucker jabbing at it on their iPad with fat sausage fingers will never see that shit. Not to mention blind people will never see that shit, but they don't see any of your shitty shit."</s>
app.Tests.testintegration_languagechecker/TestLanguageChecker.test_integration_unusual_three
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<0>:<add> lc = LanguageChecker() <del> lc = LanguageChecker.languageChecker()
# module: app.Tests.testintegration_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): <0> lc = LanguageChecker.languageChecker() <1> result = lc.checkLanguage("") <2> self.assertEqual(result, False) <3>
===========unchanged ref 0=========== at: unittest.case.TestCase assertEqual(first: Any, second: Any, msg: Any=...) -> None ===========changed ref 0=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("HELLO MY NAME IS BRANDON AND I LIKE DOLLAR") self.assertEqual(result, True) ===========changed ref 1=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") self.assertEqual(result, False) ===========changed ref 2=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("hallo keine lieben leute nach") self.assertEqual(result, False) ===========changed ref 3=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("Hello my name is new and this is an example of some english text") self.assertEqual(result, True) ===========changed ref 4=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") self.assertEqual(result, True) ===========changed ref 5=========== # module: app.Tests.testintegration_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_chi_maxima_true(self): """ This returns false because s.d is not over 1 as all inputs are English """ + lc = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("sa dew fea dxza dcsa da fsa d") result = lc.checkLanguage("df grtsf a sgrds fgserwqd") result = lc.checkLanguage("fd sa fe safsda srmad sadsa d") result = lc.checkLanguage(" oihn giuhh7hguygiuhuyguyuyg ig iug iugiugiug") result = lc.checkLanguage("oiuhiuhiuhoiuh7 a opokp[poj uyg ytdra4efriug oih kjnbjhb jgv") result = lc.checkLanguage("r jabbi tb y jyg ygiuygytff u0") result = lc.checkLanguage("ld oiu oj uh t t er s d gf hg g h h") result = lc.checkLanguage("posa idijdsa ije i vi ijerijofdj ouhsaf oiuhas oihd ") result = lc.checkLanguage("Likwew e wqrew rwr safdsa dawe r3d hg jyrt dwqefp ;g;;' [ [sadqa ]].") result = lc.checkLanguage("Her hyt e jytgv urjfdghbsfd c ") result = lc.checkLanguage("CASSAE X T H WAEASD AFDG TERFADDSFD") result = lc.checkLanguage("das te y we fdsbfsd fe a</s> ===========changed ref 6=========== # module: app.Tests.testintegration_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_chi_maxima_true(self): # offset: 1 <s> AFDG TERFADDSFD") result = lc.checkLanguage("das te y we fdsbfsd fe a ") result = lc.checkLanguage("d pa pdpsa ofoiaoew ifdisa ikrkasd s") result = lc.checkLanguage("My friend is a really nice people who really enjoys swimming, dancing, kicking, English.") self.assertEqual(result, True)
app.Tests.testintegration_languagechecker/TestLanguageChecker.test_integration_unusual_four
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<0>:<add> lc = LanguageChecker() <del> lc = LanguageChecker.languageChecker()
# module: app.Tests.testintegration_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): <0> lc = LanguageChecker.languageChecker() <1> result = lc.checkLanguage(".") <2> self.assertEqual(result, False) <3>
===========unchanged ref 0=========== at: unittest.case.TestCase assertEqual(first: Any, second: Any, msg: Any=...) -> None ===========changed ref 0=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("") self.assertEqual(result, False) ===========changed ref 1=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("HELLO MY NAME IS BRANDON AND I LIKE DOLLAR") self.assertEqual(result, True) ===========changed ref 2=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") self.assertEqual(result, False) ===========changed ref 3=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("hallo keine lieben leute nach") self.assertEqual(result, False) ===========changed ref 4=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("Hello my name is new and this is an example of some english text") self.assertEqual(result, True) ===========changed ref 5=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") self.assertEqual(result, True) ===========changed ref 6=========== # module: app.Tests.testintegration_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_chi_maxima_true(self): """ This returns false because s.d is not over 1 as all inputs are English """ + lc = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("sa dew fea dxza dcsa da fsa d") result = lc.checkLanguage("df grtsf a sgrds fgserwqd") result = lc.checkLanguage("fd sa fe safsda srmad sadsa d") result = lc.checkLanguage(" oihn giuhh7hguygiuhuyguyuyg ig iug iugiugiug") result = lc.checkLanguage("oiuhiuhiuhoiuh7 a opokp[poj uyg ytdra4efriug oih kjnbjhb jgv") result = lc.checkLanguage("r jabbi tb y jyg ygiuygytff u0") result = lc.checkLanguage("ld oiu oj uh t t er s d gf hg g h h") result = lc.checkLanguage("posa idijdsa ije i vi ijerijofdj ouhsaf oiuhas oihd ") result = lc.checkLanguage("Likwew e wqrew rwr safdsa dawe r3d hg jyrt dwqefp ;g;;' [ [sadqa ]].") result = lc.checkLanguage("Her hyt e jytgv urjfdghbsfd c ") result = lc.checkLanguage("CASSAE X T H WAEASD AFDG TERFADDSFD") result = lc.checkLanguage("das te y we fdsbfsd fe a</s> ===========changed ref 7=========== # module: app.Tests.testintegration_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_chi_maxima_true(self): # offset: 1 <s> AFDG TERFADDSFD") result = lc.checkLanguage("das te y we fdsbfsd fe a ") result = lc.checkLanguage("d pa pdpsa ofoiaoew ifdisa ikrkasd s") result = lc.checkLanguage("My friend is a really nice people who really enjoys swimming, dancing, kicking, English.") self.assertEqual(result, True)
app.Tests.testintegration_languagechecker/TestLanguageChecker.test_integration_unusual_five
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<0>:<add> lc = LanguageChecker() <del> lc = LanguageChecker.languageChecker()
# module: app.Tests.testintegration_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): <0> lc = LanguageChecker.languageChecker() <1> result = lc.checkLanguage("#") <2> self.assertEqual(result, False) <3>
===========unchanged ref 0=========== at: unittest.case.TestCase assertEqual(first: Any, second: Any, msg: Any=...) -> None ===========changed ref 0=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage(".") self.assertEqual(result, False) ===========changed ref 1=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("") self.assertEqual(result, False) ===========changed ref 2=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("HELLO MY NAME IS BRANDON AND I LIKE DOLLAR") self.assertEqual(result, True) ===========changed ref 3=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") self.assertEqual(result, False) ===========changed ref 4=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("hallo keine lieben leute nach") self.assertEqual(result, False) ===========changed ref 5=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("Hello my name is new and this is an example of some english text") self.assertEqual(result, True) ===========changed ref 6=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") self.assertEqual(result, True) ===========changed ref 7=========== # module: app.Tests.testintegration_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_chi_maxima_true(self): """ This returns false because s.d is not over 1 as all inputs are English """ + lc = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("sa dew fea dxza dcsa da fsa d") result = lc.checkLanguage("df grtsf a sgrds fgserwqd") result = lc.checkLanguage("fd sa fe safsda srmad sadsa d") result = lc.checkLanguage(" oihn giuhh7hguygiuhuyguyuyg ig iug iugiugiug") result = lc.checkLanguage("oiuhiuhiuhoiuh7 a opokp[poj uyg ytdra4efriug oih kjnbjhb jgv") result = lc.checkLanguage("r jabbi tb y jyg ygiuygytff u0") result = lc.checkLanguage("ld oiu oj uh t t er s d gf hg g h h") result = lc.checkLanguage("posa idijdsa ije i vi ijerijofdj ouhsaf oiuhas oihd ") result = lc.checkLanguage("Likwew e wqrew rwr safdsa dawe r3d hg jyrt dwqefp ;g;;' [ [sadqa ]].") result = lc.checkLanguage("Her hyt e jytgv urjfdghbsfd c ") result = lc.checkLanguage("CASSAE X T H WAEASD AFDG TERFADDSFD") result = lc.checkLanguage("das te y we fdsbfsd fe a</s> ===========changed ref 8=========== # module: app.Tests.testintegration_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_chi_maxima_true(self): # offset: 1 <s> AFDG TERFADDSFD") result = lc.checkLanguage("das te y we fdsbfsd fe a ") result = lc.checkLanguage("d pa pdpsa ofoiaoew ifdisa ikrkasd s") result = lc.checkLanguage("My friend is a really nice people who really enjoys swimming, dancing, kicking, English.") self.assertEqual(result, True)
app.Tests.testintegration_languagechecker/TestLanguageChecker.test_integration_unusual_6
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<0>:<add> lc = LanguageChecker() <del> lc = LanguageChecker.languageChecker()
# module: app.Tests.testintegration_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): <0> lc = LanguageChecker.languageChecker() <1> result = lc.checkLanguage("\"") <2> self.assertEqual(result, False) <3>
===========unchanged ref 0=========== at: unittest.case.TestCase assertEqual(first: Any, second: Any, msg: Any=...) -> None ===========changed ref 0=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("#") self.assertEqual(result, False) ===========changed ref 1=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage(".") self.assertEqual(result, False) ===========changed ref 2=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("") self.assertEqual(result, False) ===========changed ref 3=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("HELLO MY NAME IS BRANDON AND I LIKE DOLLAR") self.assertEqual(result, True) ===========changed ref 4=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") self.assertEqual(result, False) ===========changed ref 5=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("hallo keine lieben leute nach") self.assertEqual(result, False) ===========changed ref 6=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("Hello my name is new and this is an example of some english text") self.assertEqual(result, True) ===========changed ref 7=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") self.assertEqual(result, True) ===========changed ref 8=========== # module: app.Tests.testintegration_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_chi_maxima_true(self): """ This returns false because s.d is not over 1 as all inputs are English """ + lc = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("sa dew fea dxza dcsa da fsa d") result = lc.checkLanguage("df grtsf a sgrds fgserwqd") result = lc.checkLanguage("fd sa fe safsda srmad sadsa d") result = lc.checkLanguage(" oihn giuhh7hguygiuhuyguyuyg ig iug iugiugiug") result = lc.checkLanguage("oiuhiuhiuhoiuh7 a opokp[poj uyg ytdra4efriug oih kjnbjhb jgv") result = lc.checkLanguage("r jabbi tb y jyg ygiuygytff u0") result = lc.checkLanguage("ld oiu oj uh t t er s d gf hg g h h") result = lc.checkLanguage("posa idijdsa ije i vi ijerijofdj ouhsaf oiuhas oihd ") result = lc.checkLanguage("Likwew e wqrew rwr safdsa dawe r3d hg jyrt dwqefp ;g;;' [ [sadqa ]].") result = lc.checkLanguage("Her hyt e jytgv urjfdghbsfd c ") result = lc.checkLanguage("CASSAE X T H WAEASD AFDG TERFADDSFD") result = lc.checkLanguage("das te y we fdsbfsd fe a</s> ===========changed ref 9=========== # module: app.Tests.testintegration_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_chi_maxima_true(self): # offset: 1 <s> AFDG TERFADDSFD") result = lc.checkLanguage("das te y we fdsbfsd fe a ") result = lc.checkLanguage("d pa pdpsa ofoiaoew ifdisa ikrkasd s") result = lc.checkLanguage("My friend is a really nice people who really enjoys swimming, dancing, kicking, English.") self.assertEqual(result, True)
app.Tests.testintegration_languagechecker/TestLanguageChecker.test_integration_unusual_7
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<0>:<add> lc = LanguageChecker() <del> lc = LanguageChecker.languageChecker()
# module: app.Tests.testintegration_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): <0> lc = LanguageChecker.languageChecker() <1> result = lc.checkLanguage("") <2> self.assertEqual(result, False) <3>
===========unchanged ref 0=========== at: unittest.case.TestCase assertEqual(first: Any, second: Any, msg: Any=...) -> None ===========changed ref 0=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("\"") self.assertEqual(result, False) ===========changed ref 1=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("#") self.assertEqual(result, False) ===========changed ref 2=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage(".") self.assertEqual(result, False) ===========changed ref 3=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("") self.assertEqual(result, False) ===========changed ref 4=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("HELLO MY NAME IS BRANDON AND I LIKE DOLLAR") self.assertEqual(result, True) ===========changed ref 5=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") self.assertEqual(result, False) ===========changed ref 6=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("hallo keine lieben leute nach") self.assertEqual(result, False) ===========changed ref 7=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("Hello my name is new and this is an example of some english text") self.assertEqual(result, True) ===========changed ref 8=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") self.assertEqual(result, True) ===========changed ref 9=========== # module: app.Tests.testintegration_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_chi_maxima_true(self): """ This returns false because s.d is not over 1 as all inputs are English """ + lc = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("sa dew fea dxza dcsa da fsa d") result = lc.checkLanguage("df grtsf a sgrds fgserwqd") result = lc.checkLanguage("fd sa fe safsda srmad sadsa d") result = lc.checkLanguage(" oihn giuhh7hguygiuhuyguyuyg ig iug iugiugiug") result = lc.checkLanguage("oiuhiuhiuhoiuh7 a opokp[poj uyg ytdra4efriug oih kjnbjhb jgv") result = lc.checkLanguage("r jabbi tb y jyg ygiuygytff u0") result = lc.checkLanguage("ld oiu oj uh t t er s d gf hg g h h") result = lc.checkLanguage("posa idijdsa ije i vi ijerijofdj ouhsaf oiuhas oihd ") result = lc.checkLanguage("Likwew e wqrew rwr safdsa dawe r3d hg jyrt dwqefp ;g;;' [ [sadqa ]].") result = lc.checkLanguage("Her hyt e jytgv urjfdghbsfd c ") result = lc.checkLanguage("CASSAE X T H WAEASD AFDG TERFADDSFD") result = lc.checkLanguage("das te y we fdsbfsd fe a</s>
app.Tests.testintegration_languagechecker/TestLanguageChecker.test_integration_addition
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<3>:<add> lc = LanguageChecker() <del> lc = LanguageChecker.languageChecker() <6>:<add> lc2 = LanguageChecker() <del> lc2 = LanguageChecker.languageChecker()
# module: app.Tests.testintegration_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 = LanguageChecker.languageChecker() <4> result = lc.checkLanguage("hello my darling") <5> <6> lc2 = LanguageChecker.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: 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.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("\"") self.assertEqual(result, False) ===========changed ref 1=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("#") self.assertEqual(result, False) ===========changed ref 2=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage(".") self.assertEqual(result, False) ===========changed ref 3=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("") self.assertEqual(result, False) ===========changed ref 4=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("") self.assertEqual(result, False) ===========changed ref 5=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("HELLO MY NAME IS BRANDON AND I LIKE DOLLAR") self.assertEqual(result, True) ===========changed ref 6=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") self.assertEqual(result, False) ===========changed ref 7=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("hallo keine lieben leute nach") self.assertEqual(result, False) ===========changed ref 8=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("Hello my name is new and this is an example of some english text") self.assertEqual(result, True) ===========changed ref 9=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("The quick brown fox jumped over the lazy dog") self.assertEqual(result, True)
app.Tests.testneural_network/TestNN.test_english_yes
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<1>:<add> model = NeuralNetwork() <del> model = nn.neuralNetwork()
# module: app.Tests.testneural_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): <0> """Checks to see if it returns True (it should)""" <1> model = nn.neuralNetwork() <2> result = model.predictnn("bcpvu up qvu ifs cpplt bxbz, cvu jotufbe tif qvmmfe") <3> numpy.set_printoptions(suppress=True) <4> result = numpy.argmax(result) <5> self.assertEqual(result, 4) <6>
===========unchanged ref 0=========== at: neuralNetworkMod.nn NeuralNetwork() at: 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 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.testcaesarcipher_basic + + ===========changed ref 1=========== + # module: app.Tests.testcaesarcipher_basic + sys.path.append("..") + ===========changed ref 2=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("") self.assertEqual(result, False) ===========changed ref 3=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("\"") self.assertEqual(result, False) ===========changed ref 4=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("#") self.assertEqual(result, False) ===========changed ref 5=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage(".") self.assertEqual(result, False) ===========changed ref 6=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("hallo keine lieben leute nach") self.assertEqual(result, False) ===========changed ref 7=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("HELLO MY NAME IS BRANDON AND I LIKE DOLLAR") self.assertEqual(result, True) ===========changed ref 8=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("Hello my name is new and this is an example of some english text") self.assertEqual(result, True) ===========changed ref 9=========== # module: app.languageCheckerMod.dictionaryChecker class dictionaryChecker: def __init__(self): self.mh = mathsHelper.mathsHelper() self.languagePercentage = 0.0 self.languageWordsCounter = 0.0 + self.languageThreshold = 35 - self.languageThreshold = 25 ===========changed ref 10=========== + # module: app.Tests.testcaesarcipher_basic + # 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 test_caesar_plaintext_yes(self): + """Checks to see if it returns True (it should)""" + lc = LanguageChecker() + c = Caesar(lc) + result = c.decrypt("What about plaintext?") + self.assertEqual(result, True) + ===========changed ref 11=========== + # module: app.Tests.testcaesarcipher_basic + # 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 test_caesar_no(self): + """Checks to see if it returns True (it should)""" + lc = LanguageChecker() + c = Caesar(lc) + result = c.decrypt("o iozad iikwas") + self.assertEqual(result, False) + ===========changed ref 12=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") self.assertEqual(result, False)
app.Tests.testneural_network/TestNN.test_sha1_yes
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<0>:<add> model = NeuralNetwork() <del> model = nn.neuralNetwork()
# module: app.Tests.testneural_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): <0> model = nn.neuralNetwork() <1> result = model.predictnn("6D32263A85C7846D70439026B75758C9FC31A9B7") <2> numpy.set_printoptions(suppress=True) <3> result = numpy.argmax(result) <4> self.assertEqual(result, 0) <5>
===========unchanged ref 0=========== at: neuralNetworkMod.nn NeuralNetwork() at: 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.testneural_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 = NeuralNetwork() - model = nn.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 1=========== + # module: app.Tests.testcaesarcipher_basic + + ===========changed ref 2=========== + # module: app.Tests.testcaesarcipher_basic + sys.path.append("..") + ===========changed ref 3=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("") self.assertEqual(result, False) ===========changed ref 4=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("\"") self.assertEqual(result, False) ===========changed ref 5=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("#") self.assertEqual(result, False) ===========changed ref 6=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage(".") self.assertEqual(result, False) ===========changed ref 7=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("hallo keine lieben leute nach") self.assertEqual(result, False) ===========changed ref 8=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("HELLO MY NAME IS BRANDON AND I LIKE DOLLAR") self.assertEqual(result, True) ===========changed ref 9=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("Hello my name is new and this is an example of some english text") self.assertEqual(result, True) ===========changed ref 10=========== # module: app.languageCheckerMod.dictionaryChecker class dictionaryChecker: def __init__(self): self.mh = mathsHelper.mathsHelper() self.languagePercentage = 0.0 self.languageWordsCounter = 0.0 + self.languageThreshold = 35 - self.languageThreshold = 25 ===========changed ref 11=========== + # module: app.Tests.testcaesarcipher_basic + # 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 test_caesar_plaintext_yes(self): + """Checks to see if it returns True (it should)""" + lc = LanguageChecker() + c = Caesar(lc) + result = c.decrypt("What about plaintext?") + self.assertEqual(result, True) + ===========changed ref 12=========== + # module: app.Tests.testcaesarcipher_basic + # 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 test_caesar_no(self): + """Checks to see if it returns True (it should)""" + lc = LanguageChecker() + c = Caesar(lc) + result = c.decrypt("o iozad iikwas") + self.assertEqual(result, False) +
app.Tests.testneural_network/TestNN.test_md5_yes
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<0>:<add> model = NeuralNetwork() <del> model = nn.neuralNetwork()
# module: app.Tests.testneural_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): <0> model = nn.neuralNetwork() <1> result = model.predictnn("5d41402abc4b2a76b9719d911017c592") <2> numpy.set_printoptions(suppress=True) <3> result = numpy.argmax(result) <4> self.assertEqual(result, 1) <5>
===========unchanged ref 0=========== at: neuralNetworkMod.nn NeuralNetwork() at: 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.testneural_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 = NeuralNetwork() - model = nn.neuralNetwork() result = model.predictnn("6D32263A85C7846D70439026B75758C9FC31A9B7") numpy.set_printoptions(suppress=True) result = numpy.argmax(result) self.assertEqual(result, 0) ===========changed ref 1=========== # module: app.Tests.testneural_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 = NeuralNetwork() - model = nn.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 2=========== + # module: app.Tests.testcaesarcipher_basic + + ===========changed ref 3=========== + # module: app.Tests.testcaesarcipher_basic + sys.path.append("..") + ===========changed ref 4=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("") self.assertEqual(result, False) ===========changed ref 5=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("\"") self.assertEqual(result, False) ===========changed ref 6=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("#") self.assertEqual(result, False) ===========changed ref 7=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage(".") self.assertEqual(result, False) ===========changed ref 8=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("hallo keine lieben leute nach") self.assertEqual(result, False) ===========changed ref 9=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("HELLO MY NAME IS BRANDON AND I LIKE DOLLAR") self.assertEqual(result, True) ===========changed ref 10=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("Hello my name is new and this is an example of some english text") self.assertEqual(result, True) ===========changed ref 11=========== # module: app.languageCheckerMod.dictionaryChecker class dictionaryChecker: def __init__(self): self.mh = mathsHelper.mathsHelper() self.languagePercentage = 0.0 self.languageWordsCounter = 0.0 + self.languageThreshold = 35 - self.languageThreshold = 25
app.Tests.testneural_network/TestNN.test_sha512_yes
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<0>:<add> model = NeuralNetwork() <del> model = nn.neuralNetwork()
# module: app.Tests.testneural_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 = nn.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: neuralNetworkMod.nn NeuralNetwork() at: 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.testneural_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 = NeuralNetwork() - model = nn.neuralNetwork() result = model.predictnn("5d41402abc4b2a76b9719d911017c592") numpy.set_printoptions(suppress=True) result = numpy.argmax(result) self.assertEqual(result, 1) ===========changed ref 1=========== # module: app.Tests.testneural_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 = NeuralNetwork() - model = nn.neuralNetwork() result = model.predictnn("6D32263A85C7846D70439026B75758C9FC31A9B7") numpy.set_printoptions(suppress=True) result = numpy.argmax(result) self.assertEqual(result, 0) ===========changed ref 2=========== # module: app.Tests.testneural_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 = NeuralNetwork() - model = nn.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.testcaesarcipher_basic + + ===========changed ref 4=========== + # module: app.Tests.testcaesarcipher_basic + sys.path.append("..") + ===========changed ref 5=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("") self.assertEqual(result, False) ===========changed ref 6=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("\"") self.assertEqual(result, False) ===========changed ref 7=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("#") self.assertEqual(result, False) ===========changed ref 8=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage(".") self.assertEqual(result, False) ===========changed ref 9=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("hallo keine lieben leute nach") self.assertEqual(result, False) ===========changed ref 10=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("HELLO MY NAME IS BRANDON AND I LIKE DOLLAR") self.assertEqual(result, True) ===========changed ref 11=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("Hello my name is new and this is an example of some english text") self.assertEqual(result, True)
app.Tests.testneural_network/TestNN.test_caesar_yes
Modified
Ciphey~Ciphey
71faf038330bcba5c6092c2b88cc18e85f8606a0
final day
<0>:<add> model = NeuralNetwork() <del> model = nn.neuralNetwork()
# module: app.Tests.testneural_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 = nn.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: neuralNetworkMod.nn NeuralNetwork() at: 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.testneural_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 = NeuralNetwork() - model = nn.neuralNetwork() result = model.predictnn("5d41402abc4b2a76b9719d911017c592") numpy.set_printoptions(suppress=True) result = numpy.argmax(result) self.assertEqual(result, 1) ===========changed ref 1=========== # module: app.Tests.testneural_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 = NeuralNetwork() - model = nn.neuralNetwork() result = model.predictnn("6D32263A85C7846D70439026B75758C9FC31A9B7") numpy.set_printoptions(suppress=True) result = numpy.argmax(result) self.assertEqual(result, 0) ===========changed ref 2=========== # module: app.Tests.testneural_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 = NeuralNetwork() - model = nn.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.testneural_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 = NeuralNetwork() - model = nn.neuralNetwork() result = model.predictnn("9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043") numpy.set_printoptions(suppress=True) result = numpy.argmax(result) self.assertEqual(result, 3) ===========changed ref 4=========== + # module: app.Tests.testcaesarcipher_basic + + ===========changed ref 5=========== + # module: app.Tests.testcaesarcipher_basic + sys.path.append("..") + ===========changed ref 6=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("") self.assertEqual(result, False) ===========changed ref 7=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("\"") self.assertEqual(result, False) ===========changed ref 8=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("#") self.assertEqual(result, False) ===========changed ref 9=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage(".") self.assertEqual(result, False) ===========changed ref 10=========== # module: app.Tests.testintegration_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 = LanguageChecker() - lc = LanguageChecker.languageChecker() result = lc.checkLanguage("hallo keine lieben leute nach") self.assertEqual(result, False)
app.Decryptor.Hash.hashBuster/crack
Modified
Ciphey~Ciphey
b5df79a4cb8938bdd5c321e2463e5c2375264637
lol
<2>:<del> if not file: <3>:<del> print ('%s Hash function : MD5' % info) <7>:<add> return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "md5", "Extra Information": None} <del> return r <9>:<del> if not file: <10>:<del> print ('%s Hash function : SHA1' % info) <14>:<add> return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha1", "Extra Information": None} <del> return r <16>:<del> if not file: <17>:<del> print ('%s Hash function : SHA-256' % info) <21>:<add> return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha256", "Extra Information": None} <del> return r <23>:<del> if not file: <24>:<del> print ('%s Hash function : SHA-384' % info) <28>:<add> return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha384", "Extra Information": None} <del> return r <30>:<del> if not file: <31>:<del> print ('%s Hash function : SHA-512' % info) <35>:<add> return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha512", "Extra Information": None} <del> return r <38>:<del> print ('%s This hash type is not supported.' % bad) <39>:<del> quit() <40>:<add> return {"lc": None, "IsPlaintext?
# module: app.Decryptor.Hash.hashBuster def crack(hashvalue): <0> result = False <1> if len(hashvalue) == 32: <2> if not file: <3> print ('%s Hash function : MD5' % info) <4> for api in md5: <5> r = api(hashvalue, 'md5') <6> if r: <7> return r <8> elif len(hashvalue) == 40: <9> if not file: <10> print ('%s Hash function : SHA1' % info) <11> for api in sha1: <12> r = api(hashvalue, 'sha1') <13> if r: <14> return r <15> elif len(hashvalue) == 64: <16> if not file: <17> print ('%s Hash function : SHA-256' % info) <18> for api in sha256: <19> r = api(hashvalue, 'sha256') <20> if r: <21> return r <22> elif len(hashvalue) == 96: <23> if not file: <24> print ('%s Hash function : SHA-384' % info) <25> for api in sha384: <26> r = api(hashvalue, 'sha384') <27> if r: <28> return r <29> elif len(hashvalue) == 128: <30> if not file: <31> print ('%s Hash function : SHA-512' % info) <32> for api in sha512: <33> r = api(hashvalue, 'sha512') <34> if r: <35> return r <36> else: <37> if not file: <38> print ('%s This hash type is not supported.' % bad) <39> quit() <40> else: <41> return False <42>
===========unchanged ref 0=========== at: app.Decryptor.Hash.hashBuster file = args.file alpha(hashvalue, hashtype) beta(hashvalue, hashtype) gamma(hashvalue, hashtype) delta(hashvalue, hashtype) theta(hashvalue, hashtype) at: app.Decryptor.Hash.hashBuster.theta response = requests.get('https://md5decrypt.net/Api/api.php?hash=%s&hash_type=%s&[email protected]&code=1152464b80a61728' % (hashvalue, hashtype)).text ===========changed ref 0=========== # module: app.Decryptor.Hash.hashBuster - - print ('''\033[1;97m_ _ ____ ____ _ _ ___ _ _ ____ ___ ____ ____ - |__| |__| [__ |__| |__] | | [__ | |___ |__/ - | | | | ___] | | |__] |__| ___] | |___ | \ %sv3.0\033[0m\n''' % red) md5 = [gamma, alpha, beta, theta, delta] sha1 = [alpha, beta, theta, delta] sha256 = [alpha, beta, theta] sha384 = [alpha, beta, theta] sha512 = [alpha, beta, theta] ===========changed ref 1=========== # module: app.Decryptor.Hash.hashBuster + """ + β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— + β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β• + β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• + β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β• β•šβ–ˆβ–ˆβ•”β• + β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—οΏ½</s> ===========changed ref 2=========== # module: app.Decryptor.Hash.hashBuster # offset: 1 <s> + β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘ + Β© Brandon Skerritt + Github: brandonskerritt + + This is Hashbuster but slightly modified to work with Ciphey + why reivent the wheel? + + https://github.com/s0md3v/Hash-Buster + """ + parser = argparse.ArgumentParser() parser.add_argument('-s', help='hash', dest='hash') parser.add_argument('-f', help='file containing hashes', dest='file') parser.add_argument('-d', help='directory containing hashes', dest='dir') parser.add_argument('-t', help='number of threads', dest='threads', type=int) args = parser.parse_args() #Colors and shit like that end = '\033[0m' red = '\033[91m' green = '\033[92m' white = '\033[97m' dgreen = '\033[32m' yellow = '\033[93m' back = '\033[7;91m' run = '\033[97m[~]\033[0m' que = '\033[94m[?]\033[0m' bad = '\033[91m[-]\033[0m' info = '\033[93m[!]\033[0m' good = '\033[92m[+]\033[0m' </s> ===========changed ref 3=========== # module: app.Decryptor.Hash.hashBuster # offset: 2 <s> cwd = os.getcwd() directory = args.dir file = args.file thread_count = args.threads or 4 if directory: if directory[-1] == '/': directory = directory[:-1]
app.Decryptor.basicEncryption.basic_parent/BasicParent.__init__
Modified
Ciphey~Ciphey
b5df79a4cb8938bdd5c321e2463e5c2375264637
lol
<2>:<add> self.reverse = Reverse(self.lc) <add> <add> self.list_of_objects = [self.caesar, self.reverse] <del> self.list_of_objects = [self.caesar]
# module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def __init__(self, lc): <0> self.lc = lc <1> self.caesar = Caesar(self.lc) <2> self.list_of_objects = [self.caesar] <3>
===========unchanged ref 0=========== at: Decryptor.basicEncryption.caesar Caesar(lc) at: app.Decryptor.basicEncryption.basic_parent BasicParent(lc) at: app.Decryptor.basicEncryption.basic_parent.BasicParent.decrypt self.lc = self.lc + answer["lc"] ===========changed ref 0=========== # module: app.Decryptor.Hash.hashBuster - - print ('''\033[1;97m_ _ ____ ____ _ _ ___ _ _ ____ ___ ____ ____ - |__| |__| [__ |__| |__] | | [__ | |___ |__/ - | | | | ___] | | |__] |__| ___] | |___ | \ %sv3.0\033[0m\n''' % red) md5 = [gamma, alpha, beta, theta, delta] sha1 = [alpha, beta, theta, delta] sha256 = [alpha, beta, theta] sha384 = [alpha, beta, theta] sha512 = [alpha, beta, theta] ===========changed ref 1=========== # module: app.Decryptor.Hash.hashBuster def crack(hashvalue): result = False if len(hashvalue) == 32: - if not file: - print ('%s Hash function : MD5' % info) for api in md5: r = api(hashvalue, 'md5') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "md5", "Extra Information": None} - return r elif len(hashvalue) == 40: - if not file: - print ('%s Hash function : SHA1' % info) for api in sha1: r = api(hashvalue, 'sha1') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha1", "Extra Information": None} - return r elif len(hashvalue) == 64: - if not file: - print ('%s Hash function : SHA-256' % info) for api in sha256: r = api(hashvalue, 'sha256') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha256", "Extra Information": None} - return r elif len(hashvalue) == 96: - if not file: - print ('%s Hash function : SHA-384' % info) for api in sha384: r = api(hashvalue, 'sha384') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha384", "Extra Information": None} - return r elif len(hashvalue) == 128: - if not file: - print ('%s Hash function : SHA-512' % info) for api in sha</s> ===========changed ref 2=========== # module: app.Decryptor.Hash.hashBuster def crack(hashvalue): # offset: 1 <s> if not file: - print ('%s Hash function : SHA-512' % info) for api in sha512: r = api(hashvalue, 'sha512') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha512", "Extra Information": None} - return r else: if not file: - print ('%s This hash type is not supported.' % bad) - quit() + return {"lc": None, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": "The hash wasn't found. Please try Hashkiller.co.uk first, then use Hashcat to manually crack the hash."} else: + return {"lc": None, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": "The hash wasn't found. Please try Hashkiller.co.uk first, then use Hashcat to manually crack the hash."} - return False ===========changed ref 3=========== # module: app.Decryptor.Hash.hashBuster + """ + β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— + β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β• + β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• + β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β• β•šβ–ˆβ–ˆβ•”β• + β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—οΏ½</s>
app.Decryptor.basicEncryption.basic_parent/BasicParent.decrypt
Modified
Ciphey~Ciphey
b5df79a4cb8938bdd5c321e2463e5c2375264637
lol
<0>:<add> answers = [] <1>:<add> result = item.decrypt(text) <del> item.decrypt(text) <2>:<add> answers.append(result) <add> for answer in answers: <add> # adds the LC objects together <add> self.lc = self.lc + answer["lc"] <add> if answer["IsPlaintext?"]: <add> return "YESSS QUEEn" <del> result = self.caesar.bruteforce()
# module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def decrypt(self, text): <0> for item in self.list_of_objects: <1> item.decrypt(text) <2> result = self.caesar.bruteforce() <3>
===========unchanged ref 0=========== at: Decryptor.basicEncryption.reverse Reverse(lc) at: app.Decryptor.basicEncryption.basic_parent.BasicParent.__init__ self.lc = lc self.caesar = Caesar(self.lc) at: app.Decryptor.basicEncryption.basic_parent.BasicParent.decrypt self.lc = self.lc + answer["lc"] ===========changed ref 0=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def __init__(self, lc): self.lc = lc self.caesar = Caesar(self.lc) + self.reverse = Reverse(self.lc) + + self.list_of_objects = [self.caesar, self.reverse] - self.list_of_objects = [self.caesar] ===========changed ref 1=========== # module: app.Decryptor.Hash.hashBuster - - print ('''\033[1;97m_ _ ____ ____ _ _ ___ _ _ ____ ___ ____ ____ - |__| |__| [__ |__| |__] | | [__ | |___ |__/ - | | | | ___] | | |__] |__| ___] | |___ | \ %sv3.0\033[0m\n''' % red) md5 = [gamma, alpha, beta, theta, delta] sha1 = [alpha, beta, theta, delta] sha256 = [alpha, beta, theta] sha384 = [alpha, beta, theta] sha512 = [alpha, beta, theta] ===========changed ref 2=========== # module: app.Decryptor.Hash.hashBuster def crack(hashvalue): result = False if len(hashvalue) == 32: - if not file: - print ('%s Hash function : MD5' % info) for api in md5: r = api(hashvalue, 'md5') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "md5", "Extra Information": None} - return r elif len(hashvalue) == 40: - if not file: - print ('%s Hash function : SHA1' % info) for api in sha1: r = api(hashvalue, 'sha1') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha1", "Extra Information": None} - return r elif len(hashvalue) == 64: - if not file: - print ('%s Hash function : SHA-256' % info) for api in sha256: r = api(hashvalue, 'sha256') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha256", "Extra Information": None} - return r elif len(hashvalue) == 96: - if not file: - print ('%s Hash function : SHA-384' % info) for api in sha384: r = api(hashvalue, 'sha384') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha384", "Extra Information": None} - return r elif len(hashvalue) == 128: - if not file: - print ('%s Hash function : SHA-512' % info) for api in sha</s> ===========changed ref 3=========== # module: app.Decryptor.Hash.hashBuster def crack(hashvalue): # offset: 1 <s> if not file: - print ('%s Hash function : SHA-512' % info) for api in sha512: r = api(hashvalue, 'sha512') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha512", "Extra Information": None} - return r else: if not file: - print ('%s This hash type is not supported.' % bad) - quit() + return {"lc": None, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": "The hash wasn't found. Please try Hashkiller.co.uk first, then use Hashcat to manually crack the hash."} else: + return {"lc": None, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": "The hash wasn't found. Please try Hashkiller.co.uk first, then use Hashcat to manually crack the hash."} - return False ===========changed ref 4=========== # module: app.Decryptor.Hash.hashBuster + """ + β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— + β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β• + β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• + β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β• β•šβ–ˆβ–ˆβ•”β• + β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—οΏ½</s>
app.Decryptor.basicEncryption.basic_parent/BasicParent.setProbTable
Modified
Ciphey~Ciphey
b5df79a4cb8938bdd5c321e2463e5c2375264637
lol
<9>:<del> pprint.pprint(self.list_of_objects)
# module: app.Decryptor.basicEncryption.basic_parent class BasicParent: + def setProbTable(self, prob): <0> self.probabilityDistribution = prob <1> # we get a sorted list of objects :) <2> counter = 0 <3> for key, val in self.probabilityDistribution.items(): <4> for listCounter, item in enumerate(self.list_of_objects): <5> if item.getName() == key: <6> # moves the item <7> list_objs.insert(counter, list_objs.pop(listCounter)) <8> counter = counter + 1 <9> pprint.pprint(self.list_of_objects) <10>
===========unchanged ref 0=========== at: Decryptor.basicEncryption.caesar.Caesar decrypt(message) at: Decryptor.basicEncryption.reverse.Reverse decrypt(message) at: app.Decryptor.basicEncryption.basic_parent.BasicParent.__init__ self.list_of_objects = [self.caesar, self.reverse] ===========changed ref 0=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def __init__(self, lc): self.lc = lc self.caesar = Caesar(self.lc) + self.reverse = Reverse(self.lc) + + self.list_of_objects = [self.caesar, self.reverse] - self.list_of_objects = [self.caesar] ===========changed ref 1=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def decrypt(self, text): + answers = [] for item in self.list_of_objects: + result = item.decrypt(text) - item.decrypt(text) + answers.append(result) + for answer in answers: + # adds the LC objects together + self.lc = self.lc + answer["lc"] + if answer["IsPlaintext?"]: + return "YESSS QUEEn" - result = self.caesar.bruteforce() ===========changed ref 2=========== # module: app.Decryptor.Hash.hashBuster - - print ('''\033[1;97m_ _ ____ ____ _ _ ___ _ _ ____ ___ ____ ____ - |__| |__| [__ |__| |__] | | [__ | |___ |__/ - | | | | ___] | | |__] |__| ___] | |___ | \ %sv3.0\033[0m\n''' % red) md5 = [gamma, alpha, beta, theta, delta] sha1 = [alpha, beta, theta, delta] sha256 = [alpha, beta, theta] sha384 = [alpha, beta, theta] sha512 = [alpha, beta, theta] ===========changed ref 3=========== # module: app.Decryptor.Hash.hashBuster def crack(hashvalue): result = False if len(hashvalue) == 32: - if not file: - print ('%s Hash function : MD5' % info) for api in md5: r = api(hashvalue, 'md5') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "md5", "Extra Information": None} - return r elif len(hashvalue) == 40: - if not file: - print ('%s Hash function : SHA1' % info) for api in sha1: r = api(hashvalue, 'sha1') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha1", "Extra Information": None} - return r elif len(hashvalue) == 64: - if not file: - print ('%s Hash function : SHA-256' % info) for api in sha256: r = api(hashvalue, 'sha256') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha256", "Extra Information": None} - return r elif len(hashvalue) == 96: - if not file: - print ('%s Hash function : SHA-384' % info) for api in sha384: r = api(hashvalue, 'sha384') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha384", "Extra Information": None} - return r elif len(hashvalue) == 128: - if not file: - print ('%s Hash function : SHA-512' % info) for api in sha</s> ===========changed ref 4=========== # module: app.Decryptor.Hash.hashBuster def crack(hashvalue): # offset: 1 <s> if not file: - print ('%s Hash function : SHA-512' % info) for api in sha512: r = api(hashvalue, 'sha512') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha512", "Extra Information": None} - return r else: if not file: - print ('%s This hash type is not supported.' % bad) - quit() + return {"lc": None, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": "The hash wasn't found. Please try Hashkiller.co.uk first, then use Hashcat to manually crack the hash."} else: + return {"lc": None, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": "The hash wasn't found. Please try Hashkiller.co.uk first, then use Hashcat to manually crack the hash."} - return False ===========changed ref 5=========== # module: app.Decryptor.Hash.hashBuster + """ + β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•— β–ˆβ–ˆβ•— + β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β• + β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• + β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β• β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β• β•šβ–ˆβ–ˆβ•”β• + β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—οΏ½</s>
app.Tests.testintegration_languagechecker/TestLanguageChecker.test_basics_german
Modified
Ciphey~Ciphey
b5df79a4cb8938bdd5c321e2463e5c2375264637
lol
<2>:<add> self.assertEqual(result, True) <del> self.assertEqual(result, False)
# module: app.Tests.testintegration_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 = LanguageChecker() <1> result = lc.checkLanguage("hallo keine lieben leute nach") <2> self.assertEqual(result, False) <3>
===========unchanged ref 0=========== at: languageCheckerMod.LanguageChecker LanguageChecker() at: 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 ===========changed ref 0=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def __init__(self, lc): self.lc = lc self.caesar = Caesar(self.lc) + self.reverse = Reverse(self.lc) + + self.list_of_objects = [self.caesar, self.reverse] - self.list_of_objects = [self.caesar] ===========changed ref 1=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def decrypt(self, text): + answers = [] for item in self.list_of_objects: + result = item.decrypt(text) - item.decrypt(text) + answers.append(result) + for answer in answers: + # adds the LC objects together + self.lc = self.lc + answer["lc"] + if answer["IsPlaintext?"]: + return "YESSS QUEEn" - result = self.caesar.bruteforce() ===========changed ref 2=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: + def setProbTable(self, prob): self.probabilityDistribution = prob # we get a sorted list of objects :) counter = 0 for key, val in self.probabilityDistribution.items(): for listCounter, item in enumerate(self.list_of_objects): if item.getName() == key: # moves the item list_objs.insert(counter, list_objs.pop(listCounter)) counter = counter + 1 - pprint.pprint(self.list_of_objects) ===========changed ref 3=========== # module: app.Decryptor.Hash.hashBuster - - print ('''\033[1;97m_ _ ____ ____ _ _ ___ _ _ ____ ___ ____ ____ - |__| |__| [__ |__| |__] | | [__ | |___ |__/ - | | | | ___] | | |__] |__| ___] | |___ | \ %sv3.0\033[0m\n''' % red) md5 = [gamma, alpha, beta, theta, delta] sha1 = [alpha, beta, theta, delta] sha256 = [alpha, beta, theta] sha384 = [alpha, beta, theta] sha512 = [alpha, beta, theta] ===========changed ref 4=========== # module: app.Decryptor.Hash.hashBuster def crack(hashvalue): result = False if len(hashvalue) == 32: - if not file: - print ('%s Hash function : MD5' % info) for api in md5: r = api(hashvalue, 'md5') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "md5", "Extra Information": None} - return r elif len(hashvalue) == 40: - if not file: - print ('%s Hash function : SHA1' % info) for api in sha1: r = api(hashvalue, 'sha1') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha1", "Extra Information": None} - return r elif len(hashvalue) == 64: - if not file: - print ('%s Hash function : SHA-256' % info) for api in sha256: r = api(hashvalue, 'sha256') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha256", "Extra Information": None} - return r elif len(hashvalue) == 96: - if not file: - print ('%s Hash function : SHA-384' % info) for api in sha384: r = api(hashvalue, 'sha384') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha384", "Extra Information": None} - return r elif len(hashvalue) == 128: - if not file: - print ('%s Hash function : SHA-512' % info) for api in sha</s> ===========changed ref 5=========== # module: app.Decryptor.Hash.hashBuster def crack(hashvalue): # offset: 1 <s> if not file: - print ('%s Hash function : SHA-512' % info) for api in sha512: r = api(hashvalue, 'sha512') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha512", "Extra Information": None} - return r else: if not file: - print ('%s This hash type is not supported.' % bad) - quit() + return {"lc": None, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": "The hash wasn't found. Please try Hashkiller.co.uk first, then use Hashcat to manually crack the hash."} else: + return {"lc": None, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": "The hash wasn't found. Please try Hashkiller.co.uk first, then use Hashcat to manually crack the hash."} - return False
app.Decryptor.basicEncryption.caesar/Caesar.decrypt
Modified
Ciphey~Ciphey
b5df79a4cb8938bdd5c321e2463e5c2375264637
lol
<10>:<add> for counter, key in enumerate(range(len(SYMBOLS))): <del> for key in range(len(SYMBOLS)): <32>:<del> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated} <33>:<del> return True <34>:<add> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar", "Extra Information": f"The rotation used is {counter}"} <35>:<add> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Caesar", "Extra Information": None} <del> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None}
# module: app.Decryptor.basicEncryption.caesar + class Caesar(): def decrypt(self, message): <0> ''' Simple python program to bruteforce a caesar cipher''' <1> <2> ''' Simple python program for the caesar cipher''' <3> <4> <5> # Example string <6> message = message.lower() <7> # Everything we can encrypt <8> SYMBOLS = 'abcdefghijklmnopqrstuvwxyz' <9> <10> for key in range(len(SYMBOLS)): <11> # try again with each key attempt <12> translated = "" <13> <14> for character in message: <15> if character in SYMBOLS: <16> symbolIndex = SYMBOLS.find(character) <17> translatedIndex = symbolIndex - key <18> <19> # In the event of wraparound <20> if translatedIndex < 0: <21> translatedIndex += len(SYMBOLS) <22> <23> translated += SYMBOLS[translatedIndex] <24> <25> else: <26> # Append the symbol without encrypting or decrypting <27> translated += character <28> <29> # Output each attempt <30> result = self.lc.checkLanguage(translated) <31> if result: <32> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated} <33> return True <34> # if none of them match English, return false! <35> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None} <36>
===========changed ref 0=========== + # module: app.Decryptor.basicEncryption.reverse + + ===========changed ref 1=========== + # module: app.Decryptor.basicEncryption.reverse + class Reverse: + def __init__(self, lc): + self.lc = lc + ===========changed ref 2=========== # module: app.Tests.testintegration_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 = LanguageChecker() result = lc.checkLanguage("hallo keine lieben leute nach") + self.assertEqual(result, True) - self.assertEqual(result, False) ===========changed ref 3=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def __init__(self, lc): self.lc = lc self.caesar = Caesar(self.lc) + self.reverse = Reverse(self.lc) + + self.list_of_objects = [self.caesar, self.reverse] - self.list_of_objects = [self.caesar] ===========changed ref 4=========== + # module: app.Decryptor.basicEncryption.reverse + class Reverse: + def decrypt(self, message): + message = message[::-1] + result = self.lc.checkLanguage(message) + if result: + 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} + ===========changed ref 5=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def decrypt(self, text): + answers = [] for item in self.list_of_objects: + result = item.decrypt(text) - item.decrypt(text) + answers.append(result) + for answer in answers: + # adds the LC objects together + self.lc = self.lc + answer["lc"] + if answer["IsPlaintext?"]: + return "YESSS QUEEn" - result = self.caesar.bruteforce() ===========changed ref 6=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: + def setProbTable(self, prob): self.probabilityDistribution = prob # we get a sorted list of objects :) counter = 0 for key, val in self.probabilityDistribution.items(): for listCounter, item in enumerate(self.list_of_objects): if item.getName() == key: # moves the item list_objs.insert(counter, list_objs.pop(listCounter)) counter = counter + 1 - pprint.pprint(self.list_of_objects) ===========changed ref 7=========== # module: app.Decryptor.Hash.hashBuster - - print ('''\033[1;97m_ _ ____ ____ _ _ ___ _ _ ____ ___ ____ ____ - |__| |__| [__ |__| |__] | | [__ | |___ |__/ - | | | | ___] | | |__] |__| ___] | |___ | \ %sv3.0\033[0m\n''' % red) md5 = [gamma, alpha, beta, theta, delta] sha1 = [alpha, beta, theta, delta] sha256 = [alpha, beta, theta] sha384 = [alpha, beta, theta] sha512 = [alpha, beta, theta] ===========changed ref 8=========== # module: app.Decryptor.Hash.hashBuster def crack(hashvalue): result = False if len(hashvalue) == 32: - if not file: - print ('%s Hash function : MD5' % info) for api in md5: r = api(hashvalue, 'md5') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "md5", "Extra Information": None} - return r elif len(hashvalue) == 40: - if not file: - print ('%s Hash function : SHA1' % info) for api in sha1: r = api(hashvalue, 'sha1') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha1", "Extra Information": None} - return r elif len(hashvalue) == 64: - if not file: - print ('%s Hash function : SHA-256' % info) for api in sha256: r = api(hashvalue, 'sha256') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha256", "Extra Information": None} - return r elif len(hashvalue) == 96: - if not file: - print ('%s Hash function : SHA-384' % info) for api in sha384: r = api(hashvalue, 'sha384') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha384", "Extra Information": None} - return r elif len(hashvalue) == 128: - if not file: - print ('%s Hash function : SHA-512' % info) for api in sha</s> ===========changed ref 9=========== # module: app.Decryptor.Hash.hashBuster def crack(hashvalue): # offset: 1 <s> if not file: - print ('%s Hash function : SHA-512' % info) for api in sha512: r = api(hashvalue, 'sha512') if r: + return {"lc": None, "IsPlaintext?": True, "Plaintext": r, "Cipher": "sha512", "Extra Information": None} - return r else: if not file: - print ('%s This hash type is not supported.' % bad) - quit() + return {"lc": None, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": "The hash wasn't found. Please try Hashkiller.co.uk first, then use Hashcat to manually crack the hash."} else: + return {"lc": None, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": "The hash wasn't found. Please try Hashkiller.co.uk first, then use Hashcat to manually crack the hash."} - return False
app.Tests.testcaesarcipher_basic/TestChi.test_caesar_yes
Modified
Ciphey~Ciphey
b5df79a4cb8938bdd5c321e2463e5c2375264637
lol
<4>:<add> self.assertEqual(result['IsPlaintext?'], True) <del> self.assertEqual(result, True)
# module: app.Tests.testcaesarcipher_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 = LanguageChecker() <2> c = 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, True) <5>
===========unchanged ref 0=========== at: app.Decryptor.basicEncryption.caesar Caesar(lc) at: languageCheckerMod.LanguageChecker LanguageChecker() at: unittest.case TestCase(methodName: str=...) ===========changed ref 0=========== + # module: app.Decryptor.basicEncryption.reverse + + ===========changed ref 1=========== + # module: app.Decryptor.basicEncryption.reverse + class Reverse: + def __init__(self, lc): + self.lc = lc + ===========changed ref 2=========== # module: app.Tests.testintegration_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 = LanguageChecker() result = lc.checkLanguage("hallo keine lieben leute nach") + self.assertEqual(result, True) - self.assertEqual(result, False) ===========changed ref 3=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def __init__(self, lc): self.lc = lc self.caesar = Caesar(self.lc) + self.reverse = Reverse(self.lc) + + self.list_of_objects = [self.caesar, self.reverse] - self.list_of_objects = [self.caesar] ===========changed ref 4=========== + # module: app.Decryptor.basicEncryption.reverse + class Reverse: + def decrypt(self, message): + message = message[::-1] + result = self.lc.checkLanguage(message) + if result: + 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} + ===========changed ref 5=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def decrypt(self, text): + answers = [] for item in self.list_of_objects: + result = item.decrypt(text) - item.decrypt(text) + answers.append(result) + for answer in answers: + # adds the LC objects together + self.lc = self.lc + answer["lc"] + if answer["IsPlaintext?"]: + return "YESSS QUEEn" - result = self.caesar.bruteforce() ===========changed ref 6=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: + def setProbTable(self, prob): self.probabilityDistribution = prob # we get a sorted list of objects :) counter = 0 for key, val in self.probabilityDistribution.items(): for listCounter, item in enumerate(self.list_of_objects): if item.getName() == key: # moves the item list_objs.insert(counter, list_objs.pop(listCounter)) counter = counter + 1 - pprint.pprint(self.list_of_objects) ===========changed ref 7=========== # module: app.Decryptor.Hash.hashBuster - - print ('''\033[1;97m_ _ ____ ____ _ _ ___ _ _ ____ ___ ____ ____ - |__| |__| [__ |__| |__] | | [__ | |___ |__/ - | | | | ___] | | |__] |__| ___] | |___ | \ %sv3.0\033[0m\n''' % red) md5 = [gamma, alpha, beta, theta, delta] sha1 = [alpha, beta, theta, delta] sha256 = [alpha, beta, theta] sha384 = [alpha, beta, theta] sha512 = [alpha, beta, theta] ===========changed ref 8=========== # module: app.Decryptor.basicEncryption.caesar + class Caesar(): def decrypt(self, message): ''' Simple python program to bruteforce a caesar cipher''' ''' Simple python program for the caesar cipher''' # Example string message = message.lower() # Everything we can encrypt SYMBOLS = 'abcdefghijklmnopqrstuvwxyz' + for counter, key in enumerate(range(len(SYMBOLS))): - for key in range(len(SYMBOLS)): # try again with each key attempt translated = "" for character in message: if character in SYMBOLS: symbolIndex = SYMBOLS.find(character) translatedIndex = symbolIndex - key # In the event of wraparound if translatedIndex < 0: translatedIndex += len(SYMBOLS) translated += SYMBOLS[translatedIndex] else: # Append the symbol without encrypting or decrypting translated += character # Output each attempt result = self.lc.checkLanguage(translated) if result: - return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated} - return True + return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar", "Extra Information": f"The rotation used is {counter}"} # if none of them match English, return false! + return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Caesar", "Extra Information": None} - return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None}
app.Tests.testcaesarcipher_basic/TestChi.test_caesar_no
Modified
Ciphey~Ciphey
b5df79a4cb8938bdd5c321e2463e5c2375264637
lol
<4>:<add> self.assertEqual(result['IsPlaintext?'], False) <del> self.assertEqual(result, False)
# module: app.Tests.testcaesarcipher_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 = LanguageChecker() <2> c = Caesar(lc) <3> result = c.decrypt("o iozad iikwas") <4> self.assertEqual(result, False) <5>
===========unchanged ref 0=========== at: app.Decryptor.basicEncryption.caesar Caesar(lc) at: app.Decryptor.basicEncryption.caesar.Caesar decrypt(message) at: app.Tests.testcaesarcipher_basic.TestChi.test_caesar_yes c = Caesar(lc) at: 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.Decryptor.basicEncryption.caesar + class Caesar(): def decrypt(self, message): ''' Simple python program to bruteforce a caesar cipher''' ''' Simple python program for the caesar cipher''' # Example string message = message.lower() # Everything we can encrypt SYMBOLS = 'abcdefghijklmnopqrstuvwxyz' + for counter, key in enumerate(range(len(SYMBOLS))): - for key in range(len(SYMBOLS)): # try again with each key attempt translated = "" for character in message: if character in SYMBOLS: symbolIndex = SYMBOLS.find(character) translatedIndex = symbolIndex - key # In the event of wraparound if translatedIndex < 0: translatedIndex += len(SYMBOLS) translated += SYMBOLS[translatedIndex] else: # Append the symbol without encrypting or decrypting translated += character # Output each attempt result = self.lc.checkLanguage(translated) if result: - return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated} - return True + return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar", "Extra Information": f"The rotation used is {counter}"} # if none of them match English, return false! + return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Caesar", "Extra Information": None} - return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None} ===========changed ref 1=========== # module: app.Tests.testcaesarcipher_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 = LanguageChecker() c = 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) - self.assertEqual(result, True) ===========changed ref 2=========== + # module: app.Decryptor.basicEncryption.reverse + + ===========changed ref 3=========== + # module: app.Decryptor.basicEncryption.reverse + class Reverse: + def __init__(self, lc): + self.lc = lc + ===========changed ref 4=========== # module: app.Tests.testintegration_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 = LanguageChecker() result = lc.checkLanguage("hallo keine lieben leute nach") + self.assertEqual(result, True) - self.assertEqual(result, False) ===========changed ref 5=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def __init__(self, lc): self.lc = lc self.caesar = Caesar(self.lc) + self.reverse = Reverse(self.lc) + + self.list_of_objects = [self.caesar, self.reverse] - self.list_of_objects = [self.caesar] ===========changed ref 6=========== + # module: app.Decryptor.basicEncryption.reverse + class Reverse: + def decrypt(self, message): + message = message[::-1] + result = self.lc.checkLanguage(message) + if result: + 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} + ===========changed ref 7=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def decrypt(self, text): + answers = [] for item in self.list_of_objects: + result = item.decrypt(text) - item.decrypt(text) + answers.append(result) + for answer in answers: + # adds the LC objects together + self.lc = self.lc + answer["lc"] + if answer["IsPlaintext?"]: + return "YESSS QUEEn" - result = self.caesar.bruteforce() ===========changed ref 8=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: + def setProbTable(self, prob): self.probabilityDistribution = prob # we get a sorted list of objects :) counter = 0 for key, val in self.probabilityDistribution.items(): for listCounter, item in enumerate(self.list_of_objects): if item.getName() == key: # moves the item list_objs.insert(counter, list_objs.pop(listCounter)) counter = counter + 1 - pprint.pprint(self.list_of_objects) ===========changed ref 9=========== # module: app.Decryptor.Hash.hashBuster - - print ('''\033[1;97m_ _ ____ ____ _ _ ___ _ _ ____ ___ ____ ____ - |__| |__| [__ |__| |__] | | [__ | |___ |__/ - | | | | ___] | | |__] |__| ___] | |___ | \ %sv3.0\033[0m\n''' % red) md5 = [gamma, alpha, beta, theta, delta] sha1 = [alpha, beta, theta, delta] sha256 = [alpha, beta, theta] sha384 = [alpha, beta, theta] sha512 = [alpha, beta, theta]
app.Tests.testcaesarcipher_basic/TestChi.test_caesar_plaintext_yes
Modified
Ciphey~Ciphey
b5df79a4cb8938bdd5c321e2463e5c2375264637
lol
<0>:<add> """Checks to see if it returns True (it should) <del> """Checks to see if it returns True (it should)""" <1>:<add> Ok so this returns false becaues caesar only does up to 25, not 26 <add> so plaintext returns false!""" <4>:<add> self.assertEqual(result['IsPlaintext?'], False) <del> self.assertEqual(result, True)
<s> app.Tests.testcaesarcipher_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> lc = LanguageChecker() <2> c = Caesar(lc) <3> result = c.decrypt("What about plaintext?") <4> self.assertEqual(result, True) <5>
===========unchanged ref 0=========== at: app.Decryptor.basicEncryption.caesar.Caesar decrypt(message) at: app.Tests.testcaesarcipher_basic.TestChi.test_caesar_no c = Caesar(lc) at: unittest.case.TestCase assertEqual(first: Any, second: Any, msg: Any=...) -> None ===========changed ref 0=========== # module: app.Decryptor.basicEncryption.caesar + class Caesar(): def decrypt(self, message): ''' Simple python program to bruteforce a caesar cipher''' ''' Simple python program for the caesar cipher''' # Example string message = message.lower() # Everything we can encrypt SYMBOLS = 'abcdefghijklmnopqrstuvwxyz' + for counter, key in enumerate(range(len(SYMBOLS))): - for key in range(len(SYMBOLS)): # try again with each key attempt translated = "" for character in message: if character in SYMBOLS: symbolIndex = SYMBOLS.find(character) translatedIndex = symbolIndex - key # In the event of wraparound if translatedIndex < 0: translatedIndex += len(SYMBOLS) translated += SYMBOLS[translatedIndex] else: # Append the symbol without encrypting or decrypting translated += character # Output each attempt result = self.lc.checkLanguage(translated) if result: - return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated} - return True + return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": translated, "Cipher": "Caesar", "Extra Information": f"The rotation used is {counter}"} # if none of them match English, return false! + return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Caesar", "Extra Information": None} - return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None} ===========changed ref 1=========== # module: app.Tests.testcaesarcipher_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 = LanguageChecker() c = Caesar(lc) result = c.decrypt("o iozad iikwas") + self.assertEqual(result['IsPlaintext?'], False) - self.assertEqual(result, False) ===========changed ref 2=========== # module: app.Tests.testcaesarcipher_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 = LanguageChecker() c = 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) - self.assertEqual(result, True) ===========changed ref 3=========== + # module: app.Decryptor.basicEncryption.reverse + + ===========changed ref 4=========== + # module: app.Decryptor.basicEncryption.reverse + class Reverse: + def __init__(self, lc): + self.lc = lc + ===========changed ref 5=========== # module: app.Tests.testintegration_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 = LanguageChecker() result = lc.checkLanguage("hallo keine lieben leute nach") + self.assertEqual(result, True) - self.assertEqual(result, False) ===========changed ref 6=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def __init__(self, lc): self.lc = lc self.caesar = Caesar(self.lc) + self.reverse = Reverse(self.lc) + + self.list_of_objects = [self.caesar, self.reverse] - self.list_of_objects = [self.caesar] ===========changed ref 7=========== + # module: app.Decryptor.basicEncryption.reverse + class Reverse: + def decrypt(self, message): + message = message[::-1] + result = self.lc.checkLanguage(message) + if result: + 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} + ===========changed ref 8=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def decrypt(self, text): + answers = [] for item in self.list_of_objects: + result = item.decrypt(text) - item.decrypt(text) + answers.append(result) + for answer in answers: + # adds the LC objects together + self.lc = self.lc + answer["lc"] + if answer["IsPlaintext?"]: + return "YESSS QUEEn" - result = self.caesar.bruteforce() ===========changed ref 9=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: + def setProbTable(self, prob): self.probabilityDistribution = prob # we get a sorted list of objects :) counter = 0 for key, val in self.probabilityDistribution.items(): for listCounter, item in enumerate(self.list_of_objects): if item.getName() == key: # moves the item list_objs.insert(counter, list_objs.pop(listCounter)) counter = counter + 1 - pprint.pprint(self.list_of_objects) ===========changed ref 10=========== # module: app.Decryptor.Hash.hashBuster - - print ('''\033[1;97m_ _ ____ ____ _ _ ___ _ _ ____ ___ ____ ____ - |__| |__| [__ |__| |__] | | [__ | |___ |__/ - | | | | ___] | | |__] |__| ___] | |___ | \ %sv3.0\033[0m\n''' % red) md5 = [gamma, alpha, beta, theta, delta] sha1 = [alpha, beta, theta, delta] sha256 = [alpha, beta, theta] sha384 = [alpha, beta, theta] sha512 = [alpha, beta, theta]
app.main/Ciphey.one_level_of_decryption
Modified
Ciphey~Ciphey
d807e1be36658d01ef3c6d41dfb92c7e14f69aa7
added multiprocessing
<6>:<add> ret = key.decrypt(self.text) <add> print(ret)
# module: app.main class Ciphey: def one_level_of_decryption(self): <0> for key, val in self.whatToChoose.items(): <1> if key == str: <2> continue <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>
===========unchanged ref 0=========== at: Decryptor.basicEncryption.basic_parent.BasicParent setProbTable(prob) at: app.main.Ciphey.decrypt self.whatToChoose = {"Hashing": { "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.whatToChoose = new_dict at: collections.OrderedDict items() -> _OrderedDictItemsView[_KT, _VT]
app.Decryptor.basicEncryption.basic_parent/BasicParent.__init__
Modified
Ciphey~Ciphey
d807e1be36658d01ef3c6d41dfb92c7e14f69aa7
added multiprocessing
<4>:<add> self.list_of_objects = [self.caesar] <del> self.list_of_objects = [self.caesar, self.reverse]
# module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def __init__(self, lc): <0> self.lc = lc <1> self.caesar = Caesar(self.lc) <2> self.reverse = Reverse(self.lc) <3> <4> self.list_of_objects = [self.caesar, self.reverse] <5>
===========unchanged ref 0=========== at: Decryptor.basicEncryption.caesar Caesar(lc) at: Decryptor.basicEncryption.reverse Reverse(lc) at: app.Decryptor.basicEncryption.basic_parent.BasicParent.decrypt self.lc = self.lc + answer["lc"] ===========changed ref 0=========== # module: app.main class Ciphey: def one_level_of_decryption(self): for key, val in self.whatToChoose.items(): if key == str: continue # 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) + print(ret)
app.Decryptor.basicEncryption.basic_parent/BasicParent.decrypt
Modified
Ciphey~Ciphey
d807e1be36658d01ef3c6d41dfb92c7e14f69aa7
added multiprocessing
<0>:<add> self.text = text <add> <add> from multiprocessing.dummy import Pool as ThreadPool <add> pool = ThreadPool(4) <add> answers = pool.map(self.callDecrypt, self.list_of_objects) <add> <del> answers = [] <1>:<add> """for item in self.list_of_objects: <del> for item in self.list_of_objects: <3>:<add> answers.append(result)""" <del> answers.append(result) <8>:<add> return answer <add> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None} <del> return "YESSS QUEEn"
# module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def decrypt(self, text): <0> answers = [] <1> for item in self.list_of_objects: <2> result = item.decrypt(text) <3> answers.append(result) <4> for answer in answers: <5> # adds the LC objects together <6> self.lc = self.lc + answer["lc"] <7> if answer["IsPlaintext?"]: <8> return "YESSS QUEEn" <9>
===========unchanged ref 0=========== at: app.Decryptor.basicEncryption.basic_parent.BasicParent callDecrypt(obj) at: app.Decryptor.basicEncryption.basic_parent.BasicParent.__init__ self.list_of_objects = [self.caesar] at: multiprocessing.dummy Pool(processes: Optional[int]=..., initializer: Optional[Callable[..., Any]]=..., initargs: Iterable[Any]=...) -> Any ===========changed ref 0=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def __init__(self, lc): self.lc = lc self.caesar = Caesar(self.lc) self.reverse = Reverse(self.lc) + self.list_of_objects = [self.caesar] - self.list_of_objects = [self.caesar, self.reverse] ===========changed ref 1=========== # module: app.main class Ciphey: def one_level_of_decryption(self): for key, val in self.whatToChoose.items(): if key == str: continue # 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) + print(ret)
app.Decryptor.basicEncryption.basic_parent/BasicParent.__init__
Modified
Ciphey~Ciphey
2da1a04b07204e39b3ea5dd5706638019c35ec1f
added basic encoding and hashing functionality
<4>:<add> self.list_of_objects = [self.caesar, self.reverse] <del> self.list_of_objects = [self.caesar]
# module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def __init__(self, lc): <0> self.lc = lc <1> self.caesar = Caesar(self.lc) <2> self.reverse = Reverse(self.lc) <3> <4> self.list_of_objects = [self.caesar] <5>
===========unchanged ref 0=========== at: Decryptor.basicEncryption.caesar Caesar(lc) at: Decryptor.basicEncryption.reverse Reverse(lc) at: app.Decryptor.basicEncryption.basic_parent.BasicParent.decrypt self.lc = self.lc + answer["lc"] ===========changed ref 0=========== + # module: app.Decryptor.Encoding.base64 + + ===========changed ref 1=========== + # module: app.Decryptor.Encoding.base64 + + ===========changed ref 2=========== # module: app.Decryptor.basicEncryption.reverse class Reverse: + def getName(self): + return "Reverse" +
app.main/Ciphey.__init__
Modified
Ciphey~Ciphey
2da1a04b07204e39b3ea5dd5706638019c35ec1f
added basic encoding and hashing functionality
<10>:<add> self.hash = HashParent()
# module: app.main class Ciphey: def __init__(self, text): <0> # general purpose modules <1> self.ai = NeuralNetwork() <2> self.lc = 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>
===========unchanged ref 0=========== at: Decryptor.basicEncryption.basic_parent BasicParent(lc) at: mathsHelper mathsHelper() at: neuralNetworkMod.nn NeuralNetwork() ===========changed ref 0=========== + # module: app.Decryptor.Encoding.base64 + + ===========changed ref 1=========== + # module: app.Decryptor.Encoding.base64 + + ===========changed ref 2=========== # module: app.Decryptor.basicEncryption.reverse class Reverse: + def getName(self): + return "Reverse" + ===========changed ref 3=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def __init__(self, lc): self.lc = lc self.caesar = Caesar(self.lc) self.reverse = Reverse(self.lc) + self.list_of_objects = [self.caesar, self.reverse] - self.list_of_objects = [self.caesar]
app.main/Ciphey.one_level_of_decryption
Modified
Ciphey~Ciphey
2da1a04b07204e39b3ea5dd5706638019c35ec1f
added basic encoding and hashing functionality
<1>:<del> if key == str: <2>:<del> continue <7>:<add> if ret['IsPlaintext?']: <add> print(ret) <del> print(ret)
# module: app.main class Ciphey: def one_level_of_decryption(self): <0> for key, val in self.whatToChoose.items(): <1> if key == str: <2> continue <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> print(ret) <8>
===========unchanged ref 0=========== at: Decryptor.basicEncryption.basic_parent.BasicParent decrypt(text) setProbTable(prob) at: app.main.Ciphey.__init__ self.text = text at: app.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.whatToChoose = new_dict at: collections.OrderedDict items() -> _OrderedDictItemsView[_KT, _VT] ===========changed ref 0=========== # module: app.main class Ciphey: def __init__(self, text): # general purpose modules self.ai = NeuralNetwork() self.lc = 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() ===========changed ref 1=========== + # module: app.Decryptor.Encoding.base64 + + ===========changed ref 2=========== + # module: app.Decryptor.Encoding.base64 + + ===========changed ref 3=========== # module: app.Decryptor.basicEncryption.reverse class Reverse: + def getName(self): + return "Reverse" + ===========changed ref 4=========== # module: app.main class Ciphey: + def decrypt(self): - def decrypt(self, text): """ 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: - self.probabilityDistribution = self.ai.predictnn(text)[0] - self.whatToChoose = {"Hashing": { "sha1": self.probabilityDistribution[0], "md5": self.probabilityDistribution[1], "sha256": self.probabilityDistribution[2], "sha512": self.probabilityDistribution[3] </s> ===========changed ref 5=========== # module: app.main class Ciphey: + def decrypt(self): - def decrypt(self, text): # offset: 1 <s> "sha256": self.probabilityDistribution[2], "sha512": self.probabilityDistribution[3] }, self.basic: { "caesar": self.probabilityDistribution[4] }, "plaintext":{ "plaintext": self.probabilityDistribution[5] } } # 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 - import pprint - pprint.pprint(self.whatToChoose) + 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(): if key == max_</s> ===========changed ref 6=========== # module: app.main class Ciphey: + def decrypt(self): - def decrypt(self, text): # offset: 2 <s> 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 """ self.one_level_of_decryption() ===========changed ref 7=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def __init__(self, lc): self.lc = lc self.caesar = Caesar(self.lc) self.reverse = Reverse(self.lc) + self.list_of_objects = [self.caesar, self.reverse] - self.list_of_objects = [self.caesar]
app.Decryptor.Encoding.encodingParent/EncodingParent.binary
Modified
Ciphey~Ciphey
5d87f81237e5ea249f2169f18b81299a66b10414
final day
<2>:<del> def text_from_bits(bits, encoding='utf-8', errors='surrogatepass'): <3>:<del> n = int(bits, 2) <4>:<del> return int2bytes(n).decode(encoding, errors) <5>:<del> <6>:<del> def int2bytes(i): <7>:<del> hex_string = '%x' % i <8>:<del> n = len(hex_string) <9>:<del> return binascii.unhexlify(hex_string.zfill(n + (n & 1))) <10>:<add>
# module: app.Decryptor.Encoding.encodingParent class EncodingParent: + def binary(self, text): <0> import binascii <1> <2> def text_from_bits(bits, encoding='utf-8', errors='surrogatepass'): <3> n = int(bits, 2) <4> return int2bytes(n).decode(encoding, errors) <5> <6> def int2bytes(i): <7> hex_string = '%x' % i <8> n = len(hex_string) <9> return binascii.unhexlify(hex_string.zfill(n + (n & 1))) <10> <11> try: <12> result = text_from_bits(text) <13> except ValueError as e: <14> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None} <15> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "ASCII to Binary encoded", "Extra Information": None} <16>
===========unchanged ref 0=========== at: app.Decryptor.Encoding.encodingParent.EncodingParent.__init__ self.lc = lc at: app.Decryptor.Encoding.encodingParent.EncodingParent.binary result = text_from_bits(text) ===========changed ref 0=========== # module: app.Decryptor.Encoding.encodingParent class EncodingParent: - def base64(self, text): - import base64 - try: - result = base64.b64decode(text) - except binascii.Error as e: - return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None} - - return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Base64 encoded", "Extra Information": None} - ===========changed ref 1=========== + # module: app.Decryptor.Encoding.binary + + ===========changed ref 2=========== + # module: app.Decryptor.Encoding.binary + class Binary: + def __init__(self, lc): + self.lc = lc + ===========changed ref 3=========== # module: app.Decryptor.Encoding.base64 class Base64: + def decrypt(self, text): + + try: + result = base64.b64decode(text) + except binascii.Error as e: + 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": "Base64 encoded", "Extra Information": None} + else: + return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None} +
app.main/Ciphey.__init__
Modified
Ciphey~Ciphey
7b1cc0bfac94db6e6242e41bde767f95eb8b49da
yadyada#
<11>:<add> self.encoding = EncodingParent(self.lc)
# module: app.main class Ciphey: def __init__(self, text): <0> # general purpose modules <1> self.ai = NeuralNetwork() <2> self.lc = 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>
===========unchanged ref 0=========== at: Decryptor.basicEncryption.basic_parent BasicParent(lc) at: mathsHelper mathsHelper() at: neuralNetworkMod.nn NeuralNetwork()
app.Decryptor.Encoding.encodingParent/EncodingParent.__init__
Modified
Ciphey~Ciphey
7b1cc0bfac94db6e6242e41bde767f95eb8b49da
yadyada#
<1>:<add> self.base64 = Base64(self.lc) <add> self.binary = Binary(self.lc)
# module: app.Decryptor.Encoding.encodingParent + class EncodingParent: def __init__(self, lc): <0> self.lc = lc <1>
===========unchanged ref 0=========== at: Decryptor.Encoding.binary Binary(lc) ===========changed ref 0=========== # module: app.main class Ciphey: def __init__(self, text): # general purpose modules self.ai = NeuralNetwork() self.lc = 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)
app.Decryptor.Encoding.encodingParent/EncodingParent.decrypt
Modified
Ciphey~Ciphey
7b1cc0bfac94db6e6242e41bde767f95eb8b49da
yadyada#
<11>:<add> answers = pool.map(self.callDecrypt, torun) <add> <add> for answer in answers: <add> # adds the LC objects together <add> self.lc = self.lc + answer["lc"] <add> if answer["IsPlaintext?"]: <add> return answer <add> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None} <del> results = pool.map(callFunction, torun) <12>:<del> <13>:<del> """ <14>:<del> Ok so this one will have a list of all functions it can call <15>:<del> then it'll map.apply that for threading <16>:<del> """ <17>:<del> pass
# module: app.Decryptor.Encoding.encodingParent + class EncodingParent: def decrypt(self, text): <0> self.text = text <1> torun = [self.base64] <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> results = pool.map(callFunction, torun) <12> <13> """ <14> Ok so this one will have a list of all functions it can call <15> then it'll map.apply that for threading <16> """ <17> pass <18>
===========unchanged ref 0=========== at: Decryptor.Encoding.base64 Base64(lc) at: Decryptor.Encoding.binary Binary(lc) at: app.Decryptor.Encoding.encodingParent.EncodingParent callDecrypt(obj) at: app.Decryptor.Encoding.encodingParent.EncodingParent.decrypt self.lc = self.lc + answer["lc"] at: multiprocessing.dummy Pool(processes: Optional[int]=..., initializer: Optional[Callable[..., Any]]=..., initargs: Iterable[Any]=...) -> Any ===========changed ref 0=========== # module: app.Decryptor.Encoding.encodingParent + class EncodingParent: def __init__(self, lc): self.lc = lc + self.base64 = Base64(self.lc) + self.binary = Binary(self.lc) ===========changed ref 1=========== # module: app.main class Ciphey: def __init__(self, text): # general purpose modules self.ai = NeuralNetwork() self.lc = 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)
app.Decryptor.Encoding.base64/Base64.decrypt
Modified
Ciphey~Ciphey
7b1cc0bfac94db6e6242e41bde767f95eb8b49da
yadyada#
<3>:<add> print("********************************", str(result))
# module: app.Decryptor.Encoding.base64 class Base64: def decrypt(self, text): <0> <1> try: <2> result = base64.b64decode(text) <3> except binascii.Error as e: <4> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None} <5> if self.lc.checkLanguage(result): <6> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Base64 encoded", "Extra Information": None} <7> else: <8> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None} <9>
===========unchanged ref 0=========== at: app.Decryptor.Encoding.base64.Base64.__init__ self.lc = lc at: base64 b64decode(s: _decodable, altchars: Optional[bytes]=..., validate: bool=...) -> bytes ===========changed ref 0=========== + # module: app.Tests.testEncoding + sys.path.append("..") + ===========changed ref 1=========== # module: app.Decryptor.Encoding.encodingParent + class EncodingParent: - def callFunction(func): - return func(self.text) - ===========changed ref 2=========== + # module: app.Tests.testEncoding + #self.assertEqual(result['IsPlaintext?'], True) + ===========changed ref 3=========== # module: app.Decryptor.Encoding.encodingParent + class EncodingParent: + def callDecrypt(self, obj): + # i only exist to call decrypt + return obj.decrypt(self.text) + ===========changed ref 4=========== # module: app.Decryptor.Encoding.encodingParent + class EncodingParent: def __init__(self, lc): self.lc = lc + self.base64 = Base64(self.lc) + self.binary = Binary(self.lc) ===========changed ref 5=========== + # module: app.Tests.testEncoding + # 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 = LanguageChecker() + ep = EncodingParent(lc) + ep.decrypt("eW91ciB0ZXh0") + ===========changed ref 6=========== # module: app.main class Ciphey: def __init__(self, text): # general purpose modules self.ai = NeuralNetwork() self.lc = 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) ===========changed ref 7=========== # module: app.Decryptor.Encoding.encodingParent + class EncodingParent: - - def binary(self, text): - import binascii - - - - try: - result = text_from_bits(text) - except ValueError as e: - 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} - ===========changed ref 8=========== # module: app.Decryptor.Encoding.encodingParent + class EncodingParent: def decrypt(self, text): self.text = text torun = [self.base64] """ 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 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} - results = pool.map(callFunction, torun) - - """ - Ok so this one will have a list of all functions it can call - then it'll map.apply that for threading - """ - pass
app.Decryptor.Encoding.encodingParent/EncodingParent.__init__
Modified
Ciphey~Ciphey
c933b7ac1b2f12796de549c31dbd6ec72ed0c503
finished encoding i think
<3>:<add> self.hex = Hexadecimal(self.lc)
# module: app.Decryptor.Encoding.encodingParent class EncodingParent: def __init__(self, lc): <0> self.lc = lc <1> self.base64 = Base64(self.lc) <2> self.binary = Binary(self.lc) <3>
===========unchanged ref 0=========== at: Decryptor.Encoding.base64 Base64(lc) at: app.Decryptor.Encoding.encodingParent.EncodingParent.decrypt self.lc = self.lc + answer["lc"] ===========changed ref 0=========== + # module: app.Decryptor.Encoding.ascii + + ===========changed ref 1=========== + # module: app.Decryptor.Encoding.ascii + class Ascii: + def decrypt(self, text): + pass + ===========changed ref 2=========== + # module: app.Decryptor.Encoding.ascii + class Ascii: + def __init__(self, lc): + self.lc = lc + ===========changed ref 3=========== + # module: app.Decryptor.Encoding.ascii + class Ascii: + """ + turns ASCII numbers into strings + """ + ===========changed ref 4=========== + # module: app.Decryptor.Encoding.test + + def text_from_bits(bits, encoding='utf-8', errors='surrogatepass'): + n = int(bits, 2) + return int2bytes(n).decode(encoding, errors) + ===========changed ref 5=========== + # module: app.Decryptor.Encoding.test + print(text_to_bits('hello')) + print(text_from_bits('110100001100101011011000110110001101111')) + ===========changed ref 6=========== + # module: app.Decryptor.Encoding.test + + def int2bytes(i): + hex_string = '%x' % i + n = len(hex_string) + return binascii.unhexlify(hex_string.zfill(n + (n & 1))) + ===========changed ref 7=========== + # module: app.Decryptor.Encoding.test + + def text_to_bits(text, encoding='utf-8', errors='surrogatepass'): + bits = bin(int(binascii.hexlify(text.encode(encoding, errors)), 16))[2:] + return bits.zfill(8 * ((len(bits) + 7) // 8)) + ===========changed ref 8=========== + # module: app.Decryptor.Encoding.ascii + class Ascii: + def deasci(self, text): + # splits into individual ascii nums + text = text.split(" ") + sentence = [] + # for every char in the text (63, for example) + for char in text: + # turn it from ascii num to char and append to list + sentence.append(chr(char)) + # return the list as a string + return ''.join(sentence) +
app.Decryptor.Encoding.encodingParent/EncodingParent.decrypt
Modified
Ciphey~Ciphey
c933b7ac1b2f12796de549c31dbd6ec72ed0c503
finished encoding i think
<1>:<add> torun = [self.base64, self.binary, self.hex] <del> torun = [self.base64]
# module: app.Decryptor.Encoding.encodingParent class EncodingParent: def decrypt(self, text): <0> self.text = text <1> torun = [self.base64] <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: Decryptor.Encoding.binary Binary(lc) at: Decryptor.Encoding.hexadecimal Hexadecimal(lc) at: app.Decryptor.Encoding.encodingParent.EncodingParent callDecrypt(obj) at: app.Decryptor.Encoding.encodingParent.EncodingParent.__init__ self.lc = lc self.base64 = Base64(self.lc) at: multiprocessing.dummy Pool(processes: Optional[int]=..., initializer: Optional[Callable[..., Any]]=..., initargs: Iterable[Any]=...) -> Any ===========changed ref 0=========== # module: app.Decryptor.Encoding.encodingParent class EncodingParent: def __init__(self, lc): self.lc = lc self.base64 = Base64(self.lc) self.binary = Binary(self.lc) + self.hex = Hexadecimal(self.lc) ===========changed ref 1=========== + # module: app.Decryptor.Encoding.ascii + + ===========changed ref 2=========== + # module: app.Decryptor.Encoding.ascii + class Ascii: + def decrypt(self, text): + pass + ===========changed ref 3=========== + # module: app.Decryptor.Encoding.ascii + class Ascii: + def __init__(self, lc): + self.lc = lc + ===========changed ref 4=========== + # module: app.Decryptor.Encoding.ascii + class Ascii: + """ + turns ASCII numbers into strings + """ + ===========changed ref 5=========== + # module: app.Decryptor.Encoding.test + + def text_from_bits(bits, encoding='utf-8', errors='surrogatepass'): + n = int(bits, 2) + return int2bytes(n).decode(encoding, errors) + ===========changed ref 6=========== + # module: app.Decryptor.Encoding.test + print(text_to_bits('hello')) + print(text_from_bits('110100001100101011011000110110001101111')) + ===========changed ref 7=========== + # module: app.Decryptor.Encoding.test + + def int2bytes(i): + hex_string = '%x' % i + n = len(hex_string) + return binascii.unhexlify(hex_string.zfill(n + (n & 1))) + ===========changed ref 8=========== + # module: app.Decryptor.Encoding.test + + def text_to_bits(text, encoding='utf-8', errors='surrogatepass'): + bits = bin(int(binascii.hexlify(text.encode(encoding, errors)), 16))[2:] + return bits.zfill(8 * ((len(bits) + 7) // 8)) + ===========changed ref 9=========== + # module: app.Decryptor.Encoding.ascii + class Ascii: + def deasci(self, text): + # splits into individual ascii nums + text = text.split(" ") + sentence = [] + # for every char in the text (63, for example) + for char in text: + # turn it from ascii num to char and append to list + sentence.append(chr(char)) + # return the list as a string + return ''.join(sentence) +
app.Tests.testEncoding/TestNN.test_english_yes
Modified
Ciphey~Ciphey
c933b7ac1b2f12796de549c31dbd6ec72ed0c503
finished encoding i think
<2>:<add> result = ep.decrypt("eW91ciB0ZXh0") <del> ep.decrypt("eW91ciB0ZXh0") <3>:<add> self.assertEqual(result['IsPlaintext?'], True)
# module: app.Tests.testEncoding # 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): <0> lc = LanguageChecker() <1> ep = EncodingParent(lc) <2> ep.decrypt("eW91ciB0ZXh0") <3>
===========unchanged ref 0=========== at: app.Decryptor.Encoding.encodingParent EncodingParent(lc) at: app.Decryptor.Encoding.encodingParent.EncodingParent decrypt(text) ===========changed ref 0=========== # module: app.Decryptor.Encoding.encodingParent class EncodingParent: def decrypt(self, text): self.text = text + torun = [self.base64, self.binary, self.hex] - torun = [self.base64] """ 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 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} ===========changed ref 1=========== + # module: app.Decryptor.Encoding.ascii + + ===========changed ref 2=========== + # module: app.Decryptor.Encoding.ascii + class Ascii: + def decrypt(self, text): + pass + ===========changed ref 3=========== + # module: app.Decryptor.Encoding.ascii + class Ascii: + def __init__(self, lc): + self.lc = lc + ===========changed ref 4=========== + # module: app.Decryptor.Encoding.ascii + class Ascii: + """ + turns ASCII numbers into strings + """ + ===========changed ref 5=========== + # module: app.Decryptor.Encoding.test + + def text_from_bits(bits, encoding='utf-8', errors='surrogatepass'): + n = int(bits, 2) + return int2bytes(n).decode(encoding, errors) + ===========changed ref 6=========== + # module: app.Decryptor.Encoding.test + print(text_to_bits('hello')) + print(text_from_bits('110100001100101011011000110110001101111')) + ===========changed ref 7=========== + # module: app.Decryptor.Encoding.test + + def int2bytes(i): + hex_string = '%x' % i + n = len(hex_string) + return binascii.unhexlify(hex_string.zfill(n + (n & 1))) + ===========changed ref 8=========== # module: app.Decryptor.Encoding.encodingParent class EncodingParent: def __init__(self, lc): self.lc = lc self.base64 = Base64(self.lc) self.binary = Binary(self.lc) + self.hex = Hexadecimal(self.lc) ===========changed ref 9=========== + # module: app.Decryptor.Encoding.test + + def text_to_bits(text, encoding='utf-8', errors='surrogatepass'): + bits = bin(int(binascii.hexlify(text.encode(encoding, errors)), 16))[2:] + return bits.zfill(8 * ((len(bits) + 7) // 8)) + ===========changed ref 10=========== + # module: app.Decryptor.Encoding.ascii + class Ascii: + def deasci(self, text): + # splits into individual ascii nums + text = text.split(" ") + sentence = [] + # for every char in the text (63, for example) + for char in text: + # turn it from ascii num to char and append to list + sentence.append(chr(char)) + # return the list as a string + return ''.join(sentence) +
app.Decryptor.Encoding.base64/Base64.decrypt
Modified
Ciphey~Ciphey
c933b7ac1b2f12796de549c31dbd6ec72ed0c503
finished encoding i think
<3>:<add> # yeet turning b strings into normal stringy bois <add> result = result.decode("utf-8") <add> except UnicodeDecodeError as e: <add> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None} <del> print("********************************", str(result))
# module: app.Decryptor.Encoding.base64 class Base64: def decrypt(self, text): <0> <1> try: <2> result = base64.b64decode(text) <3> print("********************************", str(result)) <4> except binascii.Error as e: <5> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None} <6> if self.lc.checkLanguage(result): <7> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Base64 encoded", "Extra Information": None} <8> else: <9> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None} <10>
===========unchanged ref 0=========== at: base64 b64decode(s: _decodable, altchars: Optional[bytes]=..., validate: bool=...) -> bytes ===========changed ref 0=========== + # module: app.Decryptor.Encoding.ascii + + ===========changed ref 1=========== + # module: app.Decryptor.Encoding.ascii + class Ascii: + def decrypt(self, text): + pass + ===========changed ref 2=========== + # module: app.Decryptor.Encoding.ascii + class Ascii: + def __init__(self, lc): + self.lc = lc + ===========changed ref 3=========== + # module: app.Decryptor.Encoding.ascii + class Ascii: + """ + turns ASCII numbers into strings + """ + ===========changed ref 4=========== + # module: app.Decryptor.Encoding.test + + def text_from_bits(bits, encoding='utf-8', errors='surrogatepass'): + n = int(bits, 2) + return int2bytes(n).decode(encoding, errors) + ===========changed ref 5=========== + # module: app.Decryptor.Encoding.test + print(text_to_bits('hello')) + print(text_from_bits('110100001100101011011000110110001101111')) + ===========changed ref 6=========== + # module: app.Decryptor.Encoding.test + + def int2bytes(i): + hex_string = '%x' % i + n = len(hex_string) + return binascii.unhexlify(hex_string.zfill(n + (n & 1))) + ===========changed ref 7=========== # module: app.Decryptor.Encoding.encodingParent class EncodingParent: def __init__(self, lc): self.lc = lc self.base64 = Base64(self.lc) self.binary = Binary(self.lc) + self.hex = Hexadecimal(self.lc) ===========changed ref 8=========== + # module: app.Decryptor.Encoding.test + + def text_to_bits(text, encoding='utf-8', errors='surrogatepass'): + bits = bin(int(binascii.hexlify(text.encode(encoding, errors)), 16))[2:] + return bits.zfill(8 * ((len(bits) + 7) // 8)) + ===========changed ref 9=========== # module: app.Tests.testEncoding # 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_base64_spaces_yes(self): + lc = LanguageChecker() + ep = EncodingParent(lc) + result = ep.decrypt("SGVsbG8gSSBsaWtlIGRvZ3MgYW5kIGNhdHM=") + self.assertEqual(result['IsPlaintext?'], True) + ===========changed ref 10=========== # module: app.Tests.testEncoding # 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 = LanguageChecker() ep = EncodingParent(lc) + result = ep.decrypt("eW91ciB0ZXh0") - ep.decrypt("eW91ciB0ZXh0") + self.assertEqual(result['IsPlaintext?'], True) ===========changed ref 11=========== + # module: app.Decryptor.Encoding.ascii + class Ascii: + def deasci(self, text): + # splits into individual ascii nums + text = text.split(" ") + sentence = [] + # for every char in the text (63, for example) + for char in text: + # turn it from ascii num to char and append to list + sentence.append(chr(char)) + # return the list as a string + return ''.join(sentence) + ===========changed ref 12=========== # module: app.Tests.testEncoding # 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_hex_spaces_yes(self): + lc = 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 13=========== # module: app.Tests.testEncoding # 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_binary_spaces_yes(self): + lc = 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 14=========== # module: app.Decryptor.Encoding.encodingParent class EncodingParent: def decrypt(self, text): self.text = text + torun = [self.base64, self.binary, self.hex] - torun = [self.base64] """ 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 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}
app.Decryptor.Encoding.binary/Binary.decrypt
Modified
Ciphey~Ciphey
c933b7ac1b2f12796de549c31dbd6ec72ed0c503
finished encoding i think
<1>:<add> result = self.decode(text) <del> ret = text_to_bits(text) <4>:<add> except TypeError as e: <add> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None} <add>
# module: app.Decryptor.Encoding.binary class Binary: def decrypt(self, text): <0> try: <1> ret = text_to_bits(text) <2> except ValueError as e: <3> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None} <4> if self.lc.checkLanguage(result): <5> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Ascii to Binary encoded", "Extra Information": None} <6>
===========unchanged ref 0=========== at: app.Decryptor.Encoding.binary.Binary decode(text) at: app.Decryptor.Encoding.binary.Binary.__init__ self.lc = lc ===========changed ref 0=========== + # module: app.Decryptor.Encoding.ascii + + ===========changed ref 1=========== + # module: app.Decryptor.Encoding.ascii + class Ascii: + def decrypt(self, text): + pass + ===========changed ref 2=========== + # module: app.Decryptor.Encoding.ascii + class Ascii: + def __init__(self, lc): + self.lc = lc + ===========changed ref 3=========== + # module: app.Decryptor.Encoding.ascii + class Ascii: + """ + turns ASCII numbers into strings + """ + ===========changed ref 4=========== + # module: app.Decryptor.Encoding.test + + def text_from_bits(bits, encoding='utf-8', errors='surrogatepass'): + n = int(bits, 2) + return int2bytes(n).decode(encoding, errors) + ===========changed ref 5=========== + # module: app.Decryptor.Encoding.test + print(text_to_bits('hello')) + print(text_from_bits('110100001100101011011000110110001101111')) + ===========changed ref 6=========== + # module: app.Decryptor.Encoding.test + + def int2bytes(i): + hex_string = '%x' % i + n = len(hex_string) + return binascii.unhexlify(hex_string.zfill(n + (n & 1))) + ===========changed ref 7=========== # module: app.Decryptor.Encoding.encodingParent class EncodingParent: def __init__(self, lc): self.lc = lc self.base64 = Base64(self.lc) self.binary = Binary(self.lc) + self.hex = Hexadecimal(self.lc) ===========changed ref 8=========== + # module: app.Decryptor.Encoding.test + + def text_to_bits(text, encoding='utf-8', errors='surrogatepass'): + bits = bin(int(binascii.hexlify(text.encode(encoding, errors)), 16))[2:] + return bits.zfill(8 * ((len(bits) + 7) // 8)) + ===========changed ref 9=========== # module: app.Tests.testEncoding # 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_base64_spaces_yes(self): + lc = LanguageChecker() + ep = EncodingParent(lc) + result = ep.decrypt("SGVsbG8gSSBsaWtlIGRvZ3MgYW5kIGNhdHM=") + self.assertEqual(result['IsPlaintext?'], True) + ===========changed ref 10=========== # module: app.Tests.testEncoding # 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 = LanguageChecker() ep = EncodingParent(lc) + result = ep.decrypt("eW91ciB0ZXh0") - ep.decrypt("eW91ciB0ZXh0") + self.assertEqual(result['IsPlaintext?'], True) ===========changed ref 11=========== + # module: app.Decryptor.Encoding.ascii + class Ascii: + def deasci(self, text): + # splits into individual ascii nums + text = text.split(" ") + sentence = [] + # for every char in the text (63, for example) + for char in text: + # turn it from ascii num to char and append to list + sentence.append(chr(char)) + # return the list as a string + return ''.join(sentence) + ===========changed ref 12=========== # module: app.Tests.testEncoding # 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_hex_spaces_yes(self): + lc = 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 13=========== # module: app.Tests.testEncoding # 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_binary_spaces_yes(self): + lc = 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 14=========== # module: app.Decryptor.Encoding.encodingParent class EncodingParent: def decrypt(self, text): self.text = text + torun = [self.base64, self.binary, self.hex] - torun = [self.base64] """ 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 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}
app.Decryptor.Encoding.encodingParent/EncodingParent.__init__
Modified
Ciphey~Ciphey
4eec54d8c5ccce2a8ab05ea453251c0c5de167f3
viginere cipher
<4>:<add> self.ascii = Ascii(self.lc)
# module: app.Decryptor.Encoding.encodingParent class EncodingParent: def __init__(self, lc): <0> self.lc = lc <1> self.base64 = Base64(self.lc) <2> self.binary = Binary(self.lc) <3> self.hex = Hexadecimal(self.lc) <4>
===========unchanged ref 0=========== at: Decryptor.Encoding.base64 Base64(lc) at: Decryptor.Encoding.binary Binary(lc) at: app.Decryptor.Encoding.encodingParent.EncodingParent.decrypt self.lc = self.lc + answer["lc"] ===========changed ref 0=========== + # module: app.Decryptor.basicEncryption.viginere + + ===========changed ref 1=========== + # module: app.Decryptor.basicEncryption.viginere + class Viginere: + def getItemAtIndexOne(self, items): + return items[1] + ===========changed ref 2=========== + # module: app.Decryptor.basicEncryption.viginere + class Viginere: + + + def decryptMessage(self, key, message): + return translateMessage(key, message, 'decrypt') + ===========changed ref 3=========== + # module: app.Decryptor.basicEncryption.viginere + class Viginere: + def encryptMessage(self, key, message): + return translateMessage(key, message, 'encrypt') + ===========changed ref 4=========== + # module: app.Decryptor.basicEncryption.viginere + class Viginere: + def __init__(self, lc): + self.lc = lc + self.MAX_KEY_LENGTH = 16 + self.self.NONself.LETTERS_PATTERN = re.compile('[^A-Z]') + self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + self.analysis = "" + ===========changed ref 5=========== + # module: app.Decryptor.basicEncryption.viginere + class Viginere: + def decrypt(self, text): + result = hackVigenere(text) + print(result) + if result['IsPlaintext?']: + return result + else: + return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Vigenère cipher", "Extra Information": f"{self.analysis}"} + ===========changed ref 6=========== + # module: app.Decryptor.basicEncryption.viginere + class Viginere: + def getNthSubkeysLetters(self, nth, keyLength, message): + # Returns every nth letter for each keyLength set of self.LETTERS in text. + # E.g. getNthSubkeysself.LETTERS(1, 3, 'ABCABCABC') returns 'AAA' + # getNthSubkeysself.LETTERS(2, 3, 'ABCABCABC') returns 'BBB' + # getNthSubkeysself.LETTERS(3, 3, 'ABCABCABC') returns 'CCC' + # getNthSubkeysself.LETTERS(1, 5, 'ABCDEFGHI') returns 'AF' + + # Use a regular expression to remove non-self.LETTERS from the message: + message = self.NONself.LETTERS_PATTERN.sub('', message) + + i = nth - 1 + self.LETTERS = [] + while i < len(message): + self.LETTERS.append(message[i]) + i += keyLength + return ''.join(self.LETTERS) + ===========changed ref 7=========== + # module: app.Decryptor.basicEncryption.viginere + class Viginere: + def getUsefulFactors(self, num): + # Will not attempt keys longer than this. + # Returns a list of useful factors of num. By "useful" we mean factors + # less than self.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. + + factors = [] # The list of factors found. + + # When finding factors, you only need to check the integers up to + # self.MAX_KEY_LENGTH. + 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. + ===========changed ref 8=========== + # module: app.Decryptor.basicEncryption.viginere + class Viginere: + def kasiskiExamination(self, ciphertext): + # Find out the sequences of 3 to 5 self.LETTERS that occur multiple times + # in the ciphertext. repeatedSeqSpacings has a value like: + # {'EXG': [192], 'NAF': [339, 972, 633], ... } + repeatedSeqSpacings = self.findRepeatSequencesSpacings(ciphertext) + + # (See getMostCommonFactors() for a description of seqFactors.) + seqFactors = {} + for seq in repeatedSeqSpacings: + seqFactors[seq] = [] + for spacing in repeatedSeqSpacings[seq]: + seqFactors[seq].extend(self.getUsefulFactors(spacing)) + + # (See getMostCommonFactors() for a description of factorsByCount.) + factorsByCount = self.getMostCommonFactors(seqFactors) + + # Now we extract the factor counts from factorsByCount and + # put them in allLikelyKeyLengths so that they are easier to + # use later: + allLikelyKeyLengths = [] + for twoIntTuple in factorsByCount: + allLikelyKeyLengths.append(twoIntTuple[0]) + + return allLikelyKeyLengths + ===========changed ref 9=========== + # module: app.Decryptor.basicEncryption.viginere + class Viginere: + def translateMessage(self, key, message, mode): + translated = [] # Stores the encrypted/decrypted message string. + + keyIndex = 0 + key = key.upper() + + for symbol in message: # Loop through each symbol in message. + num = self.LETTERS.find(symbol.upper()) + if num != -1: # -1 means symbol.upper() was not found in self.LETTERS. + if mode == 'encrypt': + num += self.LETTERS.find(key[keyIndex]) # Add if encrypting. + elif mode == 'decrypt': + num -= self.LETTERS.find(key[keyIndex]) # Subtract if decrypting. + + num %= len(self.LETTERS) # Handle any wraparound. + + # Add the encrypted/decrypted symbol to the end of translated: + if symbol.isupper(): + translated.append(self.LETTERS[num]) + elif symbol.islower(): + translated.append(self.LETTERS[num].lower()) + + keyIndex += 1 # Move to the next letter in the key. + if keyIndex == len(key): + keyIndex = 0 + else: + # Append the symbol without encrypting/decrypting. + translated.append(symbol) + + return ''.join(translated) +
app.Decryptor.Encoding.encodingParent/EncodingParent.decrypt
Modified
Ciphey~Ciphey
4eec54d8c5ccce2a8ab05ea453251c0c5de167f3
viginere cipher
<1>:<add> torun = [self.base64, self.binary, self.hex, self.ascii] <del> torun = [self.base64, self.binary, self.hex]
# module: app.Decryptor.Encoding.encodingParent class EncodingParent: def decrypt(self, text): <0> self.text = text <1> torun = [self.base64, self.binary, self.hex] <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: Decryptor.Encoding.ascii Ascii(lc) at: Decryptor.Encoding.hexadecimal Hexadecimal(lc) at: app.Decryptor.Encoding.encodingParent.EncodingParent callDecrypt(obj) at: app.Decryptor.Encoding.encodingParent.EncodingParent.__init__ self.lc = lc self.base64 = Base64(self.lc) self.binary = Binary(self.lc) at: multiprocessing.dummy Pool(processes: Optional[int]=..., initializer: Optional[Callable[..., Any]]=..., initargs: Iterable[Any]=...) -> Any ===========changed ref 0=========== # module: app.Decryptor.Encoding.encodingParent class EncodingParent: def __init__(self, lc): self.lc = lc self.base64 = Base64(self.lc) self.binary = Binary(self.lc) self.hex = Hexadecimal(self.lc) + self.ascii = Ascii(self.lc) ===========changed ref 1=========== + # module: app.Decryptor.basicEncryption.viginere + + ===========changed ref 2=========== + # module: app.Decryptor.basicEncryption.viginere + class Viginere: + def getItemAtIndexOne(self, items): + return items[1] + ===========changed ref 3=========== + # module: app.Decryptor.basicEncryption.viginere + class Viginere: + + + def decryptMessage(self, key, message): + return translateMessage(key, message, 'decrypt') + ===========changed ref 4=========== + # module: app.Decryptor.basicEncryption.viginere + class Viginere: + def encryptMessage(self, key, message): + return translateMessage(key, message, 'encrypt') + ===========changed ref 5=========== + # module: app.Decryptor.basicEncryption.viginere + class Viginere: + def __init__(self, lc): + self.lc = lc + self.MAX_KEY_LENGTH = 16 + self.self.NONself.LETTERS_PATTERN = re.compile('[^A-Z]') + self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + self.analysis = "" + ===========changed ref 6=========== + # module: app.Decryptor.basicEncryption.viginere + class Viginere: + def decrypt(self, text): + result = hackVigenere(text) + print(result) + if result['IsPlaintext?']: + return result + else: + return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Vigenère cipher", "Extra Information": f"{self.analysis}"} + ===========changed ref 7=========== + # module: app.Decryptor.basicEncryption.viginere + class Viginere: + def getNthSubkeysLetters(self, nth, keyLength, message): + # Returns every nth letter for each keyLength set of self.LETTERS in text. + # E.g. getNthSubkeysself.LETTERS(1, 3, 'ABCABCABC') returns 'AAA' + # getNthSubkeysself.LETTERS(2, 3, 'ABCABCABC') returns 'BBB' + # getNthSubkeysself.LETTERS(3, 3, 'ABCABCABC') returns 'CCC' + # getNthSubkeysself.LETTERS(1, 5, 'ABCDEFGHI') returns 'AF' + + # Use a regular expression to remove non-self.LETTERS from the message: + message = self.NONself.LETTERS_PATTERN.sub('', message) + + i = nth - 1 + self.LETTERS = [] + while i < len(message): + self.LETTERS.append(message[i]) + i += keyLength + return ''.join(self.LETTERS) + ===========changed ref 8=========== + # module: app.Decryptor.basicEncryption.viginere + class Viginere: + def getUsefulFactors(self, num): + # Will not attempt keys longer than this. + # Returns a list of useful factors of num. By "useful" we mean factors + # less than self.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. + + factors = [] # The list of factors found. + + # When finding factors, you only need to check the integers up to + # self.MAX_KEY_LENGTH. + 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. + ===========changed ref 9=========== + # module: app.Decryptor.basicEncryption.viginere + class Viginere: + def kasiskiExamination(self, ciphertext): + # Find out the sequences of 3 to 5 self.LETTERS that occur multiple times + # in the ciphertext. repeatedSeqSpacings has a value like: + # {'EXG': [192], 'NAF': [339, 972, 633], ... } + repeatedSeqSpacings = self.findRepeatSequencesSpacings(ciphertext) + + # (See getMostCommonFactors() for a description of seqFactors.) + seqFactors = {} + for seq in repeatedSeqSpacings: + seqFactors[seq] = [] + for spacing in repeatedSeqSpacings[seq]: + seqFactors[seq].extend(self.getUsefulFactors(spacing)) + + # (See getMostCommonFactors() for a description of factorsByCount.) + factorsByCount = self.getMostCommonFactors(seqFactors) + + # Now we extract the factor counts from factorsByCount and + # put them in allLikelyKeyLengths so that they are easier to + # use later: + allLikelyKeyLengths = [] + for twoIntTuple in factorsByCount: + allLikelyKeyLengths.append(twoIntTuple[0]) + + return allLikelyKeyLengths +
app.Decryptor.Encoding.ascii/Ascii.decrypt
Modified
Ciphey~Ciphey
4eec54d8c5ccce2a8ab05ea453251c0c5de167f3
viginere cipher
<0>:<add> try: <add> result = self.deascii(text) <add> except ValueError as e: <add> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None} <add> except TypeError as e: <add> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None} <add> <add> <add> if self.lc.checkLanguage(result): <add> return {"lc": self.lc, "IsPlaintext?": True, "Plaintext": result, "Cipher": "Ascii to Ascii number encoded", "Extra Information": None} <del> pass
# module: app.Decryptor.Encoding.ascii class Ascii: def decrypt(self, text): <0> pass <1>
===========changed ref 0=========== + # module: app.Decryptor.basicEncryption.viginere + + ===========changed ref 1=========== + # module: app.Decryptor.basicEncryption.vigenereHacker + + + def getItemAtIndexOne(items): + return items[1] + ===========changed ref 2=========== + # module: app.Decryptor.basicEncryption.viginere + class Viginere: + def getItemAtIndexOne(self, items): + return items[1] + ===========changed ref 3=========== + # module: app.Decryptor.basicEncryption.vigenereCipher + + + def decryptMessage(key, message): + return translateMessage(key, message, 'decrypt') + ===========changed ref 4=========== + # module: app.Decryptor.basicEncryption.vigenereCipher + + + def encryptMessage(key, message): + return translateMessage(key, message, 'encrypt') + ===========changed ref 5=========== + # module: app.Decryptor.basicEncryption.viginere + class Viginere: + + + def decryptMessage(self, key, message): + return translateMessage(key, message, 'decrypt') + ===========changed ref 6=========== + # module: app.Decryptor.basicEncryption.viginere + class Viginere: + def encryptMessage(self, key, message): + return translateMessage(key, message, 'encrypt') + ===========changed ref 7=========== + # module: app.Decryptor.basicEncryption.vigenereCipher + + LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + ===========changed ref 8=========== + # module: app.Decryptor.basicEncryption.vigenereCipher + + + # If vigenereCipher.py is run (instead of imported as a module) call + # the main() function. + if __name__ == '__main__': + main() + ===========changed ref 9=========== + # module: app.Decryptor.basicEncryption.vigenereHacker + + + # If vigenereHacker.py is run (instead of imported as a module) call + # the main() function. + if __name__ == '__main__': + main() + ===========changed ref 10=========== # module: app.Decryptor.Encoding.encodingParent class EncodingParent: def __init__(self, lc): self.lc = lc self.base64 = Base64(self.lc) self.binary = Binary(self.lc) self.hex = Hexadecimal(self.lc) + self.ascii = Ascii(self.lc) ===========changed ref 11=========== # module: app.Tests.testEncoding # 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_ascii(self): + lc = 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 12=========== + # module: app.Decryptor.basicEncryption.viginere + class Viginere: + def __init__(self, lc): + self.lc = lc + self.MAX_KEY_LENGTH = 16 + self.self.NONself.LETTERS_PATTERN = re.compile('[^A-Z]') + self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + self.analysis = "" + ===========changed ref 13=========== + # module: app.Decryptor.basicEncryption.viginere + class Viginere: + def decrypt(self, text): + result = hackVigenere(text) + print(result) + if result['IsPlaintext?']: + return result + else: + return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": "Vigenère cipher", "Extra Information": f"{self.analysis}"} + ===========changed ref 14=========== + # module: app.Decryptor.basicEncryption.vigenereHacker + + LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + SILENT_MODE = False # If set to True, program doesn't print anything. + NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey. + MAX_KEY_LENGTH = 16 # Will not attempt keys longer than this. + NONLETTERS_PATTERN = re.compile('[^A-Z]') + ===========changed ref 15=========== + # module: app.Decryptor.basicEncryption.vigenereCipher + + def main(): + # This text can be copy/pasted from https://invpy.com/vigenereCipher.py: + myMessage = """Alan Mathison Turing was a British mathematician, logician, cryptanalyst, and computer scientist.""" + myKey = 'ASIMOV' + myMode = 'encrypt' # Set to either 'encrypt' or 'decrypt'. + + if myMode == 'encrypt': + translated = encryptMessage(myKey, myMessage) + elif myMode == 'decrypt': + translated = decryptMessage(myKey, myMessage) + + print('%sed message:' % (myMode.title())) + print(translated) + pyperclip.copy(translated) + print() + print('The message has been copied to the clipboard.') + ===========changed ref 16=========== + # module: app.Decryptor.basicEncryption.vigenereHacker + + + def getNthSubkeysLetters(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 = NONLETTERS_PATTERN.sub('', message) + + i = nth - 1 + letters = [] + while i < len(message): + letters.append(message[i]) + i += keyLength + return ''.join(letters) + ===========changed ref 17=========== # module: app.Decryptor.Encoding.encodingParent class EncodingParent: def decrypt(self, text): self.text = text + torun = [self.base64, self.binary, self.hex, self.ascii] - torun = [self.base64, self.binary, self.hex] """ 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 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}
app.mathsHelper/mathsHelper.__init__
Modified
Ciphey~Ciphey
326e932fa8e472d9a69c8d47a6f9694dcfab6fdd
fixed serious bug with language checker
<0>:<add> self.ETAOIN = 'ETAOINSHRDLCUMWFGYPBVKJXQZ' <add> self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' <del> None
# module: app.mathsHelper class mathsHelper: def __init__(self): <0> None <1>
===========changed ref 0=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.addNumbers + def addNumbers(a, b): + return a + b + ===========changed ref 1=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.passingReference + def eggs(someParameter): + someParameter.append('Hello') + ===========changed ref 2=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.vigenereDictionaryHacker + + if __name__ == '__main__': + main() + ===========changed ref 3=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.addNumbers + + spam = addNumbers(2, 40) + print(spam) + ===========changed ref 4=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.passingReference + spam = [1, 2, 3] + eggs(spam) + print(spam) + ===========changed ref 5=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.transpositionDecrypt + + + # If transpositionDecrypt.py is run (instead of imported as a module) call + # the main() function. + if __name__ == '__main__': + main() + ===========changed ref 6=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.reverseCipher + # Reverse Cipher + # https://www.nostarch.com/crackingcodes (BSD Licensed) + + message = 'Three can keep a secret, if two of them are dead.' + translated = '' + + i = len(message) - 1 + while i >= 0: + translated = translated + message[i] + i = i - 1 + + print(translated) + ===========changed ref 7=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.transpositionDecrypt + + def main(): + myMessage = 'Cenoonommstmme oo snnio. s s c' + myKey = 8 + + plaintext = decryptMessage(myKey, myMessage) + + # Print with a | ("pipe" character) after it in case + # there are spaces at the end of the decrypted message. + print(plaintext + '|') + + pyperclip.copy(plaintext) + ===========changed ref 8=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.vigenereDictionaryHacker + + def main(): + ciphertext = """Tzx isnz eccjxkg nfq lol mys bbqq I lxcz.""" + hackedMessage = hackVigenereDictionary(ciphertext) + + if hackedMessage != None: + print('Copying hacked message to clipboard:') + print(hackedMessage) + pyperclip.copy(hackedMessage) + else: + print('Failed to hack encryption.') + ===========changed ref 9=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.vigenereDictionaryHacker + + + def hackVigenereDictionary(ciphertext): + fo = open('dictionary.txt') + words = fo.readlines() + fo.close() + + for word in words: + word = word.strip() # Remove the newline at the end. + decryptedText = vigenereCipher.decryptMessage(word, ciphertext) + if detectEnglish.isEnglish(decryptedText, wordPercentage=40): + # Check with user to see if the decrypted key has been found: + print() + print('Possible encryption break:') + print('Key ' + str(word) + ': ' + decryptedText[:100]) + print() + print('Enter D for done, or just press Enter to continue breaking:') + response = input('> ') + + if response.upper().startswith('D'): + return decryptedText + ===========changed ref 10=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.transpositionDecrypt + + + def decryptMessage(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 = int(math.ceil(len(message) / float(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 column and row variables point to where in the grid the next + # character in the encrypted message will go. + column = 0 + row = 0 + + for symbol in message: + plaintext[column] += symbol + column += 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 (column == numOfColumns) or (column == numOfColumns - 1 and row >= numOfRows - numOfShadedBoxes): + column = 0 + row += 1 + + return ''.join(plaintext) +
app.Decryptor.basicEncryption.basic_parent/BasicParent.__init__
Modified
Ciphey~Ciphey
326e932fa8e472d9a69c8d47a6f9694dcfab6fdd
fixed serious bug with language checker
<3>:<add> self.viginere = Viginere(self.lc) <4>:<add> self.list_of_objects = [self.caesar, self.reverse, self.viginere] <del> self.list_of_objects = [self.caesar, self.reverse]
# module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def __init__(self, lc): <0> self.lc = lc <1> self.caesar = Caesar(self.lc) <2> self.reverse = Reverse(self.lc) <3> <4> self.list_of_objects = [self.caesar, self.reverse] <5>
===========unchanged ref 0=========== at: Decryptor.basicEncryption.caesar Caesar(lc) at: Decryptor.basicEncryption.reverse Reverse(lc) at: Decryptor.basicEncryption.viginere Viginere(lc) at: app.Decryptor.basicEncryption.basic_parent.BasicParent.decrypt self.lc = self.lc + answer["lc"] ===========changed ref 0=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.rabinMiller + + ===========changed ref 1=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.freqAnalysis + + ===========changed ref 2=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.addNumbers + def addNumbers(a, b): + return a + b + ===========changed ref 3=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.freqAnalysis + + + def getItemAtIndexZero(items): + return items[0] + ===========changed ref 4=========== # module: app.mathsHelper class mathsHelper: + + + def getItemAtIndexZero(self, items): + return items[0] + ===========changed ref 5=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.passingReference + def eggs(someParameter): + someParameter.append('Hello') + ===========changed ref 6=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.transpositionHacker + + if __name__ == '__main__': + main() + ===========changed ref 7=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.vigenereDictionaryHacker + + if __name__ == '__main__': + main() + ===========changed ref 8=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.addNumbers + + spam = addNumbers(2, 40) + print(spam) + ===========changed ref 9=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.passingReference + spam = [1, 2, 3] + eggs(spam) + print(spam) + ===========changed ref 10=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.helloFunction + print('Start!') + hello() + print('Call it again.') + hello() + print('Done.') + ===========changed ref 11=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.helloFunction + def hello(): + print('Hello!') + total = 42 + 1 + print('42 plus 1 is %s' % (total)) + ===========changed ref 12=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.transpositionDecrypt + + + # If transpositionDecrypt.py is run (instead of imported as a module) call + # the main() function. + if __name__ == '__main__': + main() + ===========changed ref 13=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.transpositionFileCipher + + + # If transpositionCipherFile.py is run (instead of imported as a module) + # call the main() function. + if __name__ == '__main__': + main() + ===========changed ref 14=========== # module: app.mathsHelper class mathsHelper: def __init__(self): + self.ETAOIN = 'ETAOINSHRDLCUMWFGYPBVKJXQZ' + self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' - None ===========changed ref 15=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.rabinMiller + + + def generateLargePrime(keysize=1024): + # Return a random prime number that is keysize bits in size. + while True: + num = random.randrange(2**(keysize-1), 2**(keysize)) + if isPrime(num): + return num + ===========changed ref 16=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.freqAnalysis + # Frequency Finder + # https://www.nostarch.com/crackingcodes (BSD Licensed) + + ETAOIN = 'ETAOINSHRDLCUMWFGYPBVKJXQZ' + LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + ===========changed ref 17=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.reverseCipher + # Reverse Cipher + # https://www.nostarch.com/crackingcodes (BSD Licensed) + + message = 'Three can keep a secret, if two of them are dead.' + translated = '' + + i = len(message) - 1 + while i >= 0: + translated = translated + message[i] + i = i - 1 + + print(translated) + ===========changed ref 18=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.transpositionDecrypt + + def main(): + myMessage = 'Cenoonommstmme oo snnio. s s c' + myKey = 8 + + plaintext = decryptMessage(myKey, myMessage) + + # Print with a | ("pipe" character) after it in case + # there are spaces at the end of the decrypted message. + print(plaintext + '|') + + pyperclip.copy(plaintext) + ===========changed ref 19=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.vigenereDictionaryHacker + + def main(): + ciphertext = """Tzx isnz eccjxkg nfq lol mys bbqq I lxcz.""" + hackedMessage = hackVigenereDictionary(ciphertext) + + if hackedMessage != None: + print('Copying hacked message to clipboard:') + print(hackedMessage) + pyperclip.copy(hackedMessage) + else: + print('Failed to hack encryption.') + ===========changed ref 20=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.vigenereDictionaryHacker + + + def hackVigenereDictionary(ciphertext): + fo = open('dictionary.txt') + words = fo.readlines() + fo.close() + + for word in words: + word = word.strip() # Remove the newline at the end. + decryptedText = vigenereCipher.decryptMessage(word, ciphertext) + if detectEnglish.isEnglish(decryptedText, wordPercentage=40): + # Check with user to see if the decrypted key has been found: + print() + print('Possible encryption break:') + print('Key ' + str(word) + ': ' + decryptedText[:100]) + print() + print('Enter D for done, or just press Enter to continue breaking:') + response = input('> ') + + if response.upper().startswith('D'): + return decryptedText +
app.Decryptor.basicEncryption.basic_parent/BasicParent.decrypt
Modified
Ciphey~Ciphey
326e932fa8e472d9a69c8d47a6f9694dcfab6fdd
fixed serious bug with language checker
<13>:<add> print(answer)
# module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def decrypt(self, text): <0> self.text = text <1> <2> from multiprocessing.dummy import Pool as ThreadPool <3> pool = ThreadPool(4) <4> answers = pool.map(self.callDecrypt, self.list_of_objects) <5> <6> """for item in self.list_of_objects: <7> result = item.decrypt(text) <8> answers.append(result)""" <9> for answer in answers: <10> # adds the LC objects together <11> self.lc = self.lc + answer["lc"] <12> if answer["IsPlaintext?"]: <13> return answer <14> return {"lc": self.lc, "IsPlaintext?": False, "Plaintext": None, "Cipher": None, "Extra Information": None} <15>
===========unchanged ref 0=========== at: app.Decryptor.basicEncryption.basic_parent.BasicParent callDecrypt(obj) at: app.Decryptor.basicEncryption.basic_parent.BasicParent.__init__ self.lc = lc self.caesar = Caesar(self.lc) self.reverse = Reverse(self.lc) self.viginere = Viginere(self.lc) at: multiprocessing.dummy Pool(processes: Optional[int]=..., initializer: Optional[Callable[..., Any]]=..., initargs: Iterable[Any]=...) -> Any ===========changed ref 0=========== # module: app.Decryptor.basicEncryption.basic_parent class BasicParent: def __init__(self, lc): self.lc = lc self.caesar = Caesar(self.lc) self.reverse = Reverse(self.lc) + self.viginere = Viginere(self.lc) + self.list_of_objects = [self.caesar, self.reverse, self.viginere] - self.list_of_objects = [self.caesar, self.reverse] ===========changed ref 1=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.rabinMiller + + ===========changed ref 2=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.freqAnalysis + + ===========changed ref 3=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.addNumbers + def addNumbers(a, b): + return a + b + ===========changed ref 4=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.freqAnalysis + + + def getItemAtIndexZero(items): + return items[0] + ===========changed ref 5=========== # module: app.mathsHelper class mathsHelper: + + + def getItemAtIndexZero(self, items): + return items[0] + ===========changed ref 6=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.passingReference + def eggs(someParameter): + someParameter.append('Hello') + ===========changed ref 7=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.transpositionHacker + + if __name__ == '__main__': + main() + ===========changed ref 8=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.vigenereDictionaryHacker + + if __name__ == '__main__': + main() + ===========changed ref 9=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.addNumbers + + spam = addNumbers(2, 40) + print(spam) + ===========changed ref 10=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.passingReference + spam = [1, 2, 3] + eggs(spam) + print(spam) + ===========changed ref 11=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.helloFunction + print('Start!') + hello() + print('Call it again.') + hello() + print('Done.') + ===========changed ref 12=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.helloFunction + def hello(): + print('Hello!') + total = 42 + 1 + print('42 plus 1 is %s' % (total)) + ===========changed ref 13=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.transpositionDecrypt + + + # If transpositionDecrypt.py is run (instead of imported as a module) call + # the main() function. + if __name__ == '__main__': + main() + ===========changed ref 14=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.transpositionFileCipher + + + # If transpositionCipherFile.py is run (instead of imported as a module) + # call the main() function. + if __name__ == '__main__': + main() + ===========changed ref 15=========== # module: app.mathsHelper class mathsHelper: def __init__(self): + self.ETAOIN = 'ETAOINSHRDLCUMWFGYPBVKJXQZ' + self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' - None ===========changed ref 16=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.rabinMiller + + + def generateLargePrime(keysize=1024): + # Return a random prime number that is keysize bits in size. + while True: + num = random.randrange(2**(keysize-1), 2**(keysize)) + if isPrime(num): + return num + ===========changed ref 17=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.freqAnalysis + # Frequency Finder + # https://www.nostarch.com/crackingcodes (BSD Licensed) + + ETAOIN = 'ETAOINSHRDLCUMWFGYPBVKJXQZ' + LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + ===========changed ref 18=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.reverseCipher + # Reverse Cipher + # https://www.nostarch.com/crackingcodes (BSD Licensed) + + message = 'Three can keep a secret, if two of them are dead.' + translated = '' + + i = len(message) - 1 + while i >= 0: + translated = translated + message[i] + i = i - 1 + + print(translated) + ===========changed ref 19=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.transpositionDecrypt + + def main(): + myMessage = 'Cenoonommstmme oo snnio. s s c' + myKey = 8 + + plaintext = decryptMessage(myKey, myMessage) + + # Print with a | ("pipe" character) after it in case + # there are spaces at the end of the decrypted message. + print(plaintext + '|') + + pyperclip.copy(plaintext) + ===========changed ref 20=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.vigenereDictionaryHacker + + def main(): + ciphertext = """Tzx isnz eccjxkg nfq lol mys bbqq I lxcz.""" + hackedMessage = hackVigenereDictionary(ciphertext) + + if hackedMessage != None: + print('Copying hacked message to clipboard:') + print(hackedMessage) + pyperclip.copy(hackedMessage) + else: + print('Failed to hack encryption.') + ===========changed ref 21=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.vigenereDictionaryHacker + + + def hackVigenereDictionary(ciphertext): + fo = open('dictionary.txt') + words = fo.readlines() + fo.close() + + for word in words: + word = word.strip() # Remove the newline at the end. + decryptedText = vigenereCipher.decryptMessage(word, ciphertext) + if detectEnglish.isEnglish(decryptedText, wordPercentage=40): + # Check with user to see if the decrypted key has been found: + print() + print('Possible encryption break:') + print('Key ' + str(word) + ': ' + decryptedText[:100]) + print() + print('Enter D for done, or just press Enter to continue breaking:') + response = input('> ') + + if response.upper().startswith('D'): + return decryptedText +
app.languageCheckerMod.dictionaryChecker/dictionaryChecker.checkDictionary
Modified
Ciphey~Ciphey
326e932fa8e472d9a69c8d47a6f9694dcfab6fdd
fixed serious bug with language checker
<14>:<add> f = [x.strip().lower() for x in f] <del> counter = 0.00 <33>:<add> <add> for dictLengthCounter, word in enumerate(f): <add> # if there is more words counted than there is text <add> # it is 100%, sometimes it goes over <add> # so this stops that <del> for word in f: <36>:<add> # if the dictionary word is contained in the text somewhere <del> if word.strip() == text[counter]: <37>:<add> # counter + 1 <del> counter += 1 <38>:<add> if word in text: <add> counter = counter + 1 <del> counterPercent += 1 <39>:<add> counterPercent = counterPercent + 1
# 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("languageCheckerMod/English.txt", "r") <12> f = file.readlines() <13> file.close() <14> counter = 0.00 <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> counterPercent = 0 <33> for word in f: <34> if counter >= len(text): <35> break <36> if word.strip() == text[counter]: <37> counter += 1 <38> counterPercent += 1 <39> self.languageWordsCounter = counter <40> self.languagePercentage = self.mh.percentage(float(self.languageWordsCounter), float(len</s>
===========below chunk 0=========== # module: app.languageCheckerMod.dictionaryChecker class dictionaryChecker: def checkDictionary(self, text, language): # offset: 1 return(counter) ===========unchanged ref 0=========== at: app.languageCheckerMod.dictionaryChecker.dictionaryChecker.__init__ self.mh = mathsHelper.mathsHelper() at: io.BufferedReader close(self) -> None at: io.TextIOWrapper readlines(self, hint: int=..., /) -> List[str] at: mathsHelper.mathsHelper stripPuncuation(text) at: typing.IO __slots__ = () close() -> None readlines(hint: int=...) -> list[AnyStr] ===========changed ref 0=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.primeNum + + ===========changed ref 1=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.detectEnglish + + ===========changed ref 2=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.cryptomath + + ===========changed ref 3=========== + # module: app.Decryptor.basicEncryption.freqAnalysis + + ===========changed ref 4=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.rabinMiller + + ===========changed ref 5=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.freqAnalysis + + ===========changed ref 6=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.addNumbers + def addNumbers(a, b): + return a + b + ===========changed ref 7=========== + # module: app.Decryptor.basicEncryption.freqAnalysis + + + def getItemAtIndexZero(items): + return items[0] + ===========changed ref 8=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.freqAnalysis + + + def getItemAtIndexZero(items): + return items[0] + ===========changed ref 9=========== # module: app.mathsHelper class mathsHelper: + + + def getItemAtIndexZero(self, items): + return items[0] + ===========changed ref 10=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.passingReference + def eggs(someParameter): + someParameter.append('Hello') + ===========changed ref 11=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.simpleSubDictionaryHacker + + SILENT_MODE = False + ===========changed ref 12=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.detectEnglish + + ENGLISH_WORDS = loadDictionary() + ===========changed ref 13=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.simpleSubDictionaryHacker + + if __name__ == '__main__': + main() + ===========changed ref 14=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.transpositionHacker + + if __name__ == '__main__': + main() + ===========changed ref 15=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.vigenereDictionaryHacker + + if __name__ == '__main__': + main() + ===========changed ref 16=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.makeWordPatterns + + + if __name__ == '__main__': + main() + ===========changed ref 17=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.addNumbers + + spam = addNumbers(2, 40) + print(spam) + ===========changed ref 18=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.passingReference + spam = [1, 2, 3] + eggs(spam) + print(spam) + ===========changed ref 19=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.helloFunction + print('Start!') + hello() + print('Call it again.') + hello() + print('Done.') + ===========changed ref 20=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.helloFunction + def hello(): + print('Hello!') + total = 42 + 1 + print('42 plus 1 is %s' % (total)) + ===========changed ref 21=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.cryptomath + # Cryptomath Module + # https://www.nostarch.com/crackingcodes (BSD Licensed) + + def gcd(a, b): + # Return the Greatest Common Divisor of a and b using Euclid's Algorithm + while a != 0: + a, b = b % a, a + return b + ===========changed ref 22=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.transpositionDecrypt + + + # If transpositionDecrypt.py is run (instead of imported as a module) call + # the main() function. + if __name__ == '__main__': + main() + ===========changed ref 23=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.transpositionFileCipher + + + # If transpositionCipherFile.py is run (instead of imported as a module) + # call the main() function. + if __name__ == '__main__': + main() + ===========changed ref 24=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.detectEnglish + + + def removeNonLetters(message): + lettersOnly = [] + for symbol in message: + if symbol in LETTERS_AND_SPACE: + lettersOnly.append(symbol) + return ''.join(lettersOnly) + ===========changed ref 25=========== # module: app.mathsHelper class mathsHelper: def __init__(self): + self.ETAOIN = 'ETAOINSHRDLCUMWFGYPBVKJXQZ' + self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' - None ===========changed ref 26=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.primeNum + + + def generateLargePrime(keysize=1024): + # Return a random prime number that is keysize bits in size: + while True: + num = random.randrange(2**(keysize-1), 2**(keysize)) + if isPrime(num): + return num + ===========changed ref 27=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.detectEnglish + + def loadDictionary(): + dictionaryFile = open('dictionary.txt') + englishWords = {} + for word in dictionaryFile.read().split('\n'): + englishWords[word] = None + dictionaryFile.close() + return englishWords + ===========changed ref 28=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.rabinMiller + + + def generateLargePrime(keysize=1024): + # Return a random prime number that is keysize bits in size. + while True: + num = random.randrange(2**(keysize-1), 2**(keysize)) + if isPrime(num): + return num + ===========changed ref 29=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.primeNum + + # Most of the time we can quickly determine if num is not prime + # by dividing by the first few dozen prime numbers. This is quicker + # than rabinMiller(), but does not detect all composites. + LOW_PRIMES = primeSieve(100) + ===========changed ref 30=========== + # module: app.Decryptor.basicEncryption.freqAnalysis + # Frequency Finder + # https://www.nostarch.com/crackingcodes (BSD Licensed) + + ETAOIN = 'ETAOINSHRDLCUMWFGYPBVKJXQZ' + LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' +
app.Decryptor.basicEncryption.viginere/Viginere.__init__
Modified
Ciphey~Ciphey
326e932fa8e472d9a69c8d47a6f9694dcfab6fdd
fixed serious bug with language checker
<0>:<add> self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' <add> self.SILENT_MODE = True # If set to True, program doesn't print anything. <add> self.NUM_MOST_FREQ_LETTERS = 4 # Attempt this many letters per subkey. <add> self.MAX_KEY_LENGTH = 16 # Will not attempt keys longer than this. <add> self.NONLETTERS_PATTERN = re.compile('[^A-Z]') <add> <1>:<del> self.MAX_KEY_LENGTH = 16 <2>:<del> self.self.NONself.LETTERS_PATTERN = re.compile('[^A-Z]') <3>:<del> self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' <4>:<del> self.analysis = ""
# module: app.Decryptor.basicEncryption.viginere class Viginere: def __init__(self, lc): <0> self.lc = lc <1> self.MAX_KEY_LENGTH = 16 <2> self.self.NONself.LETTERS_PATTERN = re.compile('[^A-Z]') <3> self.LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' <4> self.analysis = "" <5>
===========changed ref 0=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.primeNum + + ===========changed ref 1=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.detectEnglish + + ===========changed ref 2=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.cryptomath + + ===========changed ref 3=========== + # module: app.Decryptor.basicEncryption.freqAnalysis + + ===========changed ref 4=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.rabinMiller + + ===========changed ref 5=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.freqAnalysis + + ===========changed ref 6=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.pyperclip + + + + # Exceptions + class PyperclipException(RuntimeError): + pass + ===========changed ref 7=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.addNumbers + def addNumbers(a, b): + return a + b + ===========changed ref 8=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.viginere + class Viginere: + + + def getItemAtIndexOne(self, items): + return items[1] + ===========changed ref 9=========== + # module: app.Decryptor.basicEncryption.freqAnalysis + + + def getItemAtIndexZero(items): + return items[0] + ===========changed ref 10=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.freqAnalysis + + + def getItemAtIndexZero(items): + return items[0] + ===========changed ref 11=========== # module: app.mathsHelper class mathsHelper: + + + def getItemAtIndexZero(self, items): + return items[0] + ===========changed ref 12=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.passingReference + def eggs(someParameter): + someParameter.append('Hello') + ===========changed ref 13=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.affineHacker + + SILENT_MODE = False + ===========changed ref 14=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.simpleSubDictionaryHacker + + SILENT_MODE = False + ===========changed ref 15=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.detectEnglish + + ENGLISH_WORDS = loadDictionary() + ===========changed ref 16=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.pyperclip + + + + + # Windows-related clipboard functions: + class CheckedCall(object): + + def __setattr__(self, key, value): + setattr(self.f, key, value) + ===========changed ref 17=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.vigenereCipher + + + def decryptMessage(key, message): + return translateMessage(key, message, 'decrypt') + ===========changed ref 18=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.vigenereCipher + + + def encryptMessage(key, message): + return translateMessage(key, message, 'encrypt') + ===========changed ref 19=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.viginere + class Viginere: + def decryptMessage(self, key, message): + return self.translateMessage(key, message, 'decrypt') + ===========changed ref 20=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.simpleSubDictionaryHacker + + if __name__ == '__main__': + main() + ===========changed ref 21=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.transpositionHacker + + if __name__ == '__main__': + main() + ===========changed ref 22=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.vigenereDictionaryHacker + + if __name__ == '__main__': + main() + ===========changed ref 23=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.pyperclip + + + + + # Windows-related clipboard functions: + class CheckedCall(object): + def __init__(self, f): + super(CheckedCall, self).__setattr__("f", f) + ===========changed ref 24=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.makeWordPatterns + + + if __name__ == '__main__': + main() + ===========changed ref 25=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.addNumbers + + spam = addNumbers(2, 40) + print(spam) + ===========changed ref 26=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.vigenereCipher + + LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + ===========changed ref 27=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.pyperclip + + + def is_available(): + return copy != lazy_load_stub_copy and paste != lazy_load_stub_paste + ===========changed ref 28=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.passingReference + spam = [1, 2, 3] + eggs(spam) + print(spam) + ===========changed ref 29=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.helloFunction + print('Start!') + hello() + print('Call it again.') + hello() + print('Done.') + ===========changed ref 30=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.helloFunction + def hello(): + print('Hello!') + total = 42 + 1 + print('42 plus 1 is %s' % (total)) + ===========changed ref 31=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.pyperclip + + class PyperclipWindowsException(PyperclipException): + def __init__(self, message): + message += " (%s)" % ctypes.WinError() + super(PyperclipWindowsException, self).__init__(message) + ===========changed ref 32=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.transpositionFileHacker + + inputFilename = 'frankenstein.encrypted.txt' + outputFilename = 'frankenstein.decrypted.txt' + ===========changed ref 33=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.pyperclip + + def _executable_exists(name): + return subprocess.call([WHICH_CMD, name], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0 + ===========changed ref 34=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.pyperclip + + + + + # Windows-related clipboard functions: + class CheckedCall(object): + + def __call__(self, *args): + ret = self.f(*args) + if not ret and get_errno(): + raise PyperclipWindowsException("Error calling " + self.f.__name__) + return ret + ===========changed ref 35=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.cryptomath + # Cryptomath Module + # https://www.nostarch.com/crackingcodes (BSD Licensed) + + def gcd(a, b): + # Return the Greatest Common Divisor of a and b using Euclid's Algorithm + while a != 0: + a, b = b % a, a + return b + ===========changed ref 36=========== + # module: app.Decryptor.basicEncryption.CrackingCodesFiles.transpositionDecrypt + + + # If transpositionDecrypt.py is run (instead of imported as a module) call + # the main() function. + if __name__ == '__main__': + main() +