1package com.peachpasswords23import com.peachpasswords.sync.SASDerivation4import com.peachpasswords.sync.computeVaultId5import com.peachpasswords.vault.VaultCrypto6import org.junit.Assert.assertEquals7import org.junit.Test891011121314151617class CrossPlatformKATTest {1819 private fun hex(b: ByteArray) = b.joinToString("") { "%02x".format(it) }2021 22 private val argonSalt = ByteArray(VaultCrypto.SALT_SIZE) { it.toByte() }2324 @Test fun argon2id_non_bmp_password_vector() {25 26 val key = VaultCrypto.deriveKey("test🔑", argonSalt)27 assertEquals("a519dd4e695d25c6cd69a2f89d51ddcabd952c979f5714ab29fb77f6d1ad3728", hex(key))28 }2930 @Test fun compute_vault_id_vector() {31 32 val masterKey = ByteArray(32) { it.toByte() }33 assertEquals("ae0ec54041c9ba3e20c0c2d33bdeb2552f3b9a3fb4be3286ec0ef0a61be2fc9c", computeVaultId(masterKey))34 }3536 @Test fun sas_derivation_vector() {37 38 val handshakeHash = byteArrayOf(0x12, 0x34, 0x56, 0x78) + ByteArray(28)39 assertEquals("419896", SASDerivation.derive(handshakeHash))40 }41}