资源简介
一种流密码,通过LFSR实现流密码的产生,JK实现非线性
代码片段和文件信息
#include
#include
unsigned char fn_feedback(int n//级数为n,假若为5
unsigned char c//参数C1C2C3C4C5组合成c
unsigned char curr_state)//初始状态
{
unsigned char t = c & curr_state;//实现了c1&k1c2&k2c3&k3c4&k4c5&k5
unsigned char s = t & (unsigned char)128;//get first bit s实现的是cj&kj的异或 即反馈多项式
// (unsigned char)128=“10000000“进行位于,就能够分离出cj&kj了
for(int i =1; i< n; i++)
{
s = s ^ ( (t << i) & (unsigned char)128 );// cj&kj一个个进行异或
}
return (unsigned char)((curr_state << 1) | (s >> 7)); //return next state接下来的状态便是上一状态整体向右位移1位,
//在或上s向右位移7位,因为s的形式是“10000000或者00000000”
}
void lfsr_output_byte(int n
unsigned char c
unsigned char init_state
unsigned char output_bytes[]
int byte_length)//多
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-12-08 11:15 stream_Cipher\
目录 0 2013-12-08 11:10 stream_Cipher\Debug\
文件 8643 2013-12-08 11:10 stream_Cipher\Debug\stream.obj
文件 9456 2013-12-08 11:10 stream_Cipher\Debug\stream_Cipher.lib
文件 187232 2013-12-08 11:02 stream_Cipher\Debug\stream_Cipher.pch
文件 41984 2013-12-08 11:10 stream_Cipher\Debug\vc60.idb
文件 61440 2013-12-08 11:10 stream_Cipher\Debug\vc60.pdb
文件 1732 2013-12-08 11:10 stream_Cipher\stream.cpp
文件 458 2013-12-08 11:02 stream_Cipher\stream.h
文件 1259 2013-12-08 11:08 stream_Cipher\stream_C.cpp
文件 2966 2013-12-08 11:15 stream_Cipher\stream_Cipher.dsp
文件 534 2013-12-06 10:06 stream_Cipher\stream_Cipher.dsw
文件 41984 2013-12-08 11:15 stream_Cipher\stream_Cipher.ncb
文件 48640 2013-12-08 11:15 stream_Cipher\stream_Cipher.opt
文件 800 2013-12-08 11:10 stream_Cipher\stream_Cipher.plg
- 上一篇:VQ+MFCC话者识别代码,可运行!
- 下一篇:自动售货机源代码,c++
评论
共有 条评论