数据擦除算法

 

====================================================================

DoD 5220.22-M算法:

 

char dod [7];

typedef struct 

{

int   length;  

char* s;       

} dwipe_pattern_t

 

}

 

覆盖填充七次,定义dod元素值

dwipe_pattern_t patterns [] =

{

{  1, &dod[0] }, /* Pass 1: A random character.               */

{  1, &dod[1] }, /* Pass 2: The bitwise complement of pass 1. */

{ -1, ""      }, /* Pass 3: A random stream.                  */

{  1, &dod[3] }, /* Pass 4: A random character.               */

{  1, &dod[4] }, /* Pass 5: A random character.               */

{  1, &dod[5] }, /* Pass 6: The bitwise complement of pass 5. */

{ -1, ""      }, /* Pass 7: A random stream.                  */

{  0, NULL   }

};

 

随机读取元素存放入dod

 

r = read( c->entropy_fd, &dod, sizeof( dod ) );

 

把dod第1个元素反补后放入dod[1]

dod[1] = ~ dod[0];

 

把dod第4个元素反补后放入dod[5]

dod[5] = ~ dod[4];

 

当patterns[i].length == 0,什么都不做    //{  0, NULL   }

当patterns[i].length > 0,把dod中相应某个元素填充磁盘区域,直到填满    // 如{  1, &dod[0] },{  1, &dod[1] }

当patterns[i].length < 0,调用用随机数填充   //{ -1, ""  }

 

====================================================================

 

DoD Short算法:

 

覆盖填充三次

dwipe_pattern_t patterns [] =

{

{  1, &dod[0] }, /* Pass 1: A random character.               */

{  1, &dod[1] }, /* Pass 2: The bitwise complement of pass 1. */

{ -1, ""      }, /* Pass 3: A random stream.                  */

{  0, NULL   }

};

 

随机读取元素存放入dod

 

r = read( c->entropy_fd, &dod, sizeof( dod ) );

 

把dod第1个元素反补后放入dod[1]

dod[1] = ~ dod[0];

 

当patterns[i].length == 0,什么都不做    //{  0, NULL   }

当patterns[i].length > 0,把dod中相应某个元素填充磁盘区域,直到填满    // 如{  1, &dod[0] },{  1, &dod[1] }

当patterns[i].length < 0,调用用随机数填充   //{ -1, ""  }

 

====================================================================

 

Gutmann算法:

 

覆盖填充35次

dwipe_pattern_t book [] =

{

{ -1, ""             }, /* Random pass.                                      */

{ -1, ""             }, /* Random pass.                                      */

{ -1, ""             }, /* Random pass.                                      */

{ -1, ""             }, /* Random pass.                                      */

{  3, "/x55/x55/x55" }, /* Static pass: 0x555555  01010101 01010101 01010101 */

{  3, "/xAA/xAA/xAA" }, /* Static pass: 0XAAAAAA  10101010 10101010 10101010 */

{  3, "/x92/x49/x24" }, /* Static pass: 0x924924  10010010 01001001 00100100 */

{  3, "/x49/x24/x92" }, /* Static pass: 0x492492  01001001 00100100 10010010 */

{  3, "/x24/x92/x49" }, /* Static pass: 0x249249  00100100 10010010 01001001 */

{  3, "/x00/x00/x00" }, /* Static pass: 0x000000  00000000 00000000 00000000 */

{  3, "/x11/x11/x11" }, /* Static pass: 0x111111  00010001 00010001 00010001 */

{  3, "/x22/x22/x22" }, /* Static pass: 0x222222  00100010 00100010 00100010 */

{  3, "/x33/x33/x33" }, /* Static pass: 0x333333  00110011 00110011 00110011 */

{  3, "/x44/x44/x44" }, /* Static pass: 0x444444  01000100 01000100 01000100 */

{  3, "/x55/x55/x55" }, /* Static pass: 0x555555  01010101 01010101 01010101 */

{  3, "/x66/x66/x66" }, /* Static pass: 0x666666  01100110 01100110 01100110 */

{  3, "/x77/x77/x77" }, /* Static pass: 0x777777  01110111 01110111 01110111 */

{  3, "/x88/x88/x88" }, /* Static pass: 0x888888  10001000 10001000 10001000 */

{  3, "/x99/x99/x99" }, /* Static pass: 0x999999  10011001 10011001 10011001 */

{  3, "/xAA/xAA/xAA" }, /* Static pass: 0xAAAAAA  10101010 10101010 10101010 */

{  3, "/xBB/xBB/xBB" }, /* Static pass: 0xBBBBBB  10111011 10111011 10111011 */

{  3, "/xCC/xCC/xCC" }, /* Static pass: 0xCCCCCC  11001100 11001100 11001100 */

{  3, "/xDD/xDD/xDD" }, /* Static pass: 0xDDDDDD  11011101 11011101 11011101 */

{  3, "/xEE/xEE/xEE" }, /* Static pass: 0xEEEEEE  11101110 11101110 11101110 */

{  3, "/xFF/xFF/xFF" }, /* Static pass: 0xFFFFFF  11111111 11111111 11111111 */

{  3, "/x92/x49/x24" }, /* Static pass: 0x924924  10010010 01001001 00100100 */

{  3, "/x49/x24/x92" }, /* Static pass: 0x492492  01001001 00100100 10010010 */

{  3, "/x24/x92/x49" }, /* Static pass: 0x249249  00100100 10010010 01001001 */

{  3, "/x6D/xB6/xDB" }, /* Static pass: 0x6DB6DB  01101101 10110110 11011011 */

{  3, "/xB6/xDB/x6D" }, /* Static pass: 0xB6DB6D  10110110 11011011 01101101 */

{  3, "/xDB/x6D/xB6" }, /* Static pass: 0XDB6DB6  11011011 01101101 10110110 */

{ -1, ""             }, /* Random pass.                                      */

{ -1, ""             }, /* Random pass.                                      */

{ -1, ""             }, /* Random pass.                                      */

{ -1, ""             }, /* Random pass.                                      */

{ 0, NULL }

};

当patterns[i].length == 0,什么都不做    //{  0, NULL   }

当patterns[i].length > 0,把dod中相应十六进制填充磁盘区域,直到填满    // 如{  1, "/xB6/xDB/x6D" },{  3, "/xDB/x6D/xB6" },

当patterns[i].length < 0,调用用随机数填充   //{ -1, ""  }

====================================================================

 

你可能感兴趣的:(算法,struct,null,Random,磁盘)