mi5hmash / LimebrellaSharp

Unpack, Pack & Resign files encrypted with the 1st version of "Lime" encryption.
The Unlicense
23 stars 2 forks source link

Street Fighter 6 format issue #2

Closed marconett closed 1 year ago

marconett commented 1 year ago

Hi!

I stumbled upon this repo while researching the Street Fighter 6 save game format. I haven't heard about Lime encryption before and can't find any other resource on the format. Are you aware of any?

Street Fighter 6 seems to use this format. However, LimebrellaSharp crashes once I try to load the win64_save folder into it (see below).

Here's the Hex header of data00-1.bin: 44535353 02000000 04000000. I suppose encryption type 0x04 is not supported yet?

If you're interested (and it's possible to decrypt this), i can send you my steamID + the save game.

Thanks!

System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at LimebrellaSharpCore.Helpers.LimeDeencryptor.EncryptionFirst(Span`1& containerA, ReadOnlySpan`1 containerB)
   at LimebrellaSharpCore.Helpers.LimeDeencryptor.Limegator(Span`1 containerA, ReadOnlySpan`1 containerB, ReadOnlySpan`1 containerC)
   at LimebrellaSharpCore.Helpers.LimeDeencryptor.HashPublicKeys(Span`1& segmentHashedKey, ReadOnlySpan`1 cKey1, ReadOnlySpan`1 cSteamId, ReadOnlySpan`1 limeBank)
   at LimebrellaSharpCore.Helpers.LimeDeencryptor.Limetree(DsssLimeFile limeFile, UInt64 steamId, Boolean encrypt)
   at LimebrellaSharp.Form1.<>c__DisplayClass18_1.<UnpackAll>b__1(Int64 ctr)
   at System.Threading.Tasks.Parallel.<>c__DisplayClass20_0`1.<ForWorker64>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Parallel.<>c__DisplayClass20_0`1.<ForWorker64>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
   at System.Threading.Tasks.TaskReplicator.Replica.Execute()
mi5hmash commented 1 year ago

Hi! Lime is a codename of a custom encryption developed by Capcom and so far I've only seen it in PC version of the recent Resident Evil 4 Remake. Street Fighter 6 is using other custom encryption called "Citrus". Unfortuntely, my tool does not support encryption types other than Lime. Currently I have no plans to examine it and if I ever will then I would rather make a different tool with another cool name like Sweet Citrus Six. Sorry, I couldn't be more helpfull.

marconett commented 1 year ago

That's fair, thanks for the quick reply. Still, can you point me to any resource regarding Citrus encryption? Or even how you identified this as Citrus?

mi5hmash commented 1 year ago

Sure, here is how I did it. First I downloaded REFramework by praydog from that repo and copied its content to a game folder. From what I can see, SF6 is also supported by it. After I run the game, in the cheat menu that appeared, I navigated to DeveloperTools>ObjectExplorer>NativeSingletons>via.storage.SaveService.SaveService>Reflection Properties>SaveEncryptionType. There you can read "Citrus". If you go deeper to Additional Information>via.storage.SaveService.SaveDataEncryptionType>TDB Fields, then you can find the enumerator with all possible encryption types. That's how I found their names. Sadly, I am not aware of the existence of any resources or documentation of the Citrus encryption. If you only want to use your SaveData on another Steam account then it may be possible without decrypting that file.

marconett commented 1 year ago

thank you for telling me :)

windwakr commented 7 months ago

Monster Hunter Rise also uses this format. I took a peek but didn't learn much other than the last four bytes in the file are a murmur3_32 hash(seed = 0xFFFFFFFF) over the rest of the file.

mi5hmash commented 7 months ago

@windwakr Thank you for identifying the hash's name. I will rename the function and give you credit in the comment. Regarding MH Rise, the SaveData files from 2022 that I found on the Internet were already decrypted so I didn't bother. I installed the latest version of the game, and now its SaveData files look like they were encrypted with the Cytric method. 8 bytes before murmur3_32 hash is the length of the decrypted data.