commonMain.com.algolia.client.extensions.internal.Encoding.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of algoliasearch-client-kotlin-jvm Show documentation
Show all versions of algoliasearch-client-kotlin-jvm Show documentation
"Algolia is a powerful search-as-a-service solution, made easy to use with API clients, UI libraries, and pre-built integrations. Algolia API Client for Kotlin lets you easily use the Algolia Search REST API from your JVM project, such as Android or backend implementations."
package com.algolia.client.extensions.internal
/**
* Encodes a key using sha256.
*/
internal expect fun encodeKeySHA256(key: String, message: String): String
/**
* Hex utilities.
*/
internal object Hex {
private const val HEX_CODE = "0123456789abcdef"
/**
* Take the [ByteArray] and convert it to a hex encoded [String].
*/
internal fun buildString(byteArray: ByteArray): String {
return buildString(capacity = byteArray.size * 2) {
for (byte in byteArray) {
append(HEX_CODE[byte.toInt() shr 4 and 0xF])
append(HEX_CODE[byte.toInt() and 0xF])
}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy