Compare commits

..

25 Commits

Author SHA1 Message Date
576b0190ad Update README.md 2026-04-16 16:10:03 +00:00
8f80ceaf7f Bump version to 1.2.1
All checks were successful
/ test (pull_request) Successful in 43s
2026-03-11 23:54:11 +01:00
d4c316ae00 Upgrade dependencies 2026-03-11 23:53:42 +01:00
124f6a21a3 Upgrade dependencies
All checks were successful
/ test (pull_request) Successful in 1m15s
2026-02-16 19:52:47 +01:00
ab33fe3670 split ci
All checks were successful
/ test (pull_request) Successful in 1m41s
2026-02-03 23:45:09 +01:00
f78b10f565 upgrade
Some checks failed
/ publish (pull_request) Has been cancelled
/ test (pull_request) Has been cancelled
/ publish (push) Has been cancelled
/ test (push) Has been cancelled
2026-02-03 23:42:46 +01:00
8686be3346 improve ci
Some checks failed
/ test (push) Failing after 3m43s
/ publish (push) Has been skipped
2026-01-13 18:12:43 +01:00
8644c79167 update README
small rewording, link wikipedia article
2025-12-14 14:30:18 +01:00
1537dd1be3 replace IllegalArgumentException with require 2025-12-14 00:14:55 +01:00
8552d3dd2e update README 2025-12-13 21:13:17 +01:00
9a9543a1ff bump version to 1.1.0
All checks were successful
/ publish (push) Successful in 3m59s
2025-12-13 02:34:39 +01:00
d6449e647a fix workflow 2025-12-13 01:30:59 +01:00
a43cf1467d use common plugin 2025-12-13 01:23:24 +01:00
26cff5d331 implement tests 2025-12-12 16:11:08 +01:00
8f21a346db implement common interface 2025-12-12 16:10:57 +01:00
6dec2fea74 upgrade dependencies 2025-12-12 16:06:26 +01:00
ca71d9427f add README 2025-10-04 11:58:28 +02:00
1d0a60bb12 bump version to 1.0.3
All checks were successful
/ publish (push) Successful in 2m38s
2025-08-17 15:29:19 +02:00
e15d4e6414 fix PBKDF2 2025-08-17 15:29:00 +02:00
2b8bdd7e47 fix kotlin version
All checks were successful
/ publish (push) Successful in 3m21s
2025-08-17 15:21:08 +02:00
edddb4d14a bump version to 1.0.2
Some checks failed
/ publish (push) Failing after 2m32s
2025-08-17 15:15:53 +02:00
955b6090bc upgrade gradle wrapper 2025-08-17 15:15:27 +02:00
b740bdea9d small refactor 2025-08-03 00:29:19 +02:00
a1cf5f4202 bump version to 1.0.1
All checks were successful
/ publish (push) Successful in 2m55s
2025-07-24 21:10:20 +02:00
6020269957 update dependencies 2025-07-24 21:10:03 +02:00
16 changed files with 371 additions and 167 deletions

View File

@@ -1,36 +0,0 @@
on:
push:
branches:
- main
env:
GIT__TOKEN: ${{ secrets.TOKEN }}
jobs:
publish:
runs-on: linux
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
with:
key: gradle
path: |
~/.gradle/caches/
~/.gradle/wrapper/
~/.konan/
- uses: actions/setup-java@v4
with:
java-version: '24'
distribution: 'temurin'
- run: ./gradlew publish
- uses: actions/cache/save@v4
with:
key: gradle
path: |
~/.gradle/caches/
~/.gradle/wrapper/
~/.konan/

View File

@@ -0,0 +1,47 @@
on:
push:
branches: [ main ]
jobs:
publish:
runs-on: linux
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '24'
distribution: 'temurin'
- name: Cache Gradle
uses: actions/cache@v4
with:
key: gradle-${{ hashFiles('**/libs.versions.toml') }}
restore-keys: gradle
path: |
~/.gradle/caches/
~/.gradle/wrapper/
- name: Cache Konan
uses: actions/cache@v4
with:
key: konan-${{ hashFiles('**/libs.versions.toml') }}
restore-keys: konan
path: |
~/.konan/
- name: Cache Node
uses: actions/cache@v4
with:
key: node-${{ hashFiles('**/libs.versions.toml') }}
restore-keys: node
path: |
~/.gradle/nodejs
~/.gradle/yarn
- name: Publish
run: ./gradlew publish
env:
INFENDRO__TOKEN: ${{ secrets.TOKEN }}

View File

@@ -0,0 +1,28 @@
on:
pull_request:
branches: [ main ]
jobs:
test:
runs-on: linux
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '24'
distribution: 'temurin'
- name: Cache Gradle
uses: actions/cache@v4
with:
key: gradle-${{ hashFiles('**/libs.versions.toml') }}
restore-keys: gradle
path: |
~/.gradle/caches/
~/.gradle/wrapper/
- name: Test
run: ./gradlew jvmTest

35
README.md Normal file
View File

@@ -0,0 +1,35 @@
# kdf.kt
`kdf.kt` is a Kotlin Multiplatform library that provides common [Key Derivation Functions](https://en.wikipedia.org/wiki/Key_derivation_function).
Supported algorithms:
- PBKDF2
## Installation
Add the following to your `build.gradle.kts`.
```kotlin
repositories {
maven("https://git.infendro.com/api/packages/Infendro/maven")
}
dependencies {
implementation("com.infendro:kdf:1.2.1")
}
```
## Usage
```kotlin
fun main() {
// create a PBKDF2 instance using HMAC SHA-256
// this example uses 32 bytes of length and 100_000 iterations
val kdf = PBKDF2(32, 100_000, `SHA-256`())
// securely hash value with some salt
val value = "password".encodeToByteArray()
val salt = "salt".encodeToByteArray()
val hash = kdf.hash(value, salt)
}
```

View File

@@ -1,56 +1,46 @@
group = "com.infendro"
version = "1.0.0"
@file:OptIn(ExperimentalWasmDsl::class)
repositories {
maven("https://git.infendro.com/api/packages/Infendro/maven")
mavenCentral()
}
import com.infendro.plugin.infendro
import com.infendro.plugin.token
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
group = "com.infendro"
version = "1.2.1"
plugins {
alias(libs.plugins.infendro)
alias(libs.plugins.multiplatform)
id("maven-publish")
}
kotlin {
jvm()
js {
nodejs()
}
linuxX64()
linuxArm64()
mingwX64()
macosX64()
macosArm64()
js { nodejs() }
wasmJs { nodejs() }
wasmWasi { nodejs() }
repositories {
infendro()
mavenCentral()
}
sourceSets {
commonMain.dependencies {
implementation(libs.mac)
implementation(libs.bytes)
implementation(libs.hash)
implementation(libs.mac)
}
commonTest.dependencies {
implementation(libs.test)
}
}
}
publishing {
repositories {
maven {
url = uri("https://git.infendro.com/api/packages/Infendro/maven")
authentication.create("header", HttpHeaderAuthentication::class)
credentials(HttpHeaderCredentials::class) {
val token = secret("git.token") ?: throw GradleException()
name = "Authorization"
value = "token $token"
}
}
}
}
fun secret(
key: String,
): String? {
val property = key
val environment = key
.uppercase()
.replace(".", "__")
val prop = properties[property] as String?
val env = System.getenv(environment)
return prop ?: env
publishing.repositories {
infendro(token)
}

View File

@@ -1,11 +1,16 @@
[versions]
kotlin = "2.1.20"
mac = "1.1.0"
hash = "1.2.0"
infendro = "1.1.0"
kotlin = "2.3.0"
bytes = "1.4.2"
hash = "1.7.0"
mac = "1.5.0"
[plugins]
infendro = { id = "com.infendro.plugin", version.ref = "infendro" }
multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
[libraries]
mac = { module = "com.infendro:mac", version.ref = "mac" }
bytes = { module = "com.infendro:bytes", version.ref = "bytes" }
hash = { module = "com.infendro:hash", version.ref = "hash" }
mac = { module = "com.infendro:mac", version.ref = "mac" }
test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }

Binary file not shown.

View File

@@ -1,6 +1,7 @@
#Sun May 18 00:11:37 CEST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

47
gradlew vendored
View File

@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,13 +82,11 @@ do
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -114,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
@@ -133,22 +133,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -193,18 +200,28 @@ if "$cygwin" || "$msys" ; then
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.

41
gradlew.bat vendored
View File

@@ -13,8 +13,10 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -25,7 +27,8 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@@ -56,32 +59,34 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal

View File

@@ -1 +1,6 @@
rootProject.name = "kdf"
pluginManagement.repositories {
maven("https://git.infendro.com/api/packages/Infendro/maven")
mavenCentral()
}

View File

@@ -0,0 +1,15 @@
package com.infendro.kdf
interface KDF {
val bytes: Int
val bits: Int
get() = bytes * 8
fun hashInto(value: ByteArray, salt: ByteArray, destination: ByteArray, destinationOffset: Int = 0)
fun hash(value: ByteArray, salt: ByteArray): ByteArray {
val result = ByteArray(bytes)
hashInto(value, salt, result)
return result
}
}

View File

@@ -1,45 +1,41 @@
package com.infendro.kdf
import com.infendro.bytes.bytearray.xorWith
import com.infendro.bytes.int.toByteArray
import com.infendro.hash.HashFunction
import com.infendro.kdf.util.addAll
import com.infendro.kdf.util.toByteArray
import com.infendro.kdf.util.xor
import com.infendro.kdf.util.ceilDiv
import com.infendro.mac.HMAC
class PBKDF2(
override val bytes: Int,
private val iterations: Int,
function: HashFunction,
) {
private val size = function.bytes
) : KDF {
init {
require(bytes > 0)
require(iterations > 0)
}
private val hmac = HMAC(function)
private val buffer = ByteArray(hmac.bytes)
fun hash(
value: ByteArray,
salt: ByteArray,
iterations: Int,
length: Int,
): ByteArray {
val key = mutableListOf<Byte>()
override fun hashInto(value: ByteArray, salt: ByteArray, destination: ByteArray, destinationOffset: Int) {
hmac.init(value)
for (i in 1..(length + size - 1) / size) {
val input = salt + i.toUInt().toByteArray()
for (block in 1..bytes.ceilDiv(hmac.bytes)) {
val offset = (block - 1) * hmac.bytes
val bytes = minOf(bytes - offset, hmac.bytes)
var u = hmac.hash(value, input)
var result = u
hmac.update(salt)
hmac.update(block.toByteArray())
hmac.digestInto(buffer)
buffer.copyInto(destination, destinationOffset + offset, endIndex = bytes)
repeat(iterations - 1) {
u = hmac.hash(value, u)
result = result xor u
}
key.addAll(result)
if (key.size >= length) {
println(key.size)
break
hmac.update(buffer)
hmac.digestInto(buffer)
val offset = destinationOffset + offset
destination.xorWith(buffer, offset, offset + bytes)
}
}
return key
.take(length)
.toByteArray()
}
}

View File

@@ -1,26 +0,0 @@
package com.infendro.kdf.util
import kotlin.experimental.xor
internal infix fun ByteArray.xor(
that: ByteArray,
): ByteArray {
if (this.size != that.size) throw Exception()
return ByteArray(size) { i ->
this[i] xor that[i]
}
}
internal fun MutableCollection<Byte>.addAll(
bytes: ByteArray,
): Boolean {
return addAll(bytes.toList())
}
internal fun UInt.toByteArray(): ByteArray {
return ByteArray(4) { i ->
val offset = (3 - i) * 8
(this shr offset).toByte()
}
}

View File

@@ -0,0 +1,4 @@
package com.infendro.kdf.util
internal fun Int.ceilDiv(n: Int): Int =
(this + n - 1) / n

View File

@@ -0,0 +1,118 @@
package com.infendro.kdf
import com.infendro.hash.sha2.`SHA-256`
import kotlin.test.Test
import kotlin.test.assertContentEquals
class `PBKDF2 Test` {
@Test
fun `32 bytes 1 iteration`() {
val function = PBKDF2(32, 1, `SHA-256`())
val expected = byteArrayOf(
+0x12, +0x0f, -0x4a, -0x31, -0x04, -0x08, -0x4d, +0x2c,
+0x43, -0x19, +0x22, +0x52, +0x56, -0x3c, -0x08, +0x37,
-0x58, +0x65, +0x48, -0x37, +0x2c, -0x34, +0x35, +0x48,
+0x08, +0x05, -0x68, +0x7c, -0x49, +0x0b, -0x1f, +0x7b,
)
val actual = function.hash(
"password".encodeToByteArray(),
"salt".encodeToByteArray(),
)
assertContentEquals(expected, actual)
}
@Test
fun `32 bytes 2 iterations`() {
val function = PBKDF2(32, 2, `SHA-256`())
val expected = byteArrayOf(
-0x52, +0x4d, +0x0c, -0x6b, -0x51, +0x6b, +0x46, -0x2d,
+0x2d, +0x0a, -0x21, -0x07, +0x28, -0x10, +0x6d, -0x30,
+0x2a, +0x30, +0x3f, -0x72, -0x0d, -0x3e, +0x51, -0x21,
-0x2a, -0x1e, -0x28, +0x5a, -0x6b, +0x47, +0x4c, +0x43,
)
val actual = function.hash(
"password".encodeToByteArray(),
"salt".encodeToByteArray(),
)
assertContentEquals(expected, actual)
}
@Test
fun `32 bytes 4096 iterations`() {
val function = PBKDF2(32, 4096, `SHA-256`())
val expected = byteArrayOf(
-0x3b, -0x1c, +0x78, -0x2b, -0x6e, -0x78, -0x38, +0x41,
-0x56, +0x53, +0x0d, -0x4a, -0x7c, +0x5c, +0x4c, -0x73,
-0x6a, +0x28, -0x6d, -0x60, +0x01, -0x32, +0x4e, +0x11,
-0x5c, -0x6a, +0x38, +0x73, -0x56, -0x68, +0x13, +0x4a,
)
val actual = function.hash(
"password".encodeToByteArray(),
"salt".encodeToByteArray(),
)
assertContentEquals(expected, actual)
}
@Test
fun `40 bytes 4096 iterations`() {
val function = PBKDF2(40, 4096, `SHA-256`())
val expected = byteArrayOf(
-0x3b, -0x1c, +0x78, -0x2b, -0x6e, -0x78, -0x38, +0x41,
-0x56, +0x53, +0x0d, -0x4a, -0x7c, +0x5c, +0x4c, -0x73,
-0x6a, +0x28, -0x6d, -0x60, +0x01, -0x32, +0x4e, +0x11,
-0x5c, -0x6a, +0x38, +0x73, -0x56, -0x68, +0x13, +0x4a,
-0x09, -0x53, -0x68, -0x3f, -0x4c, +0x58, -0x32, +0x3f,
)
val actual = function.hash(
"password".encodeToByteArray(),
"salt".encodeToByteArray(),
)
assertContentEquals(expected, actual)
}
@Test
fun `64 bytes 1 iteration`() {
val function = PBKDF2(64, 1, `SHA-256`())
val expected = byteArrayOf(
+0x55, -0x54, +0x04, +0x6e, +0x56, -0x1d, +0x08, -0x61,
-0x14, +0x16, -0x6f, -0x3e, +0x25, +0x44, -0x4a, +0x05,
-0x07, +0x41, -0x7b, +0x21, +0x6d, -0x22, +0x04, +0x65,
-0x1a, -0x75, -0x63, +0x57, -0x3e, +0x0d, -0x54, -0x44,
+0x49, -0x36, -0x64, -0x34, -0x0f, +0x79, -0x4a, +0x45,
-0x67, +0x16, +0x64, -0x4d, -0x63, +0x77, -0x11, +0x31,
+0x7c, +0x71, -0x48, +0x45, -0x4f, -0x1d, +0x0b, -0x2b,
+0x09, +0x11, +0x20, +0x41, -0x2d, -0x5f, -0x69, -0x7d,
)
val actual = function.hash(
"passwd".encodeToByteArray(),
"salt".encodeToByteArray(),
)
assertContentEquals(expected, actual)
}
@Test
fun `64 bytes 80000 iterations`() {
val function = PBKDF2(64, 80_000, `SHA-256`())
val expected = byteArrayOf(
+0x4d, -0x24, -0x28, -0x0a, +0x0b, -0x68, -0x42, +0x21,
-0x7d, +0x0c, -0x12, +0x5e, -0x0e, +0x27, +0x01, -0x07,
+0x64, +0x1a, +0x44, +0x18, -0x30, +0x4c, +0x04, +0x14,
-0x52, -0x01, +0x08, -0x79, +0x6b, +0x34, -0x55, +0x56,
-0x5f, -0x2c, +0x25, -0x5f, +0x22, +0x58, +0x33, +0x54,
-0x66, -0x25, -0x7c, +0x1b, +0x51, -0x37, -0x4d, +0x17,
+0x6a, +0x27, +0x2b, -0x22, -0x45, -0x5f, -0x30, +0x78,
+0x47, -0x71, +0x62, -0x4d, -0x69, -0x0d, +0x3c, -0x73,
)
val actual = function.hash(
"Password".encodeToByteArray(),
"NaCl".encodeToByteArray(),
)
assertContentEquals(expected, actual)
}
}