package com.peachpasswords.sync import java.security.MessageDigest /** * Fixed-format protocol comparisons. Wire-format length is public, but the * contents are compared without a data-dependent early exit. */ internal object CryptoCompare { fun utf8(left: String, right: String): Boolean = MessageDigest.isEqual( left.toByteArray(Charsets.UTF_8), right.toByteArray(Charsets.UTF_8), ) fun hex(left: String, right: String): Boolean = utf8(left.lowercase(), right.lowercase()) }