lfsr.m

来自「vigenere密码解密的matlab实现」· M 代码 · 共 17 行

M
17
字号
function y = lfsr(c,k,n);% This function generates a sequence of n bits produced by the linear feedback% recurrence relation that is governed by the coefficient vector c.% The initial values of the bits are given by the vector ky=zeros(1,n);kln=length(k);for j=1:n,   if j<=kln,      y(j)=k(j);   else      reg=y(j-kln:j-1);      y(j)=mod(reg*c',2);      end;   end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?