Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #ifdef _WIN32
- #include <Windows.h>
- #else
- #include <unistd.h>
- #endif
- int main()
- {
- char userInput[15];
- char *encryptedKey;
- char doubleuserInput[30], firstarray[30], secondarray[30];
- int i, iswrong;
- int delaytime;
- void delay(unsigned int);
- encryptedKey = "OHDSVXHIVAEBMRMXDPAAEIXTFQJZYB";
- delaytime = 1000;
- fgets(userInput, 16, stdin);
- #ifdef _WIN32
- Sleep(delaytime);
- #else
- usleep(delaytime * 1000);
- #endif
- for(i = 0; i < sizeof(doubleuserInput); i++)
- {
- doubleuserInput[i] = userInput[i%sizeof(userInput)];
- }
- for(i = 0; i < sizeof(userInput); i++)
- {
- firstarray[2*i] = ((userInput[i] - 65 + 12)%26) + 65;
- firstarray[2*i + 1] = ((userInput[i] - 65 + 15)%26) + 65;
- }
- printf("\n");
- for(i=0; i < sizeof(firstarray); i++)
- {
- secondarray[i] = (((firstarray[i] - 65) + (doubleuserInput[i] - 65)) % 26) + 65;
- }
- for(i = 0; i < sizeof(secondarray); i++)
- {
- printf("%c", secondarray[i]);
- }
- iswrong = 0;
- for(i = 0; i < sizeof(secondarray); i++)
- {
- if(!(secondarray[i] == *(encryptedKey + i)))
- {
- iswrong = 1;
- }
- }
- if(iswrong == 1)
- printf("Nop, dat is m niet");
- if(iswrong == 0)
- printf("Proof is in the key");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement