|
|
|
|
|
|
|
|
PadBuffer snfNETmgr::OneTimePad(int Len) { // Get Len bytes of one time pad. |
|
|
PadBuffer snfNETmgr::OneTimePad(int Len) { // Get Len bytes of one time pad. |
|
|
PadBuffer B; // Start with a buffer. |
|
|
PadBuffer B; // Start with a buffer. |
|
|
B.reserve(Len); // Reserve Len bytes. |
|
|
B.reserve(Len); // Reserve Len bytes. |
|
|
unsigned char x; // Get an unsigned char, unknown value. |
|
|
|
|
|
|
|
|
unsigned char x = PadGenerator.Encrypt(0); // Get an unexposed byte to start with. |
|
|
for(int a = 0; a < Len; a++) { // Create Len bytes of pad by evolving |
|
|
for(int a = 0; a < Len; a++) { // Create Len bytes of pad by evolving |
|
|
B.push_back(x = PadGenerator.Encrypt(x)); // x through itself and copying the |
|
|
B.push_back(x = PadGenerator.Encrypt(x)); // x through itself and copying the |
|
|
} // data into the buffer. |
|
|
} // data into the buffer. |