mixslice.py
def encrypt(data, path, key, iv, threads=None, padder=None):
        """Creates a MixSlice from plaintext data.

        Args:
            data (bytestr): The data to encrypt (multiple of MACRO_SIZE).
            key (bytestr): The key used for AES encryption (16 bytes long).
            iv (bytestr): The iv used for AES encryption (16 bytes long).
            threads (int): The number of threads used. (default: cpu count).

        Returns:
            A new MixSlice that holds the encrypted fragments.
        """
        padder = padder or _Padder(blocksize=MixSlice.MACRO_SIZE)
        padded_data = padder.pad(data)
        fragments = _mix_and_slice(data=padded_data, key=key,
                                   iv=iv, threads=threads)
        fragments = [_BytesIO(f) for f in fragments]

        if not _os.path.exists(path):
            _os.makedirs(path)

        name = "frag_%%0%dd.dat" % len(str(len(fragments)))
        for fragid in range(len(fragments)):
            fragment = fragments[fragid]
            assert isinstance(fragment, _BytesIO)
            fragment.seek(0)
            destination = _os.path.join(path, name % fragid)
            with open(destination, "wb") as fp:
                _shutil.copyfileobj(fragment, fp)
            fragment.close()
Creates a MixSlice from plaintext data.

        Args:
            data (bytestr): The data to encrypt (multiple of MACRO_SIZE).
            key (bytestr): The key used for AES encryption (16 bytes long).
            iv (bytestr): The iv used for AES encryption (16 bytes long).
            threads (int): The number of threads used. (default: cpu count).

        Returns:
            A new MixSlice that holds the encrypted fragments.
        
Creates a MixSlice from plaintext data.
Creates a MixSlice from plaintext data .
def encrypt(data, path, key, iv, threads=None, padder=None):
        padder = padder or _Padder(blocksize=MixSlice.MACRO_SIZE)
        padded_data = padder.pad(data)
        fragments = _mix_and_slice(data=padded_data, key=key,
                                   iv=iv, threads=threads)
        fragments = [_BytesIO(f) for f in fragments]
        if not _os.path.exists(path):
            _os.makedirs(path)
        name = "frag_%%0%dd.dat" % len(str(len(fragments)))
        for fragid in range(len(fragments)):
            fragment = fragments[fragid]
            assert isinstance(fragment, _BytesIO)
            fragment.seek(0)
            destination = _os.path.join(path, name % fragid)
            with open(destination, "wb") as fp:
                _shutil.copyfileobj(fragment, fp)
            fragment.close()
def encrypt ( data , path , key , iv , threads = None , padder = None ) : padder = padder or _Padder ( blocksize = MixSlice . MACRO_SIZE ) padded_data = padder . pad ( data ) fragments = _mix_and_slice ( data = padded_data , key = key , iv = iv , threads = threads ) fragments = [ _BytesIO ( f ) for f in fragments ] if not _os . path . exists ( path ) : _os . makedirs ( path ) name = "frag_%%0%dd.dat" % len ( str ( len ( fragments ) ) ) for fragid in range ( len ( fragments ) ) : fragment = fragments [ fragid ] assert isinstance ( fragment , _BytesIO ) fragment . seek ( 0 ) destination = _os . path . join ( path , name % fragid ) with open ( destination , "wb" ) as fp : _shutil . copyfileobj ( fragment , fp ) fragment . close ( )
Creates a MixSlice from plaintext data.
Creates a MixSlice from plaintext data .
"""Creates a MixSlice from plaintext data.

        Args:
            data (bytestr): The data to encrypt (multiple of MACRO_SIZE).
            key (bytestr): The key used for AES encryption (16 bytes long).
            iv (bytestr): The iv used for AES encryption (16 bytes long).
            threads (int): The number of threads used. (default: cpu count).

        Returns:
            A new MixSlice that holds the encrypted fragments.
        """
A new MixSlice that holds the encrypted fragments.
A new MixSlice that holds the encrypted fragments .
data
The data to encrypt (multiple of MACRO_SIZE).
The data to encrypt ( multiple of MACRO_SIZE ) .
path
key
The key used for AES encryption (16 bytes long).
The key used for AES encryption ( 16 bytes long ) .
iv
The iv used for AES encryption (16 bytes long).
The iv used for AES encryption ( 16 bytes long ) .
threads
The number of threads used. (default: cpu count).
The number of threads used . ( default : cpu count ) .
padder