CS计算机代考程序代写 #include

#include
#include
#include
#include

char* sha256sum(char* string)
{
unsigned char digest[32] = {0};
char* digest_str = malloc(65);
memset(digest_str, 0, 33);
MD5((unsigned char*)string, strlen(string), digest);

for (int i = 0; i < 32; ++i) { sprintf(digest_str + i * 2, "%02x", digest[i]); } return digest_str; } int check_flag(char* flag) { char* checksum = sha256sum(flag); if (!memcmp(checksum, "7bf46ad61adc2265f803fc3b798b3559ffc92c458b8c2fae185c283126663580", 32)) { return 0; } return 1; } int main(int argc, char** argv) { char flag[1024]; printf("%s\nInput flag: ", argv[0]); scanf("%s", flag); if (!check_flag(flag)) { puts("Congrats!"); } else { puts("Wrong flag :<"); } }