def getInfo(self, ctext: str) -> CrackInfo: if self.keysize is not None: analysis = self.cache.get_or_update( ctext, f"vigenere::{self.keysize}", lambda: cipheycore.analyse_string( ctext.lower(), self.keysize, self.group ), ) val = cipheycore.vigenere_detect(analysis, self.expected) logging.info(f"Vigenere has likelihood {val}") return CrackInfo( success_likelihood=val, # TODO: actually calculate runtimes success_runtime=1e-3, failure_runtime=1e-2, ) likely_lens = self.cache.get_or_update( ctext, "vigenere::likely_lens", lambda: cipheycore.vigenere_likely_key_lens( ctext.lower(), self.expected, self.group, self.detect_p_value ), ) # Filter out the lens that make no sense likely_lens = [i for i in likely_lens if i.len <= self.max_key_length] for keysize in likely_lens: # Store the analysis analysis = self.cache.get_or_update( ctext, f"vigenere::{keysize.len}", lambda: keysize.tab ) if len(likely_lens) == 0: return CrackInfo( success_likelihood=0, # TODO: actually calculate runtimes success_runtime=2e-3, failure_runtime=2e-2, ) logging.info( f"Vigenere has likelihood {likely_lens[0].p_value} with lens {[i.len for i in likely_lens]}" ) return CrackInfo( success_likelihood=likely_lens[0].p_value, # TODO: actually calculate runtimes success_runtime=2e-4, failure_runtime=2e-4, )
def getInfo(self, ctext: str) -> CrackInfo: return CrackInfo( success_likelihood=0.1, # TODO: actually calculate runtimes success_runtime=1e-8, failure_runtime=1e-8, )
def getInfo(self, ctext: T) -> CrackInfo: # TODO calculate these properly return CrackInfo( success_likelihood=0.5, success_runtime=5, failure_runtime=5, )
def getInfo(self, ctext: str) -> CrackInfo: if self.keysize is not None: analysis = self.cache.get_or_update( ctext, f"vigenere::{self.keysize}", lambda: cipheycore.analyse_string(ctext, self.keysize, self. group), ) return CrackInfo( success_likelihood=cipheycore.vigenere_detect( analysis, self.expected), # TODO: actually calculate runtimes success_runtime=1e-4, failure_runtime=1e-4, ) likely_lens = self.cache.get_or_update( ctext, f"vigenere::likely_lens", lambda: cipheycore.vigenere_likely_key_lens( ctext, self.expected, self.group, self.p_value), ) for keysize in likely_lens: # Store the analysis analysis = self.cache.get_or_update(ctext, f"vigenere::{keysize.len}", lambda: keysize.tab) if len(likely_lens) == 0: return CrackInfo( success_likelihood=0, # TODO: actually calculate runtimes success_runtime=2e-4, failure_runtime=2e-4, ) return CrackInfo( success_likelihood=0 * likely_lens[0].p_value, # TODO: actually calculate runtimes success_runtime=2e-4, failure_runtime=2e-4, )
def getInfo(self, ctext: T) -> CrackInfo: if self.keysize is not None: analysis = self.cache.get_or_update( ctext, f"vigenere::{self.keysize}", lambda: cipheycore.analyse_string(ctext, self.keysize, self.group), ) return CrackInfo( success_likelihood=cipheycore.vigenere_detect(analysis, self.expected), # TODO: actually calculate runtimes success_runtime=1e-4, failure_runtime=1e-4, ) else: return CrackInfo( success_likelihood=0.5, # TODO: actually work this out # TODO: actually calculate runtimes success_runtime=1e-4, failure_runtime=1e-4, )
def getInfo(self, ctext: str) -> CrackInfo: analysis = self.cache.get_or_update( ctext, "cipheycore::simple_analysis", lambda: cipheycore.analyse_string(ctext), ) return CrackInfo( success_likelihood=cipheycore.caesar_detect(analysis, self.expected), # TODO: actually calculate runtimes success_runtime=1e-5, failure_runtime=1e-5, )
def getInfo(self, ctext: bytes) -> CrackInfo: if self.keysize is not None: analysis = self.cache.get_or_update( ctext, f"xorcrypt::{self.keysize}", lambda: cipheycore.analyse_string(ctext, self.keysize, self. group), ) return CrackInfo( success_likelihood=cipheycore.xorcrypt_detect( analysis, self.expected), # TODO: actually calculate runtimes success_runtime=1e-4, failure_runtime=1e-4, ) keysize = self.cache.get_or_update( ctext, f"xorcrypt::likely_lens", lambda: cipheycore.xorcrypt_guess_len(ctext), ) if keysize == 1: return CrackInfo( success_likelihood=0, # TODO: actually calculate runtimes success_runtime=2e-3, failure_runtime=2e-2, ) return CrackInfo( success_likelihood=0.9, # Dunno, but it's quite likely # TODO: actually calculate runtimes success_runtime=2e-3, failure_runtime=2e-2, )
def getInfo(self, ctext: str) -> CrackInfo: return CrackInfo( success_likelihood=0.1, success_runtime=1e-5, failure_runtime=1e-5, )