void CryptData::SetKey20(const char *Password) { InitCRC32(CRCTab); char Psw[MAXPASSWORD]; strncpyz(Psw,Password,ASIZE(Psw)); // We'll need to modify it below. size_t PswLength=strlen(Psw); Key20[0]=0xD3A3B879L; Key20[1]=0x3F6D12F7L; Key20[2]=0x7515A235L; Key20[3]=0xA4E7F123L; memcpy(SubstTable20,InitSubstTable20,sizeof(SubstTable20)); for (int J=0;J<256;J++) for (size_t I=0;I<PswLength;I+=2) { uint N1=(byte)CRCTab [ (byte(Password[I]) - J) &0xff]; uint N2=(byte)CRCTab [ (byte(Password[I+1]) + J) &0xff]; for (int K=1;N1!=N2;N1=(N1+1)&0xff,K++) Swap20(&SubstTable20[N1],&SubstTable20[(N1+I+K)&0xff]); } // Incomplete last block of password must be zero padded. if ((PswLength & CRYPT_BLOCK_MASK)!=0) for (size_t I=PswLength;I<=(PswLength|CRYPT_BLOCK_MASK);I++) Psw[I]=0; for (size_t I=0;I<PswLength;I+=CRYPT_BLOCK_SIZE) EncryptBlock20((byte *)Psw+I); }
extern "C" __declspec(dllexport) int Load(void) { mir_getLP(&pluginInfo); InitCRC32(); Icon_Register(hInst, "fileAsMessage", iconList, SIZEOF(iconList)); hFileList = WindowList_Create(); CreateServiceFunction(SERVICE_NAME PSR_MESSAGE, OnRecvMessage); CreateServiceFunction(SERVICE_NAME "/FESendFile", OnSendFile); CreateServiceFunction(SERVICE_NAME "/FERecvFile", OnRecvFile); PROTOCOLDESCRIPTOR pd = { sizeof(pd) }; pd.szName = SERVICE_NAME; pd.type = PROTOTYPE_FILTER; CallService(MS_PROTO_REGISTERMODULE, 0, ( LPARAM ) &pd); HookEvent(ME_OPT_INITIALISE, OnOptInitialise); HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); hHookDbSettingChange = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnSettingChanged); hHookSkinIconsChanged = NULL; return 0; }