-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHideText.m
More file actions
28 lines (26 loc) · 713 Bytes
/
HideText.m
File metadata and controls
28 lines (26 loc) · 713 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function hidden = HideText(input,vector)
% this function hides a text message in the LSB of elements of a 1d array
% inputs:
% input - 1d array
% vector - character vecotr containing message to hide
% outputs:
% hidden - 1d array containing hidden message
hidden = input; % assign
% get binary
totalbit = [];
for i = 1:length(vector)
vectorbit = Char2ByteArray(vector(i));
totalbit = [totalbit, vectorbit];
end
for i = 1:length(totalbit)
specificbit = totalbit(i);
if specificbit == 1
if mod(input(i),2) == 0
hidden(i) = input(i) + 1;
end
else
if mod(input(i),2) == 1
hidden(i) = input(i) - 1;
end
end
end