Created
April 4, 2017 22:58
-
-
Save bunnylab/70be2831afdd16c8bb9540b5f1c96950 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string.h> | |
#include <thread> | |
#include <unordered_map> | |
const int THREAD_MAX = 8; | |
std::unordered_map<char,char> leet = {{'a','@'},{'e','3'},{'l','1'},{'o','0'},{'s','$'}}; | |
void leetify(char* input, int start, int step){ | |
std::unordered_map<char,char>::iterator it; | |
while(start<strlen(input)){ | |
it = leet.find(*(input+start)); | |
if(it != leet.end()){ | |
*(input+start) = (*it).second; | |
} | |
start+=step; | |
} | |
} | |
int main(int argc, char *argv[]){ | |
if(argc < 2){ | |
std::cout << "Requires an Input String" << std::endl; | |
return 0; | |
} | |
char* input = argv[1]; | |
std::thread t[THREAD_MAX]; | |
for(int x=0; x<THREAD_MAX; x++){ | |
t[x] = std::thread(leetify,input,x,THREAD_MAX); | |
} | |
for(int x=0; x<THREAD_MAX; x++){ | |
t[x].join(); | |
} | |
std::cout << input << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment