Skip to content

the speed of the methos named SQLiteDatabase.openOrCreateDatabase became slower now at version 3.0.1 #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cczscq opened this issue Jan 8, 2014 · 6 comments

Comments

@cczscq
Copy link

cczscq commented Jan 8, 2014

When I used sqlcipher at version 2.x,openOrCreateDatabase spent 180 millisecond.
Now for the kitkat, I update sqlcipher to version 3.0.1.
At this version, the speed is about 1800+.I do not find what has changed. Maybe some changes have affected it. Do you test the method between these versions? Please give me some advice to optimize it. Thanks.

@developernotes
Copy link
Member

Hello cczscq,

The kdf iteration length was changed from 4,000 to 64,000 in the 3.0.0 release of SQLCipher. This change increases the security, however does increase the amount of time required to derive the key upon opening the database. More information about the release can be found in our blog post covering the release.

@cczscq
Copy link
Author

cczscq commented Jan 9, 2014

Thanks.Because I need open some database,I want to build your souce codes to gen jar and *.so.How do I change your defaut kdf_iter in source code? Could you give me some advice to change it?

@developernotes
Copy link
Member

Hello cczscq,

You do not need to rebuild the source with a different kdf iteration length, there are two possible alternatives:

  1. Pass a SQLiteDatabaseHook when you open the connection, overriding the postKey function and invoking PRAGMA kdf_iter = 4000;.
  2. Upgrade your database to use the new 64,000 kdf iteration length via the SQLiteDatabaseHook::postKey as well, invoking PRAGMA cipher_migrate.

Option 2 provides a more secure database configuration. You can read more about these changes in our 3.0.0 blog post here.

@cczscq
Copy link
Author

cczscq commented Jan 10, 2014

Hi Nick Parker:
I have some problem about sqlcipher.
1.How to set the default cipher_default_kdf_iter in your source code?
2.I use SQLiteDatabaseHook to set cipher_default_kdf_iter, After I restart my app some times, it always report "CREATE TABLE android_metadata failed,SQLiteException: file is encrypted or is not a database". My old databases become invaild.
3.I has set cipher_default_kdf_iter to 4000, the method named openOrCreateDatabase spend about 180ms; But when the phone reboot, this method go back to 1800+ms;

I search the problems in google groups,try a lot of methods, none works.
If i change the cipher_default_kdf_iter to 4000 in the source code, then rebuild to gen the new *.jar and *.so.When i reboot th e phone, does it will be faster at all times?

@developernotes
Copy link
Member

Hello cczscq,

I replied to your same questions on ticket #118. Please consider moving this to the SQLCipher mailing list. Thanks!

@cczscq
Copy link
Author

cczscq commented Jan 13, 2014

Thanks, a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants