def _create_round_samplesets(self): state = { 'knownalphabet': self._round.knownalphabet, 'knownsecret': self._round.knownsecret } self._round.batch += 1 self._round.save() candidate_alphabets = self._build_candidates(state) alignmentalphabet = '' if self._round.check_block_align(): alignmentalphabet = list( self._round.victim.target.alignmentalphabet) random.shuffle(alignmentalphabet) alignmentalphabet = ''.join(alignmentalphabet) logger.debug('\tAlignment alphabet: {}'.format(alignmentalphabet)) for candidate in candidate_alphabets: SampleSet.create_sampleset({ 'round': self._round, 'candidatealphabet': candidate, 'alignmentalphabet': alignmentalphabet, 'batch': self._round.batch })
def _create_round_samplesets(self): state = { 'knownalphabet': self._round.knownalphabet, 'knownsecret': self._round.knownsecret } self._round.batch += 1 self._round.save() candidate_alphabets = self._build_candidates(state) alignmentalphabet = '' if self._round.check_block_align(): alignmentalphabet = list(self._round.victim.target.alignmentalphabet) random.shuffle(alignmentalphabet) alignmentalphabet = ''.join(alignmentalphabet) logger.debug('\tAlignment alphabet: {}'.format(alignmentalphabet)) for candidate in candidate_alphabets: SampleSet.create_sampleset({ 'round': self._round, 'candidatealphabet': candidate, 'alignmentalphabet': alignmentalphabet, 'batch': self._round.batch })
def _handle_sampleset_success(self, capture, sampleset): '''Save capture of successful sampleset or mark sampleset as failed and create new sampleset for the same element that failed.''' if capture: sampleset.success = True sampleset.data = capture['data'] sampleset.records = capture['records'] sampleset.save() else: SampleSet.create_sampleset({ 'round': self._round, 'candidatealphabet': sampleset.candidatealphabet, 'alignmentalphabet': sampleset.alignmentalphabet, 'batch': sampleset.batch })
def _handle_sampleset_success(self, capture, sampleset): '''Save capture of successful sampleset or mark sampleset as failed and create new sampleset for the same element that failed.''' if capture: sampleset.success = True sampleset.data = capture['data'] sampleset.records = capture['records'] sampleset.save() else: SampleSet.create_sampleset({ 'round': self._round, 'candidatealphabet': sampleset.candidatealphabet, 'alignmentalphabet': sampleset.alignmentalphabet, 'batch': sampleset.batch })