Hello, `getDigestFunction` method on CryptoJvm.kt ...
# ktor
d
Hello,
getDigestFunction
method on CryptoJvm.kt with constant salt (String) is no more supported after ktor 1.2.0. (fixed by this issue https://github.com/ktorio/ktor/issues/1061 ). So we must set salt as function ((value: String) -> String) like below code.
Copy code
// Old style  (Not supported after 1.2.0)
// fun getDigestFunction(algorithm: String, salt: String): (String) -> ByteArray
val userTable = UserHashedTableAuth(getDigestFunction("SHA-256", salt = "ktor"), mapOf(
    "test" to decodeBase64("VltM4nfheqcJSyH887H+4NEOm2tDuKCl83p5axYXlF0=") // sha256 for "test"
))

//New style
// fun getDigestFunction(algorithm: String, salt: (value: String) -> String): (String) -> ByteArray
val userTable = UserHashedTableAuth(getDigestFunction("SHA-256", salt = { pass -> "ktor" }), mapOf(
    "test" to decodeBase64("VltM4nfheqcJSyH887H+4NEOm2tDuKCl83p5axYXlF0=") // sha256 for "test"
))
Salt must be different by user. But new style code seems not to be effective for this requirement, because password may be same between users. So old style might be better not to be deprecated. Is there any intended usage of this new style
getDigestFunction
function?