|
|
00111111111111111111111111111111 10011111111111111111111111111111 11001111111111111111111111111111 01100111111111111111111111111111 00110011111111111111111111111111 10011001111111111111111111111111 01001100111111111111111111111111 00100110011111111111111111111111 10010011001111111111111111111111 11001001100111111111111111111111 11100100110011111111111111111111 01110010011001111111111111111111 00111001001100111111111111111111 00011100100110011111111111111111 10001110010011001111111111111111 Period: 15 data: 1111 key: 0110 encode: ├ ╓¤ decode: 1111 |
prog2222 wrote: |
---|
Although, in theory, the result of the calculation should be 0110 ^ 1111. What is the problem? |
|
|
Binary representation of the number 1: 00000001 Binary representation of the charecter 1: 00110001 Binary representation of a bit pattern: 00000110 ------------------------------------------------------------- Plain text: The quick brown fox jumped over the lazy dog. Cypher text: ‼→Y&→♣♣,R♂8↑☻F!↔↔Y=→☺▬"▬E▬! ▲F3→Y;♫▬▼g▬ ▲y Decoded text: The quick brown fox jumped over the lazy dog. |
#include <bits/stdc++.h> |
|
|
Data string: 12345ABcdef 00110001 00110010 00110011 00110100 00110101 01000001 01000010 01100011 01100100 01100101 01100110 Key string: 5 00000100 00000111 00000110 00000001 00000000 01110100 01110111 01010110 01010001 01010000 01010011 00110001 00110010 00110011 00110100 00110101 01000001 01000010 01100011 01100100 01100101 01100110 1 2 3 4 5 A B c d e f Program ended with exit code: 0 |
00110001 - '1' 00110101 - '5' ======== - ^ 00000100 - result |
Thank. I just use 00000101 before. Not ascii |
|
|
|
|
|
|
Data string: Hello 01001000 01100101 01101100 01101100 01101111 Key: 01100100 TRUE:00101100 10001010 10000100 11011011 11110000 10100001 |
|
|
Data string: 12345ABcdef 00000000000000110001 00000000000000110010 00000000000000110011 00000000000000110100 00000000000000110101 00000000000001000001 00000000000001000010 00000000000001100011 00000000000001100100 00000000000001100101 00000000000001100110 Key string: 11011011001100111010 11011011001100001011 11011011001100001000 11011011001100001001 11011011001100001110 11011011001100001111 11011011001101111011 11011011001101111000 11011011001101011001 11011011001101011110 11011011001101011111 11011011001101011100 00000000000000110001 00000000000000110010 00000000000000110011 00000000000000110100 00000000000000110101 00000000000001000001 00000000000001000010 00000000000001100011 00000000000001100100 00000000000001100101 00000000000001100110 1 2 3 4 5 A B c d e f Program ended with exit code: 0 |
|
|
|
|
prog2222 wrote: |
---|
But I have any problems else... Now this code give me key2 like 0110... but when I use std::bitset<1>(kye2) for zero I have 0. When I use std::bitset<8>(kye2) for zero I have 11000010. And results of ^ is true. |
|
|
Testing LFSR... 1 0 1 0 0 1 0 1 0 0 0 1 0 0 1 0 1 1 0 1 0 0 0 1 1 0 0 1 1 1 0 0 1 1 1 1 0 0 0 1 1 0 1 1 0 0 0 0 1 0 0 0 1 0 1 1 1 0 1 0 1 1 1 1 0 1 1 0 1 1 1 1 1 0 0 0 0 1 1 0 1 0 0 1 1 0 1 0 1 1 0 1 1 0 1 0 1 0 0 0 0 0 1 0 0 1 1 1 0 1 1 0 0 1 0 0 1 0 0 1 1 0 0 0 0 0 0 1 1 1 0 1 0 0 1 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 1 0 1 1 0 0 0 1 1 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 1 0 0 0 0 1 0 1 0 0 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 0 0 0 0 0 1 1 0 0 0 1 0 1 0 1 1 0 0 1 1 0 0 1 0 1 1 1 1 1 1 0 1 1 1 1 0 0 1 1 0 1 1 1 0 1 1 1 0 0 1 0 8-bit LFSR period: 255 Bit 0 of 10100101 1 Bit 1 of 10100101 0 Bit 2 of 10100101 1 Bit 3 of 10100101 0 Bit 4 of 10100101 0 Bit 5 of 10100101 1 Bit 6 of 10100101 0 Bit 7 of 10100101 1 Generated key_8: 10100101 as char Ñ Generated key_char: 10100101 as char Ñ Generated key_32: 10100101000100101101000110011100 |
|
|
Plain text: Hello to you! What are you doing today? 1234567890/# Encoded plain text: 000000001001000 000000001100101 000000001101100 000000001101100 000000001101111 000000000100000 000000001110100 000000001101111 000000000100000 000000001111001 000000001101111 000000001110101 000000000100001 000000000100000 000000001010111 000000001101000 000000001100001 000000001110100 000000000100000 000000001100001 000000001110010 000000001100101 000000000100000 000000001111001 000000001101111 000000001110101 000000000100000 000000001100100 000000001101111 000000001101001 000000001101110 000000001100111 000000000100000 000000001110100 000000001101111 000000001100100 000000001100001 000000001111001 000000000111111 000000000100000 000000000110001 000000000110010 000000000110011 000000000110100 000000000110101 000000000110110 000000000110111 000000000111000 000000000111001 000000000110000 000000000101111 000000000100011 Key: 110010001101011 010010110111000 110101001011001 100010010100001 111100000010101 101110110001101 011001101010000 110000001101011 100001101101100 101000100000101 100000011100001 001000110110101 010101011100011 111101111110011 001111000001011 Encrypted: 110010000100011 010010111011101 110101000110101 100010011001101 111100001111010 101110110101101 011001100100100 110000000000100 100001101001100 101000101111100 100000010001110 001000111000000 010101011000010 111101111010011 001111001011100 110010000000011 010010111011001 110101000101101 100010010000001 111100001110100 101110111111111 011001100110101 110000001001011 100001100010101 101000101101010 100000010010100 001000110010101 010101010000111 111101110011100 001111001100010 110010000000101 010010111011111 110101001111001 100010011010101 111100001111010 101110111101001 011001100110001 110000000010010 100001101010011 101000100100101 100000011010000 001000110000111 010101011010000 111101111000111 001111000111110 110010001011101 010010110001111 110101001100001 100010010011000 111100000100101 101110110100010 011001101110011 Decrypted: 000000001001000 000000001100101 000000001101100 000000001101100 000000001101111 000000000100000 000000001110100 000000001101111 000000000100000 000000001111001 000000001101111 000000001110101 000000000100001 000000000100000 000000001010111 000000001101000 000000001100001 000000001110100 000000000100000 000000001100001 000000001110010 000000001100101 000000000100000 000000001111001 000000001101111 000000001110101 000000000100000 000000001100100 000000001101111 000000001101001 000000001101110 000000001100111 000000000100000 000000001110100 000000001101111 000000001100100 000000001100001 000000001111001 000000000111111 000000000100000 000000000110001 000000000110010 000000000110011 000000000110100 000000000110101 000000000110110 000000000110111 000000000111000 000000000111001 000000000110000 000000000101111 000000000100011 Encrypted text: #\3355\315z\255$L|\216\300\302\323\\331-\201t\3775K&j\224\225 \207\234b\337y\325z\3511S%Ї\320\307>]\217a\230%\242s Plain text: Hello to you! What are you doing today? 1234567890/# Program ended with exit code: 0 |
|
|
Testing LFSR... 1 0 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... ... |
|
|
Testing LFSR... 1 0 1 0 0 1 0 |