void _main_sink(char * cryptokey){{HCRYPTPROV cryptoprov;HCRYPTKEY key;HCRYPTHASH hash;DWORD toBeEncryptedLen=strlen(toBeEncrypted)*sizeof(char);if(!CryptAcquireContext(&cryptoprov, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, 0)){if(!CryptAcquireContext(&cryptoprov, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_NEWKEYSET)){printLine("Error in acquiring cryptographic context");exit(1);}}if(!CryptCreateHash(cryptoprov, CALG_SHA1, 0, 0, &hash)){printLine("Error in creating hash");exit(1);}if(!CryptHashData(hash, (BYTE *) cryptokey, strlen(cryptokey)*sizeof(char), 0)){printLine("Error in hashing cryptokey");exit(1);}if(!CryptDeriveKey(cryptoprov, CALG_3DES, hash, 0, &key)){printLine("Error in CryptDeriveKey");exit(1);}if(!CryptEncrypt(key, (HCRYPTHASH)NULL, 1, 0, (BYTE *)toBeEncrypted, &toBeEncryptedLen, sizeof(toBeEncrypted))){printLine("Error in CryptEncryptData");exit(1);}printLine(toBeEncrypted);}}void _main(){char * cryptokey;char cryptokey_buf[100]="";cryptokey=cryptokey_buf;strcpy(cryptokey, CRYPTOKEY);_main_sink(cryptokey);}
void _main_sink(char * cryptokey){{HCRYPTPROV cryptoprov;HCRYPTKEY key;HCRYPTHASH hash;DWORD toBeEncryptedLen=strlen(toBeEncrypted)*sizeof(char);if(!CryptAcquireContext(&cryptoprov, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, 0)){if(!CryptAcquireContext(&cryptoprov, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_NEWKEYSET)){printLine("Error in acquiring cryptographic context");exit(1);}}if(!CryptCreateHash(cryptoprov, CALG_SHA1, 0, 0, &hash)){printLine("Error in creating hash");exit(1);}if(!CryptHashData(hash, (BYTE *) cryptokey, strlen(cryptokey)*sizeof(char), 0)){printLine("Error in hashing cryptokey");exit(1);}if(!CryptDeriveKey(cryptoprov, CALG_3DES, hash, 0, &key)){printLine("Error in CryptDeriveKey");exit(1);}if(!CryptEncrypt(key, (HCRYPTHASH)NULL, 1, 0, (BYTE *)toBeEncrypted, &toBeEncryptedLen, sizeof(toBeEncrypted))){printLine("Error in CryptEncryptData");exit(1);}printLine(toBeEncrypted);}}static void main(){char * cryptokey;char cryptokey_buf[100]="";cryptokey=cryptokey_buf;{size_t cryptokey_len=strlen(cryptokey);if(100-cryptokey_len > 1){fgets(cryptokey+cryptokey_len, (int)(100-cryptokey_len), stdin);cryptokey_len=strlen(cryptokey);if (cryptokey_len > 0){cryptokey[cryptokey_len-1]='\0';}}}_main_sink(cryptokey);}