mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-08-15 06:56:30 +00:00
* noise * works? * noise * temporary * better * wip: use subnet * better * barely working * werk * subnet * fix peer ID * 8 byte peer ID * wip noise * wip fixes for noise * std lib for noise * noise handshake one step further * buffers * use fork * fix imports * simplify counter * remove trash * hashing * no prologue * nice * wip, use noise encryption * peer ID hex * simplify session manager * heavy logging * use singleton * Fix Noise session race condition with elegant per-peer actor serialization - Use Kotlin coroutine actors for per-peer packet processing - Each peer gets dedicated actor that processes packets sequentially - Eliminates race conditions in session management without complex locking - Single surgical change in PacketProcessor - minimal, maintainable - Leverages Kotlin's native concurrency primitives * decrypt correctly * iniator works now * clean code and fix signature to null * better * no signature in private message * small fixes * refactor ack * refactor but untested * messages working * wip ack * wip fix ack * more logging * pending tracker * keep pending connections on errors * less logging * refactor model * refactor frombinarydata * idendityannouncement refactor and update to new binary protocol * fix keys * refix keys * dms work * revert to mainnet * do not change bluetooth adapter name * keep code but uncomment * clean up comments * cleanup comments
27 lines
739 B
Kotlin
27 lines
739 B
Kotlin
package com.bitchat.android.util
|
|
|
|
import java.util.Arrays
|
|
|
|
/**
|
|
* A wrapper class for ByteArray to allow it to be used as a key in HashMaps.
|
|
* The default ByteArray does not override equals() and hashCode() based on content.
|
|
*
|
|
* @param bytes The byte array to wrap.
|
|
*/
|
|
data class ByteArrayWrapper(val bytes: ByteArray) {
|
|
override fun equals(other: Any?): Boolean {
|
|
if (this === other) return true
|
|
if (javaClass != other?.javaClass) return false
|
|
other as ByteArrayWrapper
|
|
return Arrays.equals(bytes, other.bytes)
|
|
}
|
|
|
|
override fun hashCode(): Int {
|
|
return Arrays.hashCode(bytes)
|
|
}
|
|
|
|
fun toHexString(): String {
|
|
return bytes.joinToString("") { "%02x".format(it) }
|
|
}
|
|
}
|