Comments (7)
Hmm, that used to work, so I guess we broke it. I need to look at that later today,
Thanks for reporting! :)
Which version of xoreos-tools are you using? I.e. a release package, a recent git checkout, ... unerf --version
should tell you more if you're not certain.
from xoreos-tools.
Ah, sorry, I should have included that! Here you go:
xoreos-tools 0.0.5+0.gaed64a2 [0.0.5+0.gaed64a2] (2018-07-03T12:39:22Z)
from xoreos-tools.
Ah, yeah, I see the problem.
The password, as a decimal number, is 1234567890. However, due to how the digest is calculated and how both the Neverwinter Nights premium modules and Dragon Age 2 handle their ERF encryption and digests, my thought of unifying that was that our unerf tool should expect the hexadecimal representation of the string "1234567890".
So the password that our unerf tool wants is 31323334353637383930, which is the string in hexadecimal form.
I.e.
$ echo -n 1234567890 | hexdump -C
00000000 31 32 33 34 35 36 37 38 39 30 |1234567890|
0000000a
Yes, that is quite confusing, I know. I guess we should at least document that better, in the --help text and in the man page?
Or possibly, handle this a bit better and less confusingly. --password
should probably be more context sensitive and do the unsurprising thing depending on the version of the ERF file given. And then add --password-number
, --password-text
and --password-hex
so that you can explictly override the format if necessary.
Does that sound sensible?
from xoreos-tools.
Ah, that makes sense!
I think any approach would work (documentation - with an example / determining how to handle the password dynamically based on the version / or option to specify the password format).
Personally, as a user, I would probably prefer it to take password the same way as DA:O Toolset, so I wouldn't need to worry about the dec-str-hex gymnastics every time.
As a programmer, I would probably want something very consistent across games / versions. A question here, is the content actually encrypted with 0x31323334353637383930
key? Or is it encrypted with 0x499602D2
? If it's the former, then using 31323334353637383930 is perfectly reasonable. If it is the latter - like the toolset wiki seems to describe it, then there is no way to really avoid confusion (as md5 hash is of a decimal string, while the password is really a bigint).
- Generate random number (represented as string, base 10), such as "12345678".
- Generate digest of the string (without null-terminating character) using MD5 and store it in the header.
- Convert those digits to 64-bit integer (0x0000000000BC614E).
- Store it in byte array in little-endian encoding (0x4E, 0x61, 0xBC, 0x00, 0x00, 0x00, 0x00, 0x00).
- Use that array as key to initialize Blowfish.
In any event, at least now that I know what it expects, it is not a blocker anymore. Thanks for the explanation!
from xoreos-tools.
A question here, is the content actually encrypted with
0x31323334353637383930
key? Or is it encrypted with0x499602D2
?
It's a bit more complicated.
The MD5 digest is calculated using the string "1234567890", i.e. 0x31323334353637383930.
But for the actual compression, the number 1234567890 is treated as a little-endian uint64_t, and that is the key. I.e. the decompression key is the 8-byte array containing { 0xD2, 0x02, 0x96, 0x49, 0x00, 0x00, 0x00, 0x00 }
.
Again, that's just for Dragon Age: Origins. Dragon Age 2 is less weird there.
from xoreos-tools.
For Dragon Age 2, the key is just plain old bytes. The NWN premium key is also plain old bytes, but part of the key is the MD5 hash of the main MOD file.
Basically, that's why I thought the unified password parameter would be plain old bytes as well, with the string being the "natural" form, since that's used for the digest. And it's probably the easiest specifying a plain old byte array as hex on the comment line. That was my thought-process, at least.
from xoreos-tools.
I think the simplest solution would be to just keep the current behavior and treat this as a documentation improvement. Iβd say a DA:O specific example in the βhelp and man would suffice. Conversion is easy, just adding 30 to each digit is simple enough as long as the user remembers to.
from xoreos-tools.
Related Issues (20)
- xml2gff not included in xoreos-tools-0.0.5 release? HOT 7
- XML2GFF: Tool needs to be game/encoding aware HOT 1
- XML2GFF: Serialize color codes HOT 7
- NCSDIS: Control flow analysis failure in do-loop nested in while-loop HOT 15
- NCSDIS: Analyse control flow for recursive functions, and functions with incompatible fork merging HOT 1
- FEATURE: Compile xoreos-tools as a DLL/library HOT 6
- FEATURE: Make more tools read stdin for input HOT 5
- FEATURE: "File picker" for RIM/ERF/MOD files HOT 9
- ERF: MOD files have incorrect prefix HOT 4
- ERF: Recursion leads to infinite loop HOT 1
- Clarify XML format for xml2gff HOT 1
- GFF2XML -> XML2GFF (invalid base64 length) HOT 5
- UNOBB: Add support for KotOR2 Android obb archives HOT 29
- Issue running configure to build project: Syntax error near unexpected token `FT2 HOT 3
- xml2gff: NWN:EE invalid file format HOT 12
- error while compiling HOT 6
- another error while compiling HOT 1
- FEATURE: Add tool to convert TGA back to TPC
- CONVERT2DA: Code and documentation mismatch for the parameters HOT 5
- xml2tlk gives error when trying convert back cp1251 xml HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xoreos-tools.