필터 지우기
필터 지우기

how to encode a bit sequences with key?

조회 수: 1 (최근 30일)
Pham Ngoc Thanh
Pham Ngoc Thanh 2013년 8월 2일
how to encode bit sequences with a key, before embedded into an images ( to enhance the secure) , then extracted and decode with this key to return the first sequences.

채택된 답변

Walter Roberson
Walter Roberson 2013년 8월 2일
nK = 17; %for example, length of key
key_sequence = round(rand(1,nK)); %example key
nB = 50; %for example, length of bit sequence
bit_sequence = round(rand(1,nB)); %example bits
new_bits = zeros(1, nB);
for J = 1 : nB
new_bits(J) = xor( bit_sequence(J), key_sequence(mod(J-1, nK)+1) ); %xor with key
end

추가 답변 (0개)

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by