Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #define BUFSIZE 100
- const char *message =
- " "
- "Mr. Watson, come here. I want to see you."
- " ";
- char buffer[BUFSIZE];
- typedef unsigned char byte;
- byte next_LFSR() {
- static byte LFSR = 0xFF;
- byte a = (LFSR & 1 << 3) >> 3;
- byte b = (LFSR & 1 << 4) >> 4;
- byte c = (LFSR & 1 << 5) >> 5;
- byte d = (LFSR & 1 << 7) >> 7;
- byte n = a ^ b ^ c ^ d;
- LFSR <<= 1;
- LFSR |= n;
- return LFSR;
- }
- void setup() {
- strncpy(buffer, message, strlen(message));
- }
- int main() {
- setup();
- int len = strlen(message);
- int j = 0;
- for (int i = len; i < len + len; i++) {
- buffer[i] = buffer[j++] ^ next_LFSR();
- }
- printf("%s\n", buffer);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement