Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
carlospuenteg committed Nov 17, 2022
1 parent 38aeacb commit 540e890
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions utils/injection.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,15 @@ def inject_file(arr:np.ndarray, file:bytes, filename:bytes, store_random:bool) -
arr_flat[0] = store_bits(arr_flat[0], mod_bits, max_mod_bits_mask)

# Generate random values
print(ctxt("\nGenerating random values...", Fore.MAGENTA))
end_idx = 1 + len(file_size_conv) + len(filename_conv) + len(file_conv)
if store_random: rands = np.random.randint(low = 0, high=base, size=arr_flat.size - end_idx)
if store_random:
rands = np.random.randint(low = 0, high=base, size=arr_flat.size - end_idx)
else:
rands = np.zeros(arr_flat.size - end_idx, dtype=arr.dtype)

# Use zip to inject values in channels, using base_mask
# Use zip to inject information in channels, using base_mask
print(ctxt("\nInjecting information...", Fore.MAGENTA))
arr_flat[1:] = [
store_bits(channel, val, base_mask) for channel, val in zip(
arr_flat[1:],
Expand Down

0 comments on commit 540e890

Please sign in to comment.