def check_answer(self,answer): for i in range(0, len(self.hotspots)): if(caesar_util.caeser_encrypt(self.plaintext[self.hotspots[i]], self.key) == answer['char_%i' % i]): # DR7, DR8 continue else: return False return True
def __init__(self,question_library_path,question_path): config = file_util.dynamic_import(os.path.join( question_library_path,question_path,'cqg_config.py')) self.question_library_path = question_library_path self.question_path = question_path self.plaintext = config.plaintext self.key = config.key self.hotspots = config.hotspots self.ciphertext = caesar_util.caeser_encrypt(self.plaintext, self.key)
def test_caesar_cipher(test_name, P, C, K): quick_assert(test_name, caesar_util.caeser_encrypt(P, K), C)