Keepass2android: Argon2 is extremely slow

Created on 19 Mar 2018  路  6Comments  路  Source: PhilippC/keepass2android

Seeing as KeepassXC implemented Argon2, finally, I set my database to use it.

Unfortunately, the implementation of Argon2 in Keepass2Android makes it take 40 seconds to do what my computer does in 1, and what KeepassDroid can do in about 5. Why's that happening if this app is based on KeepassDroid?

This is exclusive to Argon2.

Argon2 settings are 40 transform rounds, 64 MiB, 8 threads.

Most helpful comment

Read this: https://github.com/PhilippC/keepass2android/issues/283
and this: https://sourceforge.net/p/keepass/discussion/329220/thread/acfd14b1/#711f/7bdc/a9f5

Also if that is true (KeepassDroid does it in 5) it means the native implementation is way faster.
@PhilippC can you please replace the C# implementation of argon2 with the native one?: https://github.com/bpellin/keepassdroid/tree/master/app/src/main/jni/argon2/src

All 6 comments

Read this: https://github.com/PhilippC/keepass2android/issues/283
and this: https://sourceforge.net/p/keepass/discussion/329220/thread/acfd14b1/#711f/7bdc/a9f5

Also if that is true (KeepassDroid does it in 5) it means the native implementation is way faster.
@PhilippC can you please replace the C# implementation of argon2 with the native one?: https://github.com/bpellin/keepassdroid/tree/master/app/src/main/jni/argon2/src

Is there any progress on this? It's really painful to wait ~30 seconds every time when opening the database (quickunlock is only a workaround when not rebooting the phone), while it takes 1 sec on a PC and a few seconds with other apps like https://github.com/Kunzisoft/KeePassDX (which I believe is a fork of KeepassDroid and uses the native C implementation).

What takes 1s on my overclocked i9 9900k takes MINUTES on Nexus 6p.
My settings are 70 rounds, 64MiB memory, 16 threads.

As others said, KeePassDX doesn't have such issue, opens database in few seconds.

Do something about this, please, opening database or making any changes is insanely slow.

I am not a C# developer, nor did I compare C# argon implementations, but if using the native implementation is too much hassle, maybe using another existing C# implementation would be faster? e.g.

(edit: I am having the same issue with KP2A + Argon2 as others that commented, with Keepass DX it takes ~3 seconds to open my file(s), with KP2A it takes ~12 - Android 9 / Pixel 2)

I tested KeePass DX and on it the DB file is opened pretty fast if Argon2 is used.
It's also open source on github, but still in beta. Maybe you could borrow the Argon2 implementation and apply it to KP2A? :)

I managed to speed up unlocking my Argon2 database by introducing the reference C implementation. The patch is #872 and a debug build can be found at https://chyen.cc/pub/keepass2android.keepass2android_debug-Signed.apk (removed as the fix is included in official 1.07 APK). That package is actually 1.06f + the Argon2 patch as the keyboard does not work for me in 1.07 (https://github.com/PhilippC/keepass2android/issues/871).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wikholm picture wikholm  路  4Comments

Zhaph picture Zhaph  路  4Comments

tgp1994 picture tgp1994  路  4Comments

metafarion picture metafarion  路  5Comments

andschwa picture andschwa  路  3Comments