关键代码
pthread_t thread[FLAG_LEN]; char differences[FLAG_LEN] = {0, 9, -9, -1, 13, -13, -4, -11, -9, -1, -7, 6, -13, 13, 3, 9, -13, -11, 6, -7}; char *arguments[20]; for (i = 0; i < FLAG_LEN; i++) { arguments[i] = (char *)malloc(3*sizeof(char)); arguments[i][0] = first_letter; arguments[i][1] = differences[i]; arguments[i][2] = user_string[i]; pthread_create((pthread_t*)(thread+i), NULL, checking, arguments[i]); } int initialization_number; int i; char generated_string[FLAG_LEN + 1]; generated_string[FLAG_LEN] = '\0'; while ((initialization_number = random()) >= 64); int first_letter; first_letter = (initialization_number % 26) + 97
生成第一个字母:通过随机数生成一个字母 first_letter
,范围在小写字母 a
到 z
之间。
#include <iostream> using namespace std; int main() { char differences[20] = {0, 9, -9, -1, 13, -13, -4, -11, -9, -1, -7, 6, -13, 13, 3, 9, -13, -11, 6, -7}; int just_a_string[20] = {115, 116, 114, 97, 110, 103, 101, 95, 115, 116, 114, 105, 110, 103, 95, 105, 116, 95, 105, 115}; char a[100]={0}; for(int i=0;i<20;i++) { a[i]=0^(108+differences[i]); cout <<a[i]; } return 0; }
lucky_hacker_you_are