敏感数据的嵌入算法描述如下:
#define N 0x0100; //阀值
typedef BitStream TInputBitStream; //定义输入二进制流
typedef Uint16Stream TInputUintStream; //定义输入无符号整数流
typedef Uint16Stream TOutputUintStream;//定义输出无符号整数流
//---------------------------------------
/** 用敏感数据初始化输入二进制流 **/
TInputBitStream * TheIBS=
new TInputBitStream(SensitiveData aData);
/** 用传感数据初始化输入无符号整数流**/
TInputUintStream * TheIUS=
new TInputUintStream(SensorData aData);
/** 用空数据初始化输出无符号整数流 **/
TOutputUintStream * TheOUS=new TOutputUintStream();
//------------------------------------
/** 数字水印嵌入方法
** 注意:本方法假定输入整数流的长度
*足以嵌入所有的敏感数据
* 参数TheIBS: 输入二进制流
* 参数TheIUS:输入无符号整数流
* 参数N:预先定义的阀值
* 返回值:输出无符号整数流TheOUS **/
TOutputUintStream* InsertWaterMarking(TheIBS,TheIUS,N)
{
uint16_t TheUintIndex=0; //用于保存输入整数流的位号
uint16_t TheBitIndex=0; //用于保存输入二进制流的位号
uint16_t CurrentUintData; //用于保存当前的无符号整数值
bit_t CurrentBitData; //用于保存当前的二进制值
while(TheBitIndex<TheIBS.Size)
{
CurrentUintData=TheIUS.Read(TheUintIndex,1);
CurrentBitData=TheIBS.Read(TheBitIndex,1);
/**若当前无符号整数值小于阀值,则读取下一个值,
*直到大于阀值时,停止循环 **/