Fix subsonic accepts only lowercase md5 password hash.
Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
parent
0deed54a9e
commit
1c56d6459b
|
@ -30,7 +30,7 @@ class PasswordMD5InterceptorTest : BaseInterceptorTest() {
|
|||
val salt = requestLine.split('&').find { it.startsWith("s=") }
|
||||
?.substringAfter('=')?.substringBefore(" ")
|
||||
val expectedToken = String(Hex.encodeHex(MessageDigest.getInstance("MD5")
|
||||
.digest("$password$salt".toByteArray()), false))
|
||||
.digest("$password$salt".toByteArray()), true))
|
||||
requestLine `should contain` "t=$expectedToken"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ class PasswordMD5Interceptor(private val password: String) : Interceptor {
|
|||
private val passwordMD5Hash: String by lazy {
|
||||
try {
|
||||
val md5Digest = MessageDigest.getInstance("MD5")
|
||||
md5Digest.digest("$password$salt".toByteArray()).toHexBytes()
|
||||
md5Digest.digest("$password$salt".toByteArray()).toHexBytes().toLowerCase()
|
||||
} catch (e: NoSuchAlgorithmException) {
|
||||
throw IllegalStateException(e)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue