Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

Max Payne 1/2 (*.RAS) Snippet of code (Decryption)

Featured Replies

  • Author
  • Localization

Ekey, posted Mon Jul 04, 2016 5:28 pm (15018)


Part of code for decrypt RAS archives from game Max Payne 1/2 (Android / PC). Maybe usefull for someone :)

Code:
struct RASHeader
{
   DWORD dwID;
   DWORD dwSeed;
};


Code:
void DecryptWithSeed(unsigned char *pBuffer, int dwSize, int dwSeed)
{
   if (!dwSeed)
      dwSeed = 1;

   if (dwSize > 0)
   {
      char wSeed = 18;
      char pTemp;
      for (int i = 0; i       {
         dwSeed = -2 * (dwSeed / 177) 171 * (dwSeed % 177);
         pTemp = ((pBuffer[i] > (8 - i % 5))) ^ wSeed;
         wSeed = 6;
         pBuffer[i] = pTemp dwSeed;
      }
   }
}
  • Author
  • Localization

aluigi, posted Tue Jul 05, 2016 3:12 pm (15036)


Well done:
http://aluigi.org/bms/max_payne_ras.bms

The header is visible but now the last step will be to undertand that decrypted data that probably has a second pass of encryption or it's encrypted using a different seed.
  • Author
  • Localization

Ekey, posted Tue Jul 05, 2016 6:30 pm (15045)


Here my test tool for decrypt header and file table sample of archive inside. In the fact header must be 0x2C bytes and encrypted only 0x24 bytes from 0x8 position.

Edited: Attached variant 2 :)

MPRASDecrypt-v2-src.rar

MPRASDecrypt-src-bin.rar

  • Author
  • Localization

aluigi, posted Tue Jul 05, 2016 10:37 pm (15058)


Script 0.2, complete extraction :D
  • Author
  • Localization

Ekey, posted Tue Jul 05, 2016 11:30 pm (15063)


Cool :D
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.