Narigo / keepass-diff

A CLI-tool to diff Keepass (.kdbx) files. Useful, if syncing with Dropbox or NextCloud and getting multiple files due to conflicts.
https://keepass-diff.narigo.dev/
MIT License
306 stars 28 forks source link

Does not work with KDBX 3.1 format #24

Closed pludi closed 3 years ago

pludi commented 4 years ago

What is happening

When comparing databases with at least 1 having a KDBX 3.1 DB format, keepass-diff apparently enters an infinite loop

What should happen

Output of the differences.

Steps to reproduce

  1. Create 2 databases, explicitly selecting KDBX 3.1 format
  2. Compare them using keepass-diff without any special options

Versions used

Narigo commented 4 years ago

Thanks for the report @pludi ! Could you create reproducer files for this? This sounds like a limitation of the underlying keepass-rs dependency and it probably should be addressed there. Still, we might want to add a test for this scenario in here.

pludi commented 4 years ago

Had to gzip them to get past GitHubs filter.

Test1.kdbx.gz, Password: Test1 Test2.kdbx.gz, Password: Test2

Narigo commented 4 years ago

Hmm, works for me but takes 5 minutes or so with RUSTFLAGS="-C target-cpu=native". From my debugging, it looks like it has a very high number of transformation_rounds in the headers of the files, so it runs the encryption very often. This needs to be addressed in keepass-rs, so I have opened issue 25.

Narigo commented 4 years ago

@pludi maybe you want to re-check with version 1.0.1 now. It should have the rustflags set already. It's still slow but I could at least use it on your test files. I have added the test files to the tests as well now, to see that they can be opened.

pludi commented 3 years ago

Ran it after compiling with the optimization RUSTFLAGS you've posted:

time ~/git/personal/keepass-diff/target/release/keepass-diff --password-a Test1 --password-b Test2 Test1.kdbx Test2.kdbx
- [Root, Test1]
+ [Root, Test2]

~/git/personal/keepass-diff/target/release/keepass-diff --password-a Test1     5,61s user 0,00s system 99% cpu 5,610 total

Quite a lot better :+1:

Narigo commented 3 years ago

Okay, I will close this now, the tests run way better in the newest version, with the flags set in .cargo/config.toml.