Skip to content

Commit 540e890

Browse files
Add files via upload
1 parent 38aeacb commit 540e890

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

utils/injection.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,15 @@ def inject_file(arr:np.ndarray, file:bytes, filename:bytes, store_random:bool) -
6767
arr_flat[0] = store_bits(arr_flat[0], mod_bits, max_mod_bits_mask)
6868

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

73-
# Use zip to inject values in channels, using base_mask
77+
# Use zip to inject information in channels, using base_mask
78+
print(ctxt("\nInjecting information...", Fore.MAGENTA))
7479
arr_flat[1:] = [
7580
store_bits(channel, val, base_mask) for channel, val in zip(
7681
arr_flat[1:],

0 commit comments

Comments
 (0)