refactor: remove channel disambiguation suffix

This commit is contained in:
andrekir 2024-03-18 08:34:56 -03:00
parent a3a914abce
commit ee61b79aa3
3 changed files with 5 additions and 20 deletions

View file

@ -73,21 +73,6 @@ data class Channel(
}
}
/**
* Return a name that is formatted as #channename-suffix
*
* Where suffix indicates the hash of the PSK
*/
val humanName: String
get() {
// start with the PSK then xor in the name
val pskCode = xorHash(psk.toByteArray())
val nameCode = xorHash(name.toByteArray())
val suffix = 'A' + ((pskCode xor nameCode) % 26)
return "#${name}-${suffix}"
}
/**
* Given a channel name and psk, return the (0 to 255) hash for that channel
*/