Skip to content

Commit

Permalink
Add method to measure KDF transform rounds performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Trotsenko committed May 5, 2024
1 parent a3cdc93 commit 434b919
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
package app.keemobile.kotpass.database

import app.keemobile.kotpass.constants.GroupOverride
import app.keemobile.kotpass.cryptography.KeyTransform
import app.keemobile.kotpass.database.header.DatabaseHeader
import app.keemobile.kotpass.database.header.DatabaseInnerHeader
import app.keemobile.kotpass.extensions.clear
import app.keemobile.kotpass.models.DatabaseContent
import app.keemobile.kotpass.models.DatabaseElement
import app.keemobile.kotpass.models.Entry
import app.keemobile.kotpass.models.Group
import app.keemobile.kotpass.models.Meta
import java.security.SecureRandom
import java.util.UUID
import kotlin.system.measureTimeMillis

/**
* Main class which describes Keepass database.
Expand Down Expand Up @@ -216,3 +219,13 @@ fun KeePassDatabase.findEntries(
.group
.findChildEntries(true, content.meta.recycleBinUuid, predicate)
}

/**
* Measures KDF transform rounds performance based on
* [header][KeePassDatabase.header] parameters.
*/
fun KeePassDatabase.measureKeyTransformMillis() = measureTimeMillis {
KeyTransform
.transformedKey(header, credentials)
.clear()
}

0 comments on commit 434b919

Please sign in to comment.