|
|
|
|
|
|
|
|
// MANGLER.CPP |
|
|
// MANGLER.CPP |
|
|
// |
|
|
// |
|
|
// (C) 1984-2009 MicroNeil Research Corporation |
|
|
|
|
|
|
|
|
// (C) 1984-2020 MicroNeil Research Corporation |
|
|
// Derived from Version 1 of Mangler Encryption Algorythm, 1984. |
|
|
// Derived from Version 1 of Mangler Encryption Algorythm, 1984. |
|
|
// Derived from Version 2 of Mangler Encryption Algorythm, 1998. |
|
|
// Derived from Version 2 of Mangler Encryption Algorythm, 1998. |
|
|
// |
|
|
// |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "mangler.hpp" |
|
|
#include "mangler.hpp" |
|
|
|
|
|
|
|
|
|
|
|
namespace codedweller { |
|
|
|
|
|
|
|
|
unsigned char MANGLER::ChaosDriver(void) { // Return the current |
|
|
unsigned char MANGLER::ChaosDriver(void) { // Return the current |
|
|
return Fill[Fill[Position]^Fill[Position^0xff]]; // chaos engine output |
|
|
return Fill[Fill[Position]^Fill[Position^0xff]]; // chaos engine output |
|
|
} // value. |
|
|
} // value. |
|
|
|
|
|
|
|
|
return g; // to demodulate the input. |
|
|
return g; // to demodulate the input. |
|
|
} // then drive the engine |
|
|
} // then drive the engine |
|
|
// with the original input. |
|
|
// with the original input. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MANGLER::MANGLER(void) : Position(0) { // The default constructor sets |
|
|
MANGLER::MANGLER(void) : Position(0) { // The default constructor sets |
|
|
for(unsigned int c = 0;c<256;c++) // the key to the root primary |
|
|
for(unsigned int c = 0;c<256;c++) // the key to the root primary |
|
|
Fill[c]=(unsigned char) c; // value and Position to 0. |
|
|
Fill[c]=(unsigned char) c; // value and Position to 0. |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // End namespace codedweller |