def encode(**kwargs): if kwargs['key'] is None and kwargs['key_raw'] is None: raise Exceptions.NoKeyException() io = IOManager(**kwargs) arr = CryptAlghorithm.crypt_class(kwargs['algorithm']).encrypt( io.input_arr, io.key_arr) io.push(arr)
def raw_src_mode(caller: EncryptorApp): kwargs = { 'key_raw': str(caller.var1_keyraw.displayText()), 'img': str(caller.var1_img.displayText()), 'useimg': False, 'key': None, 'crypt': 'encode', 'src': os.path.realpath(__file__), 'dest': caller.var1_dest.displayText() } raw_src = str(caller.var1_textArea.toPlainText()) if kwargs['img'] != '': if not os.path.isfile(kwargs['img']): raise Exceptions.BadImageFileException() kwargs['useimg'] = True arr = CryptAlghorithm.crypt_class(caller.cryptType.currentIndex()).encrypt( bytearray(raw_src, sys.stdin.encoding), bytearray(kwargs['key_raw'], sys.stdin.encoding)) io = IOManager(**kwargs) io.push(arr)