valaphee / mcrputil

Minecraft Resource Pack Util for encrypting and decrypting resource packs.
https://valaphee.com/article/1-minecraft-resource-pack-util/
Apache License 2.0
108 stars 14 forks source link

Errorr decrypt: thread 'main' panicked at 'range end index 16 out of range for slice of length 0', src\main.rs:206:68 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace #13

Closed kroast2432423 closed 7 months ago

kroast2432423 commented 1 year ago

For some reason, this error does not occur on all packs.

Full error:

C:\Users\user>mcrputil decrypt "C:\Users\user\Desktop\ecnrypted\tLZvZLcpRwE=" "C:\Users\user\Desktop\decrypted\tLZvZLcpRwE="
Decrypted contents.json with key 7JNkV1d4NK0aWq51U1jkGdgNiYC5fcJq
thread 'main' panicked at 'range end index 16 out of range for slice of length 0', src\main.rs:206:68
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

C:\Users\user>

Key and source pack are in the same directory and everything is fine with them Screenshot_145

valaphee commented 1 year ago

Heya, what's the content of your key file?

kroast2432423 commented 1 year ago

image

valaphee commented 1 year ago

The error you posted, means that your key file was empty (length=0)

The file should only contain 32 characters (a-Z,0.9) - no newline or anything else

xxAROX commented 1 year ago

Got same error:

thread 'main' panicked at 'range end index 16 out of range for slice of length 0', src\main.rs:206:68
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

mcrputil.exe decrypt -k BpLnfgDsc2WD8F2qNfHK5a84jjJkwzDk C:\Users\kfeig\Documents\Development\xxAROX\packs\127.0.0.1\encrypted_example\ C:\Users\kfeig\Documents\Development\xxAROX\packs\127.0.0.1\ExamplePack\


encrypted files in this pack: grafik

NOTE:

valaphee commented 1 year ago

Ah I looked at wrong revision,

I'll add a skip for files which are not decryptable / have an invalid length key. But might also be worth checking out what the default behavior is when a key is not complete, might either be using the previous key, be zero-padded or random.