All Downloads are FREE. Search and download functionalities are using the official Maven repository.

secretblob.SecretBlobKey.kt Maven / Gradle / Ivy

There is a newer version: 0.3.1
Show newest version
package se.wollan.crypto.secretblob

interface SecretBlobKey {
    val length: Int

    /** Must be same number of bytes as length L, so in hex terms that means 2L. */
    val hexMask: String
}

internal fun SecretBlobKey.withMask(hexMask: String): SecretBlobKey {
    require(length * 2 == hexMask.length) { "new hex mask must of of length $length" }
    val orig = this
    return object : SecretBlobKey {
        override val length: Int = orig.length
        override val hexMask: String = hexMask
        override fun equals(other: Any?): Boolean = orig == other
        override fun hashCode(): Int = orig.hashCode()
        override fun toString(): String = orig.toString()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy