Browse Source

MANGLER to Mangler - conformity

master
Pete McNeil 3 years ago
parent
commit
b1feb64ab9
2 changed files with 8 additions and 8 deletions
  1. 6
    6
      mangler.cpp
  2. 2
    2
      mangler.hpp

+ 6
- 6
mangler.cpp View File

@@ -20,7 +20,7 @@

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
} // value.

@@ -32,7 +32,7 @@ unsigned char MANGLER::ChaosDriver(void) { // Return the current
// value of Position and determining the final output value and the Position
// value itself is used to add complexity to the output.

unsigned char MANGLER::Rotate(unsigned char i) { // Bitwise rotates i
unsigned char Mangler::Rotate(unsigned char i) { // Bitwise rotates i
return (
(i & 0x80)? // This operation is
(i<<1)+1: // described without
@@ -40,7 +40,7 @@ unsigned char MANGLER::Rotate(unsigned char i) { // Bitwise rotates i
);
}

void MANGLER::ChaosDriver(unsigned char i) { // Drives chaos engine.
void Mangler::ChaosDriver(unsigned char i) { // Drives chaos engine.

// First we move our mixing position in the fill buffer forward.

@@ -86,21 +86,21 @@ void MANGLER::ChaosDriver(unsigned char i) { // Drives chaos engine.
// same state with the same fill data characteristics or else the two
// chaotic systems evolve to further divergent states.

unsigned char MANGLER::Encrypt(unsigned char i) {
unsigned char Mangler::Encrypt(unsigned char i) {
unsigned char g = ChaosDriver() ^ i; // Take the output of the
ChaosDriver(g); // chaos engine and use it
return g; // to moduleate the input.
} // Then drive the engine
// with the encrypted data.

unsigned char MANGLER::Decrypt(unsigned char i) {
unsigned char Mangler::Decrypt(unsigned char i) {
unsigned char g = ChaosDriver() ^ i; // Take the output of the
ChaosDriver(i); // chaos engine and use it
return g; // to demodulate the input.
} // then drive the engine
// 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
Fill[c]=(unsigned char) c; // value and Position to 0.
}

+ 2
- 2
mangler.hpp View File

@@ -11,7 +11,7 @@

namespace codedweller {

class MANGLER {
class Mangler {
private:

unsigned char Fill[256]; // Where to store the fill.
@@ -27,7 +27,7 @@ class MANGLER {
unsigned char Encrypt(unsigned char i); // Returns encrypted data.
unsigned char Decrypt(unsigned char i); // Returns decrypted data.

MANGLER(void); // Default.
Mangler(void); // Default.
};

} // End namespace codedweller

Loading…
Cancel
Save