Merge pull request #14 from ionspin/libsodium-code-generator
Libsodium code generator
This commit is contained in:
commit
aef190199d
5
.gitignore
vendored
5
.gitignore
vendored
@ -16,7 +16,9 @@ build/
|
|||||||
/multiplatform-crypto-delegated/node_modules
|
/multiplatform-crypto-delegated/node_modules
|
||||||
/multiplatform-crypto-delegated/package.json
|
/multiplatform-crypto-delegated/package.json
|
||||||
/multiplatform-crypto-delegated/package-lock.json
|
/multiplatform-crypto-delegated/package-lock.json
|
||||||
|
/multiplatform-crypto-libsodium-bindings/node_modules
|
||||||
|
/multiplatform-crypto-libsodium-bindings/package.json
|
||||||
|
/multiplatform-crypto-libsodium-bindings/package-lock.json
|
||||||
/sodiumWrapper/include/
|
/sodiumWrapper/include/
|
||||||
/sodiumWrapper/lib/
|
/sodiumWrapper/lib/
|
||||||
/sodiumWrapper/ios-include/
|
/sodiumWrapper/ios-include/
|
||||||
@ -29,3 +31,4 @@ build/
|
|||||||
/sodiumWrapper/static-mingw-x86-64/
|
/sodiumWrapper/static-mingw-x86-64/
|
||||||
/sodiumWrapper/static-tvos/
|
/sodiumWrapper/static-tvos/
|
||||||
/sodiumWrapper/static-watchos/
|
/sodiumWrapper/static-watchos/
|
||||||
|
/kotlin-multiplatform-libsodium-generator/out/
|
||||||
|
78
.travis.yml
78
.travis.yml
@ -15,9 +15,9 @@ matrix:
|
|||||||
script:
|
script:
|
||||||
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash ./linuxBuild.sh; fi'
|
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash ./linuxBuild.sh; fi'
|
||||||
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./linuxBuildAndPublish.sh; fi'
|
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./linuxBuildAndPublish.sh; fi'
|
||||||
# OSX macos/ios
|
# OSX macos
|
||||||
- os: osx
|
- os: osx
|
||||||
name: osx-mac-ios
|
name: osx-mac
|
||||||
osx_image: xcode11.4
|
osx_image: xcode11.4
|
||||||
language: java
|
language: java
|
||||||
jdk: openjdk12
|
jdk: openjdk12
|
||||||
@ -26,8 +26,21 @@ matrix:
|
|||||||
KBUILD=linux
|
KBUILD=linux
|
||||||
JAVA_OPTS=-Xmx2g
|
JAVA_OPTS=-Xmx2g
|
||||||
script:
|
script:
|
||||||
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash ./macBuild-mac-ios.sh; fi'
|
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash ./macBuild-mac.sh; fi'
|
||||||
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./macBuildAndPublish-mac-ios.sh; fi'
|
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./macBuildAndPublish-mac.sh; fi'
|
||||||
|
# OSX ios
|
||||||
|
- os: osx
|
||||||
|
name: osx-ios
|
||||||
|
osx_image: xcode11.4
|
||||||
|
language: java
|
||||||
|
jdk: openjdk12
|
||||||
|
install: true
|
||||||
|
env:
|
||||||
|
KBUILD=linux
|
||||||
|
JAVA_OPTS=-Xmx2g
|
||||||
|
script:
|
||||||
|
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash ./macBuild-ios.sh; fi'
|
||||||
|
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./macBuildAndPublish-ios.sh; fi'
|
||||||
# OSX watchos
|
# OSX watchos
|
||||||
- os: osx
|
- os: osx
|
||||||
name: osx-watchos
|
name: osx-watchos
|
||||||
@ -54,9 +67,10 @@ matrix:
|
|||||||
script:
|
script:
|
||||||
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash ./macBuild-tvos.sh; fi'
|
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash ./macBuild-tvos.sh; fi'
|
||||||
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./macBuildAndPublish-tvos.sh; fi'
|
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./macBuildAndPublish-tvos.sh; fi'
|
||||||
# OSX pure
|
|
||||||
|
# OSX macos PURE
|
||||||
- os: osx
|
- os: osx
|
||||||
name: osx-pure
|
name: osx-mac-pure
|
||||||
osx_image: xcode11.4
|
osx_image: xcode11.4
|
||||||
language: java
|
language: java
|
||||||
jdk: openjdk12
|
jdk: openjdk12
|
||||||
@ -65,10 +79,50 @@ matrix:
|
|||||||
KBUILD=linux
|
KBUILD=linux
|
||||||
JAVA_OPTS=-Xmx2g
|
JAVA_OPTS=-Xmx2g
|
||||||
script:
|
script:
|
||||||
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash ./macBuild-pure.sh; fi'
|
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash ./macBuild-pure-mac.sh; fi'
|
||||||
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./macBuildAndPublish-pure.sh; fi'
|
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./macBuildAndPublish-pure-mac.sh; fi'
|
||||||
|
# OSX ios PURE
|
||||||
|
- os: osx
|
||||||
|
name: osx-ios-pure
|
||||||
|
osx_image: xcode11.4
|
||||||
|
language: java
|
||||||
|
jdk: openjdk12
|
||||||
|
install: true
|
||||||
|
env:
|
||||||
|
KBUILD=linux
|
||||||
|
JAVA_OPTS=-Xmx2g
|
||||||
|
script:
|
||||||
|
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash ./macBuild-pure-ios.sh; fi'
|
||||||
|
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./macBuildAndPublish-pure-ios.sh; fi'
|
||||||
|
# OSX watchos PURE
|
||||||
|
- os: osx
|
||||||
|
name: osx-watchos-pure
|
||||||
|
osx_image: xcode11.4
|
||||||
|
language: java
|
||||||
|
jdk: openjdk12
|
||||||
|
install: true
|
||||||
|
env:
|
||||||
|
KBUILD=linux
|
||||||
|
JAVA_OPTS=-Xmx2g
|
||||||
|
script:
|
||||||
|
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash ./macBuild-pure-watchos.sh; fi'
|
||||||
|
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./macBuildAndPublish-pure-watchos.sh; fi'
|
||||||
|
# OSX tvos PURE
|
||||||
|
- os: osx
|
||||||
|
name: osx-tvos-pure
|
||||||
|
osx_image: xcode11.4
|
||||||
|
language: java
|
||||||
|
jdk: openjdk12
|
||||||
|
install: true
|
||||||
|
env:
|
||||||
|
KBUILD=linux
|
||||||
|
JAVA_OPTS=-Xmx2g
|
||||||
|
script:
|
||||||
|
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then bash ./macBuild-pure-tvos.sh; fi'
|
||||||
|
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./macBuildAndPublish-pure-tvos.sh; fi'
|
||||||
|
|
||||||
- os: windows
|
- os: windows
|
||||||
name: windwos-pure
|
name: windows-pure
|
||||||
language: shell
|
language: shell
|
||||||
jdk: openjdk12
|
jdk: openjdk12
|
||||||
env:
|
env:
|
||||||
@ -134,10 +188,8 @@ matrix:
|
|||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- $HOME/.m2/
|
- $HOME/.m2/
|
||||||
- $HOME/.gradle/caches/
|
- $HOME/.gradle
|
||||||
- $HOME/.gradle/wrapper/
|
- $HOME/.konan
|
||||||
- $HOME/.konan/cache
|
|
||||||
- $HOME/.konan/dependencies
|
|
||||||
- $HOME/AppData/Local/Temp/chocolatey
|
- $HOME/AppData/Local/Temp/chocolatey
|
||||||
- /C/tools/msys64
|
- /C/tools/msys64
|
||||||
branches:
|
branches:
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
## Descriptive changelog
|
## Descriptive changelog
|
||||||
(All dates are DD.MM.YYYY)
|
(All dates are DD.MM.YYYY)
|
||||||
|
|
||||||
#### AES - 0.0.3-SNAPSHOT - 25.9.2019
|
#### - 0.1.0 - SNAPSHOT
|
||||||
|
- Complete rework of the library
|
||||||
|
- Creating in parallel both Pure Kotlin and Delegated flavours (backed by libsodium)
|
||||||
|
- Introducing libsodium bindings generator
|
||||||
|
|
||||||
|
#### AES - 0.0.3 - 25.9.2019
|
||||||
- Added AES with CBC and CTR modes
|
- Added AES with CBC and CTR modes
|
||||||
|
|
||||||
#### Updatable SHA hash implementation - 0.0.2 - 21.7.2019
|
#### Updatable SHA hash implementation - 0.0.2 - 21.7.2019
|
||||||
|
102
README.md
102
README.md
@ -3,17 +3,31 @@
|
|||||||
|
|
||||||
# Kotlin Multiplatform Crypto Library
|
# Kotlin Multiplatform Crypto Library
|
||||||
|
|
||||||
|
#Note:
|
||||||
|
### Next stable release will be published after public release of Kotlin 1.4, until then API will change significantly
|
||||||
|
|
||||||
Kotlin Multiplatform Crypto is a library for various cryptographic applications.
|
Kotlin Multiplatform Crypto is a library for various cryptographic applications.
|
||||||
|
|
||||||
The library comes in two flavors `multiplatform-crypto` and `multiplatform-crypto-delegated`
|
The library comes in two flavors `multiplatform-crypto` and `multiplatform-crypto-delegated`. This project also provides
|
||||||
|
direct libsodium bindings under `multiplatform-crypto-libsodium-bindings`.
|
||||||
|
|
||||||
* `multiplatform-crypto` contains pure kotlin implementations, is not reviewed, should be considered unsafe and only
|
* `multiplatform-crypto` contains pure kotlin implementations, is not reviewed, should be considered unsafe and only
|
||||||
for prototyping or experimentation purposes.
|
for prototyping or experimentation purposes.
|
||||||
|
|
||||||
* `multiplatform-crypto-delegated` relies on platform specific implementations, like libsodium, but care should still be taken that the kotlin code is not reviewed or proven safe.
|
* `multiplatform-crypto-delegated` relies on platform specific implementations, mostly libsodium, but care should still be taken that the kotlin code is not reviewed or proven safe.
|
||||||
|
|
||||||
APIs of both variants are identical.
|
APIs of both variants are identical.
|
||||||
|
|
||||||
|
* `multiplatform-crypto-libsodium-bindings` is a generated bindings library using `kotlin-multiplatform-libsodium-generator`
|
||||||
|
* Under HEAVY development at the moment
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Table of contents
|
||||||
|
1. [Supported platforms](#supported-platforms-by-variant)
|
||||||
|
2. [API](#api)
|
||||||
|
3. TODO
|
||||||
|
|
||||||
## Supported platforms by variant
|
## Supported platforms by variant
|
||||||
|Platform|Pure variant| Delegated variant|
|
|Platform|Pure variant| Delegated variant|
|
||||||
|--------|------------|------------------|
|
|--------|------------|------------------|
|
||||||
@ -41,41 +55,31 @@ The library includes sample project that shows usage on different platforms
|
|||||||
**The API will move fast and break often until v1.0**
|
**The API will move fast and break often until v1.0**
|
||||||
|
|
||||||
Next steps:
|
Next steps:
|
||||||
- Expand API (AEAD, ECC ...)
|
- Expand API (ECC, Signing ...)
|
||||||
- Include AES and Argon2 in new API approach
|
|
||||||
- Add primitives missing in `delegated` variant that are supported in `pure` (at the moment AES and Argon2)
|
|
||||||
|
|
||||||
## Should I use this in production?
|
## Should I use this in production?
|
||||||
|
**NO.**
|
||||||
No, until it is reviewed.
|
The library is under HEAVY development.
|
||||||
|
|
||||||
## Should I use this in code that is *critical* in any way, shape or form?
|
|
||||||
|
|
||||||
No, but even if after being warned you decide to, then use `multiplatform-crypto-delegated` as it relies on reputable libraries.
|
|
||||||
|
|
||||||
## Why?
|
## Why?
|
||||||
|
|
||||||
This is an experimental implementation, mostly for expanding personal understanding of cryptography.
|
This is an experimental implementation, mostly for expanding personal understanding of cryptography.
|
||||||
It's not peer reviewed, not guaranteed to be bug free, and not guaranteed to be secure.
|
It's not peer reviewed, not guaranteed to be bug free, and not guaranteed to be secure.
|
||||||
|
|
||||||
## Currently supported
|
## API for Pure and Delegated flavourd
|
||||||
|
|
||||||
### Hashing functions
|
### Hashing functions
|
||||||
* Blake2b
|
* Blake2b
|
||||||
* SHA512
|
* SHA512
|
||||||
* SHA256
|
* SHA256
|
||||||
|
|
||||||
### Symmetric cipher
|
|
||||||
* AES
|
|
||||||
* Modes: CBC, CTR
|
|
||||||
|
|
||||||
### Key Derivation
|
### Key Derivation
|
||||||
|
|
||||||
* Argon2
|
* Argon2
|
||||||
|
|
||||||
### AEAD
|
### Authenticated symmetric encryption (AEAD)
|
||||||
|
|
||||||
TODO()
|
* XChaCha20-Poly1305
|
||||||
|
|
||||||
|
|
||||||
### Delegated flavor dependancy table
|
### Delegated flavor dependancy table
|
||||||
@ -86,8 +90,8 @@ The following table describes which library is used for particular cryptographic
|
|||||||
| Blake2b | LazySodium | libsodium.js | libsodium |
|
| Blake2b | LazySodium | libsodium.js | libsodium |
|
||||||
| SHA256 | LazySodium | libsodium.js | libsodium |
|
| SHA256 | LazySodium | libsodium.js | libsodium |
|
||||||
| SHA512 | LazySodium | libsodium.js | libsodium |
|
| SHA512 | LazySodium | libsodium.js | libsodium |
|
||||||
| AES-CBC | LazySodium | libsodium.js | libsodium |
|
| XChaCha20-Poly1305 | LazySodium | libsodium.js | libsodium |
|
||||||
| AES-CTR | LazySodium | libsodium.js | libsodium |
|
|
||||||
|
|
||||||
|
|
||||||
## Integration
|
## Integration
|
||||||
@ -195,7 +199,34 @@ sha512.update("abc".encodeToUByteArray())
|
|||||||
val result = sha512.digest()
|
val result = sha512.digest()
|
||||||
```
|
```
|
||||||
|
|
||||||
### Symmetric encryption
|
### Key derivation
|
||||||
|
|
||||||
|
#### Argon2
|
||||||
|
|
||||||
|
NOTE: This implementation is tested against KAT generated by reference Argon2 implementation, which does not follow
|
||||||
|
specification completely. See this issue https://github.com/P-H-C/phc-winner-argon2/issues/183
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
val argon2Instance = Argon2(
|
||||||
|
password = "Password",
|
||||||
|
salt = "RandomSalt",
|
||||||
|
parallelism = 8,
|
||||||
|
tagLength = 64U,
|
||||||
|
requestedMemorySize = 256U, //4GB
|
||||||
|
numberOfIterations = 4U,
|
||||||
|
key = "",
|
||||||
|
associatedData = "",
|
||||||
|
argonType = ArgonType.Argon2id
|
||||||
|
)
|
||||||
|
val tag = argon2Instance.derive()
|
||||||
|
val tagString = tag.map { it.toString(16).padStart(2, '0') }.joinToString(separator = "")
|
||||||
|
val expectedTagString = "c255e3e94305817d5e09a7c771e574e3a81cc78fef5da4a9644b6df0" +
|
||||||
|
"0ba1c9b424e3dd0ce7e600b1269b14c84430708186a8a60403e1bfbda935991592b9ff37"
|
||||||
|
println("Tag: ${tagString}")
|
||||||
|
assertEquals(tagString, expectedTagString)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Symmetric encryption (OUTDATED, won't be exposed in next release, no counterpart in delegated flavor - 0.1.1)
|
||||||
|
|
||||||
#### AES
|
#### AES
|
||||||
|
|
||||||
@ -241,34 +272,9 @@ plainText == decrypted.toHexString()
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Key derivation
|
## Libsodium bindings
|
||||||
|
|
||||||
#### Argon2
|
|
||||||
|
|
||||||
NOTE: This implementation is tested against KAT generated by reference Argon2 implementation, which does not follow
|
|
||||||
specification completely. See this issue https://github.com/P-H-C/phc-winner-argon2/issues/183
|
|
||||||
|
|
||||||
```kotlin
|
|
||||||
val argon2Instance = Argon2(
|
|
||||||
password = "Password",
|
|
||||||
salt = "RandomSalt",
|
|
||||||
parallelism = 8,
|
|
||||||
tagLength = 64U,
|
|
||||||
requestedMemorySize = 256U, //4GB
|
|
||||||
numberOfIterations = 4U,
|
|
||||||
key = "",
|
|
||||||
associatedData = "",
|
|
||||||
argonType = ArgonType.Argon2id
|
|
||||||
)
|
|
||||||
val tag = argon2Instance.derive()
|
|
||||||
val tagString = tag.map { it.toString(16).padStart(2, '0') }.joinToString(separator = "")
|
|
||||||
val expectedTagString = "c255e3e94305817d5e09a7c771e574e3a81cc78fef5da4a9644b6df0" +
|
|
||||||
"0ba1c9b424e3dd0ce7e600b1269b14c84430708186a8a60403e1bfbda935991592b9ff37"
|
|
||||||
println("Tag: ${tagString}")
|
|
||||||
assertEquals(tagString, expectedTagString)
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
* Under development
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4-M2")
|
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.0-rc")
|
||||||
}
|
}
|
||||||
|
|
||||||
System.setProperty("PROJECT_PATH", project.projectDir.parentFile.toString())
|
System.setProperty("PROJECT_PATH", project.projectDir.parentFile.toString())
|
||||||
|
@ -15,19 +15,21 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
object Versions {
|
object Versions {
|
||||||
val kotlinCoroutines = "1.3.5-native-mt-arm-1.4-M2-SNAPSHOT" //NOTE: my linux arm32 and arm64 build
|
val kotlinCoroutines = "1.3.8-1.4.0-rc"
|
||||||
val kotlin = "1.4-M2"
|
val kotlin = "1.4.0-rc"
|
||||||
val kotlinSerialization = "0.20.0-1.4-M2"
|
val kotlinSerialization = "1.0-M1-1.4.0-rc"
|
||||||
val atomicfu = "0.14.3-M2-2-SNAPSHOT" //NOTE: my linux arm32 and arm64 build
|
val atomicfu = "0.14.3-M2-2-SNAPSHOT" //NOTE: my linux arm32 and arm64 build
|
||||||
val nodePlugin = "1.3.0"
|
val nodePlugin = "1.3.0"
|
||||||
val dokkaPlugin = "0.11.0-dev-44"
|
val dokkaPlugin = "1.4.0-M3-dev-92"
|
||||||
val taskTreePlugin = "1.5"
|
val taskTreePlugin = "1.5"
|
||||||
|
|
||||||
val kotlinBigNumVersion = "0.1.6-1.4-M2-SNAPSHOT"
|
val kotlinBigNumVersion = "0.1.6-1.4.0-rc-SNAPSHOT"
|
||||||
|
|
||||||
val lazySodium = "4.2.6"
|
val lazySodium = "4.2.6"
|
||||||
val jna = "5.5.0"
|
val jna = "5.5.0"
|
||||||
|
|
||||||
|
val kotlinPoet = "1.6.0"
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,8 +44,7 @@ object Deps {
|
|||||||
val stdLib = "stdlib-common"
|
val stdLib = "stdlib-common"
|
||||||
val test = "test-common"
|
val test = "test-common"
|
||||||
val testAnnotation = "test-annotations-common"
|
val testAnnotation = "test-annotations-common"
|
||||||
// val coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:${Versions.kotlinCoroutines}"
|
val coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:${Versions.kotlinCoroutines}"
|
||||||
val coroutines = "com.ionspin.kotlin.coroutines:kotlinx-coroutines-core:${Versions.kotlinCoroutines}"
|
|
||||||
val serialization = "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:${Versions.kotlinSerialization}"
|
val serialization = "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:${Versions.kotlinSerialization}"
|
||||||
val atomicfu = "com.ionspin.kotlin.atomicfu:atomicfu:${Versions.atomicfu}"
|
val atomicfu = "com.ionspin.kotlin.atomicfu:atomicfu:${Versions.atomicfu}"
|
||||||
|
|
||||||
@ -56,13 +57,11 @@ object Deps {
|
|||||||
object Js {
|
object Js {
|
||||||
val stdLib = "stdlib-js"
|
val stdLib = "stdlib-js"
|
||||||
val test = "test-js"
|
val test = "test-js"
|
||||||
// val coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:${Versions.kotlinCoroutines}"
|
val coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:${Versions.kotlinCoroutines}"
|
||||||
val coroutines = "com.ionspin.kotlin.coroutines:kotlinx-coroutines-core:${Versions.kotlinCoroutines}"
|
|
||||||
val serialization = "org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:${Versions.kotlinSerialization}"
|
val serialization = "org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:${Versions.kotlinSerialization}"
|
||||||
|
|
||||||
object Npm {
|
object Npm {
|
||||||
val libsodium = Pair("libsodium-wrappers-sumo", "0.7.6")
|
val libsodium = Pair("libsodium-wrappers-sumo", "0.7.6")
|
||||||
// val libsodiumWrappers = Pair("libsodium-wrappers-sumo", "0.7.6")
|
|
||||||
val libsodiumWrappers = Pair("libsodium-wrappers-sumo", "file:${getProjectPath()}/multiplatform-crypto-delegated/libsodium-wrappers-sumo-0.7.6.tgz")
|
val libsodiumWrappers = Pair("libsodium-wrappers-sumo", "file:${getProjectPath()}/multiplatform-crypto-delegated/libsodium-wrappers-sumo-0.7.6.tgz")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,12 +72,12 @@ object Deps {
|
|||||||
val test = "test"
|
val test = "test"
|
||||||
val testJUnit = "test-junit"
|
val testJUnit = "test-junit"
|
||||||
val reflection = "reflect"
|
val reflection = "reflect"
|
||||||
// val coroutinesCore = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.kotlinCoroutines}"
|
val coroutinesCore = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.kotlinCoroutines}"
|
||||||
val coroutinesCore = "com.ionspin.kotlin.coroutines:kotlinx-coroutines-core:${Versions.kotlinCoroutines}"
|
|
||||||
val coroutinesjdk8 = "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:${Versions.kotlinCoroutines}"
|
val coroutinesjdk8 = "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:${Versions.kotlinCoroutines}"
|
||||||
val serialization = "org.jetbrains.kotlinx:kotlinx-serialization-runtime:${Versions.kotlinSerialization}"
|
val serialization = "org.jetbrains.kotlinx:kotlinx-serialization-runtime:${Versions.kotlinSerialization}"
|
||||||
// val coroutinesTest = "org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.kotlinCoroutines}"
|
val coroutinesTest = "org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.kotlinCoroutines}"
|
||||||
val coroutinesTest = "com.ionspin.kotlin.coroutines:kotlinx-coroutines-test:${Versions.kotlinCoroutines}"
|
|
||||||
|
val kotlinPoet = "com.squareup:kotlinpoet:${Versions.kotlinPoet}"
|
||||||
|
|
||||||
object Delegated {
|
object Delegated {
|
||||||
val lazysodium = "com.goterl.lazycode:lazysodium-java:${Versions.lazySodium}"
|
val lazysodium = "com.goterl.lazycode:lazysodium-java:${Versions.lazySodium}"
|
||||||
@ -88,14 +87,12 @@ object Deps {
|
|||||||
|
|
||||||
object iOs {
|
object iOs {
|
||||||
val serialization = "org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:${Versions.kotlinSerialization}"
|
val serialization = "org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:${Versions.kotlinSerialization}"
|
||||||
// val coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:${Versions.kotlinCoroutines}"
|
val coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:${Versions.kotlinCoroutines}"
|
||||||
val coroutines = "com.ionspin.kotlin.coroutines:kotlinx-coroutines-core:${Versions.kotlinCoroutines}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object Native {
|
object Native {
|
||||||
val serialization = "org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:${Versions.kotlinSerialization}"
|
val serialization = "org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:${Versions.kotlinSerialization}"
|
||||||
// val coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:${Versions.kotlinCoroutines}"
|
val coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:${Versions.kotlinCoroutines}"
|
||||||
val coroutines = "com.ionspin.kotlin.coroutines:kotlinx-coroutines-core:${Versions.kotlinCoroutines}"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
36
kotlin-multiplatform-libsodium-generator/build.gradle.kts
Normal file
36
kotlin-multiplatform-libsodium-generator/build.gradle.kts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
plugins {
|
||||||
|
kotlin
|
||||||
|
}
|
||||||
|
|
||||||
|
group = "com.ionspin.kotlin.crypto"
|
||||||
|
version = "0.0.1"
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
google()
|
||||||
|
maven ("https://kotlin.bintray.com/kotlinx")
|
||||||
|
maven ("https://dl.bintray.com/kotlin/kotlin-eap")
|
||||||
|
maven ("https://dl.bintray.com/kotlin/kotlin-dev")
|
||||||
|
jcenter()
|
||||||
|
maven {
|
||||||
|
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation (kotlin(Deps.Jvm.stdLib))
|
||||||
|
implementation("com.squareup:kotlinpoet:1.6.0")
|
||||||
|
testImplementation(kotlin(Deps.Jvm.test))
|
||||||
|
testImplementation(kotlin(Deps.Jvm.testJUnit))
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().all {
|
||||||
|
kotlinOptions.freeCompilerArgs += listOf(
|
||||||
|
"-Xuse-experimental=kotlin.ExperimentalUnsignedTypes"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
package debug.test
|
||||||
|
|
||||||
|
import kotlin.Int
|
||||||
|
import kotlin.UByteArray
|
||||||
|
|
||||||
|
expect class Sha256State
|
||||||
|
|
||||||
|
expect class Sha512State
|
||||||
|
|
||||||
|
expect class GenericHashState
|
||||||
|
|
||||||
|
expect class Crypto internal constructor() {
|
||||||
|
fun crypto_hash_sha256_init(): Sha256State
|
||||||
|
|
||||||
|
fun crypto_hash_sha256_update(state: Sha256State, input: UByteArray)
|
||||||
|
|
||||||
|
fun crypto_hash_sha256_final(state: Sha256State): UByteArray
|
||||||
|
|
||||||
|
fun crypto_hash_sha512_init(): Sha512State
|
||||||
|
|
||||||
|
fun crypto_hash_sha512_update(state: Sha512State, input: UByteArray)
|
||||||
|
|
||||||
|
fun crypto_hash_sha512_final(state: Sha512State): UByteArray
|
||||||
|
|
||||||
|
fun crypto_generichash_init(key: UByteArray, outlen: Int): GenericHashState
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
package debug.test
|
||||||
|
|
||||||
|
import com.ionspin.kotlin.crypto.getSodium
|
||||||
|
import ext.libsodium.com.ionspin.kotlin.crypto.toUByteArray
|
||||||
|
import ext.libsodium.com.ionspin.kotlin.crypto.toUInt8Array
|
||||||
|
import kotlin.Any
|
||||||
|
import kotlin.Int
|
||||||
|
import kotlin.UByteArray
|
||||||
|
|
||||||
|
actual typealias Sha256State = Any
|
||||||
|
|
||||||
|
actual typealias Sha512State = Any
|
||||||
|
|
||||||
|
actual typealias GenericHashState = Any
|
||||||
|
|
||||||
|
actual class Crypto internal actual constructor() {
|
||||||
|
actual fun crypto_hash_sha256_init(): dynamic {
|
||||||
|
println("Debug crypto_hash_sha256_init")
|
||||||
|
val result = js("getSodium().crypto_hash_sha256_init()")
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun crypto_hash_sha256_update(state: Sha256State, input: UByteArray) {
|
||||||
|
println("Debug crypto_hash_sha256_update")
|
||||||
|
getSodium().crypto_hash_sha256_update(state, input.toUInt8Array(), )
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun crypto_hash_sha256_final(state: Sha256State): UByteArray {
|
||||||
|
println("Debug crypto_hash_sha256_final")
|
||||||
|
return getSodium().crypto_hash_sha256_final(state).toUByteArray()
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun crypto_hash_sha512_init(): dynamic {
|
||||||
|
println("Debug crypto_hash_sha512_init")
|
||||||
|
val result = js("getSodium().crypto_hash_sha512_init()")
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun crypto_hash_sha512_update(state: Sha512State, input: UByteArray) {
|
||||||
|
println("Debug crypto_hash_sha512_update")
|
||||||
|
getSodium().crypto_hash_sha512_update(state, input.toUInt8Array(), )
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun crypto_hash_sha512_final(state: Sha512State): UByteArray {
|
||||||
|
println("Debug crypto_hash_sha512_final")
|
||||||
|
return getSodium().crypto_hash_sha512_final(state).toUByteArray()
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun crypto_generichash_init(key: UByteArray, outlen: Int): dynamic {
|
||||||
|
println("Debug crypto_generichash_init")
|
||||||
|
return getSodium().crypto_generichash_init(key.toUInt8Array(), outlen)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
package debug.test
|
||||||
|
|
||||||
|
import com.goterl.lazycode.lazysodium.SodiumJava
|
||||||
|
import com.goterl.lazycode.lazysodium.interfaces.Hash
|
||||||
|
import kotlin.ByteArray
|
||||||
|
import kotlin.Int
|
||||||
|
import kotlin.UByteArray
|
||||||
|
|
||||||
|
val sodium: SodiumJava = SodiumJava()
|
||||||
|
|
||||||
|
actual typealias Sha256State = Hash.State256
|
||||||
|
|
||||||
|
actual typealias Sha512State = Hash.State512
|
||||||
|
|
||||||
|
actual typealias GenericHashState = ByteArray
|
||||||
|
|
||||||
|
actual class Crypto internal actual constructor() {
|
||||||
|
actual fun crypto_hash_sha256_init(): Sha256State {
|
||||||
|
val state = debug.test.Sha256State()
|
||||||
|
println("Debug crypto_hash_sha256_init")
|
||||||
|
sodium.crypto_hash_sha256_init(state)
|
||||||
|
return state
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun crypto_hash_sha256_update(state: Sha256State, input: UByteArray) {
|
||||||
|
println("Debug crypto_hash_sha256_update")
|
||||||
|
sodium.crypto_hash_sha256_update(state, input.asByteArray(), input.size.toLong())
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun crypto_hash_sha256_final(state: Sha256State): UByteArray {
|
||||||
|
val out = UByteArray(32)
|
||||||
|
println("Debug crypto_hash_sha256_final")
|
||||||
|
sodium.crypto_hash_sha256_final(state, out.asByteArray())
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun crypto_hash_sha512_init(): Sha512State {
|
||||||
|
val state = debug.test.Sha512State()
|
||||||
|
println("Debug crypto_hash_sha512_init")
|
||||||
|
sodium.crypto_hash_sha512_init(state)
|
||||||
|
return state
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun crypto_hash_sha512_update(state: Sha512State, input: UByteArray) {
|
||||||
|
println("Debug crypto_hash_sha512_update")
|
||||||
|
sodium.crypto_hash_sha512_update(state, input.asByteArray(), input.size.toLong())
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun crypto_hash_sha512_final(state: Sha512State): UByteArray {
|
||||||
|
val out = UByteArray(64)
|
||||||
|
println("Debug crypto_hash_sha512_final")
|
||||||
|
sodium.crypto_hash_sha512_final(state, out.asByteArray())
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun crypto_generichash_init(key: UByteArray, outlen: Int): GenericHashState {
|
||||||
|
val state = debug.test.GenericHashState(sodium.crypto_generichash_statebytes())
|
||||||
|
println("Debug crypto_generichash_init")
|
||||||
|
sodium.crypto_generichash_init(state, key.asByteArray(), key.size, outlen)
|
||||||
|
return state
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,88 @@
|
|||||||
|
package debug.test
|
||||||
|
|
||||||
|
import kotlin.Byte
|
||||||
|
import kotlin.ByteArray
|
||||||
|
import kotlin.Int
|
||||||
|
import kotlin.UByteArray
|
||||||
|
import kotlinx.cinterop.addressOf
|
||||||
|
import kotlinx.cinterop.convert
|
||||||
|
import kotlinx.cinterop.pin
|
||||||
|
import kotlinx.cinterop.pointed
|
||||||
|
import kotlinx.cinterop.ptr
|
||||||
|
import kotlinx.cinterop.reinterpret
|
||||||
|
import kotlinx.cinterop.toCValues
|
||||||
|
import libsodium.crypto_generichash_blake2b_state
|
||||||
|
import libsodium.crypto_hash_sha256_state
|
||||||
|
import libsodium.crypto_hash_sha512_state
|
||||||
|
import libsodium.sodium_malloc
|
||||||
|
|
||||||
|
actual typealias Sha256State = crypto_hash_sha256_state
|
||||||
|
|
||||||
|
actual typealias Sha512State = crypto_hash_sha512_state
|
||||||
|
|
||||||
|
actual typealias GenericHashState = crypto_generichash_blake2b_state
|
||||||
|
|
||||||
|
actual class Crypto internal actual constructor() {
|
||||||
|
val _emitByte: Byte = 0
|
||||||
|
|
||||||
|
val _emitByteArray: ByteArray = ByteArray(0)
|
||||||
|
|
||||||
|
actual fun crypto_hash_sha256_init(): Sha256State {
|
||||||
|
val allocated = sodium_malloc(debug.test.Sha256State.size.convert())!!
|
||||||
|
val state = allocated.reinterpret<debug.test.Sha256State>().pointed
|
||||||
|
println("Debug crypto_hash_sha256_init")
|
||||||
|
libsodium.crypto_hash_sha256_init(state.ptr)
|
||||||
|
return state
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun crypto_hash_sha256_update(state: Sha256State, input: UByteArray) {
|
||||||
|
println("Debug crypto_hash_sha256_update")
|
||||||
|
val pinnedInput = input.pin()
|
||||||
|
libsodium.crypto_hash_sha256_update(state.ptr, pinnedInput.addressOf(0), input.size.convert())
|
||||||
|
pinnedInput.unpin()
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun crypto_hash_sha256_final(state: Sha256State): UByteArray {
|
||||||
|
val out = UByteArray(32)
|
||||||
|
println("Debug crypto_hash_sha256_final")
|
||||||
|
val pinnedOut = out.pin()
|
||||||
|
libsodium.crypto_hash_sha256_final(state.ptr, pinnedOut.addressOf(0))
|
||||||
|
pinnedOut.unpin()
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun crypto_hash_sha512_init(): Sha512State {
|
||||||
|
val allocated = sodium_malloc(debug.test.Sha512State.size.convert())!!
|
||||||
|
val state = allocated.reinterpret<debug.test.Sha512State>().pointed
|
||||||
|
println("Debug crypto_hash_sha512_init")
|
||||||
|
libsodium.crypto_hash_sha512_init(state.ptr)
|
||||||
|
return state
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun crypto_hash_sha512_update(state: Sha512State, input: UByteArray) {
|
||||||
|
println("Debug crypto_hash_sha512_update")
|
||||||
|
val pinnedInput = input.pin()
|
||||||
|
libsodium.crypto_hash_sha512_update(state.ptr, pinnedInput.addressOf(0), input.size.convert())
|
||||||
|
pinnedInput.unpin()
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun crypto_hash_sha512_final(state: Sha512State): UByteArray {
|
||||||
|
val out = UByteArray(64)
|
||||||
|
println("Debug crypto_hash_sha512_final")
|
||||||
|
val pinnedOut = out.pin()
|
||||||
|
libsodium.crypto_hash_sha512_final(state.ptr, pinnedOut.addressOf(0))
|
||||||
|
pinnedOut.unpin()
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun crypto_generichash_init(key: UByteArray, outlen: Int): GenericHashState {
|
||||||
|
val allocated = sodium_malloc(debug.test.GenericHashState.size.convert())!!
|
||||||
|
val state = allocated.reinterpret<debug.test.GenericHashState>().pointed
|
||||||
|
println("Debug crypto_generichash_init")
|
||||||
|
val pinnedKey = key.pin()
|
||||||
|
libsodium.crypto_generichash_init(state.ptr, pinnedKey.addressOf(0), key.size.convert(),
|
||||||
|
outlen.convert())
|
||||||
|
pinnedKey.unpin()
|
||||||
|
return state
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.generator
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 18-Jul-2020
|
||||||
|
*/
|
||||||
|
object Launcher {
|
||||||
|
@JvmStatic
|
||||||
|
fun main(args : Array<String>) {
|
||||||
|
println("Ok")
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.generator.libsodium
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 18-Jul-2020
|
||||||
|
*/
|
||||||
|
class CInteropParser {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,174 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.generator.libsodium.definitions
|
||||||
|
|
||||||
|
import com.squareup.kotlinpoet.ClassName
|
||||||
|
import com.squareup.kotlinpoet.TypeName
|
||||||
|
import com.squareup.kotlinpoet.asTypeName
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 28-Jul-2020
|
||||||
|
*/
|
||||||
|
|
||||||
|
val packageName = "debug.test"
|
||||||
|
|
||||||
|
fun withPackageName(name: String) = ClassName(packageName, name)
|
||||||
|
|
||||||
|
class KotlinFileDefinition(
|
||||||
|
val name: String,
|
||||||
|
val commonClassList: MutableList<ClassDefinition> = mutableListOf()
|
||||||
|
) {
|
||||||
|
operator fun ClassDefinition.unaryPlus() {
|
||||||
|
commonClassList.add(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ClassDefinition(
|
||||||
|
val name: String,
|
||||||
|
val innerClasses: MutableList<InnerClassDefinition> = mutableListOf(),
|
||||||
|
val methods: MutableList<FunctionDefinition> = mutableListOf()
|
||||||
|
) {
|
||||||
|
operator fun InnerClassDefinition.unaryPlus() {
|
||||||
|
innerClasses.add(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
operator fun FunctionDefinition.unaryPlus() {
|
||||||
|
methods.add(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
operator fun List<FunctionDefinition>.unaryPlus() {
|
||||||
|
methods.addAll(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class InnerClassDefinition(
|
||||||
|
val name: String,
|
||||||
|
val javaName: String,
|
||||||
|
val jsName: String,
|
||||||
|
val nativeName: String,
|
||||||
|
val functions: MutableList<FunctionDefinition> = mutableListOf()
|
||||||
|
)
|
||||||
|
|
||||||
|
class FunctionDefinition(
|
||||||
|
val name: String,
|
||||||
|
val javaName: String,
|
||||||
|
val jsName: String,
|
||||||
|
val nativeName: String,
|
||||||
|
val parameterList: MutableList<ParameterDefinition> = mutableListOf(),
|
||||||
|
val returnType: GeneralTypeDefinition,
|
||||||
|
val dynamicJsReturn: Boolean = false,
|
||||||
|
val isStateCreationFunction: Boolean = false,
|
||||||
|
val outputLengthWhenArray: Int = -1
|
||||||
|
) {
|
||||||
|
operator fun ParameterDefinition.unaryPlus() {
|
||||||
|
parameterList.add(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ParameterDefinition(
|
||||||
|
val parameterName: String,
|
||||||
|
val parameterType: GeneralTypeDefinition,
|
||||||
|
val modifiesReturn: Boolean = false,
|
||||||
|
val isActuallyAnOutputParam: Boolean = false,
|
||||||
|
val isStateType: Boolean = false,
|
||||||
|
val dropParameterFromDefinition: Boolean = false,
|
||||||
|
val specificJvmInitializer: String? = null,
|
||||||
|
)
|
||||||
|
|
||||||
|
interface GeneralTypeDefinition {
|
||||||
|
val typeName: TypeName
|
||||||
|
}
|
||||||
|
|
||||||
|
data class CustomTypeDefinition(override val typeName: TypeName) : GeneralTypeDefinition
|
||||||
|
|
||||||
|
enum class TypeDefinition(override val typeName: TypeName) : GeneralTypeDefinition {
|
||||||
|
ARRAY_OF_UBYTES(UByteArray::class.asTypeName()),
|
||||||
|
ARRAY_OF_UBYTES_LONG_SIZE(UByteArray::class.asTypeName()),
|
||||||
|
ARRAY_OF_UBYTES_NO_SIZE(UByteArray::class.asTypeName()),
|
||||||
|
LONG(Long::class.asTypeName()),
|
||||||
|
INT(Int::class.asTypeName()),
|
||||||
|
STRING(String::class.asTypeName()),
|
||||||
|
UNIT(Unit::class.asTypeName())
|
||||||
|
}
|
||||||
|
|
||||||
|
fun fileDef(name: String, body: KotlinFileDefinition.() -> Unit): KotlinFileDefinition {
|
||||||
|
val commonKotlinFileInstance = KotlinFileDefinition(name)
|
||||||
|
commonKotlinFileInstance.body()
|
||||||
|
return commonKotlinFileInstance
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun classDef(name: String, body: ClassDefinition.() -> Unit): ClassDefinition {
|
||||||
|
val commonClass = ClassDefinition(name)
|
||||||
|
commonClass.body()
|
||||||
|
return commonClass
|
||||||
|
}
|
||||||
|
|
||||||
|
fun innerClassDef(
|
||||||
|
name: String,
|
||||||
|
javaName: String,
|
||||||
|
jsName: String,
|
||||||
|
nativeName: String,
|
||||||
|
specificConstructor : String? = null,
|
||||||
|
body: InnerClassDefinition.() -> Unit = {}
|
||||||
|
): InnerClassDefinition {
|
||||||
|
val genClass = InnerClassDefinition(
|
||||||
|
name,
|
||||||
|
javaName,
|
||||||
|
jsName,
|
||||||
|
nativeName
|
||||||
|
)
|
||||||
|
genClass.body()
|
||||||
|
return genClass
|
||||||
|
}
|
||||||
|
|
||||||
|
fun funcDef(
|
||||||
|
name: String,
|
||||||
|
javaName: String,
|
||||||
|
jsName: String,
|
||||||
|
nativeName: String,
|
||||||
|
returnType: GeneralTypeDefinition,
|
||||||
|
dynamicJsReturn: Boolean = false,
|
||||||
|
isStateCreationFunction: Boolean = false,
|
||||||
|
outputLengthWhenArray: Int = -1,
|
||||||
|
body: FunctionDefinition.() -> Unit
|
||||||
|
): FunctionDefinition {
|
||||||
|
val function = FunctionDefinition(
|
||||||
|
name,
|
||||||
|
javaName,
|
||||||
|
jsName,
|
||||||
|
nativeName,
|
||||||
|
returnType = returnType,
|
||||||
|
dynamicJsReturn = dynamicJsReturn,
|
||||||
|
isStateCreationFunction = isStateCreationFunction,
|
||||||
|
outputLengthWhenArray = outputLengthWhenArray
|
||||||
|
)
|
||||||
|
function.body()
|
||||||
|
return function
|
||||||
|
}
|
||||||
|
|
||||||
|
fun funcDef(
|
||||||
|
name: String,
|
||||||
|
returnType: GeneralTypeDefinition,
|
||||||
|
dynamicJsReturn: Boolean = false,
|
||||||
|
isStateCreationFunction: Boolean = false,
|
||||||
|
outputLengthWhenArray: Int = -1,
|
||||||
|
body: FunctionDefinition.() -> Unit
|
||||||
|
): FunctionDefinition {
|
||||||
|
val function =
|
||||||
|
FunctionDefinition(
|
||||||
|
name,
|
||||||
|
name,
|
||||||
|
name,
|
||||||
|
name,
|
||||||
|
returnType = returnType,
|
||||||
|
dynamicJsReturn = dynamicJsReturn,
|
||||||
|
isStateCreationFunction = isStateCreationFunction,
|
||||||
|
outputLengthWhenArray = outputLengthWhenArray
|
||||||
|
)
|
||||||
|
function.body()
|
||||||
|
return function
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.generator.libsodium.definitions
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 01-Aug-2020
|
||||||
|
*/
|
||||||
|
object LibSodiumDefinitions {
|
||||||
|
val testKotlinFile = fileDef("DebugTest") {
|
||||||
|
+classDef("Crypto") {
|
||||||
|
defineHashFunctions()
|
||||||
|
defineGenericHashFunctions()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.generator.libsodium.definitions
|
||||||
|
|
||||||
|
import com.squareup.kotlinpoet.ClassName
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 04-Aug-2020
|
||||||
|
*/
|
||||||
|
fun ClassDefinition.defineGenericHashFunctions() {
|
||||||
|
/*
|
||||||
|
* ------------- GENERIC HASH (BLAKE2B)
|
||||||
|
*/
|
||||||
|
|
||||||
|
+innerClassDef(
|
||||||
|
"GenericHashState",
|
||||||
|
"kotlin.ByteArray",
|
||||||
|
"Uint8Array",
|
||||||
|
"crypto_generichash_blake2b_state"
|
||||||
|
)
|
||||||
|
|
||||||
|
+funcDef(
|
||||||
|
"crypto_generichash_init",
|
||||||
|
CustomTypeDefinition(ClassName(packageName, "GenericHashState")),
|
||||||
|
true,
|
||||||
|
isStateCreationFunction = true
|
||||||
|
) {
|
||||||
|
+ParameterDefinition(
|
||||||
|
"state",
|
||||||
|
CustomTypeDefinition((withPackageName("GenericHashState"))),
|
||||||
|
isStateType = true,
|
||||||
|
dropParameterFromDefinition = true,
|
||||||
|
specificJvmInitializer = "sodium.crypto_generichash_statebytes()"
|
||||||
|
)
|
||||||
|
+ParameterDefinition("key", TypeDefinition.ARRAY_OF_UBYTES)
|
||||||
|
+ParameterDefinition("outlen", TypeDefinition.INT, modifiesReturn = true)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,80 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.generator.libsodium.definitions
|
||||||
|
|
||||||
|
import com.squareup.kotlinpoet.ClassName
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 04-Aug-2020
|
||||||
|
*/
|
||||||
|
fun ClassDefinition.defineHashFunctions() {
|
||||||
|
/*
|
||||||
|
--------------- SHA256
|
||||||
|
*/
|
||||||
|
+innerClassDef(
|
||||||
|
"Sha256State",
|
||||||
|
"com.goterl.lazycode.lazysodium.interfaces.Hash.State256",
|
||||||
|
"Sha256State",
|
||||||
|
"crypto_hash_sha256_state"
|
||||||
|
)
|
||||||
|
+funcDef(
|
||||||
|
"crypto_hash_sha256_init",
|
||||||
|
CustomTypeDefinition(ClassName(packageName, "Sha256State")),
|
||||||
|
dynamicJsReturn = true,
|
||||||
|
isStateCreationFunction = true
|
||||||
|
) {
|
||||||
|
+ParameterDefinition(
|
||||||
|
"state",
|
||||||
|
CustomTypeDefinition((withPackageName("Sha256State"))),
|
||||||
|
dropParameterFromDefinition = true,
|
||||||
|
isStateType = true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
+funcDef("crypto_hash_sha256_update", TypeDefinition.UNIT) {
|
||||||
|
+ParameterDefinition(
|
||||||
|
"state",
|
||||||
|
CustomTypeDefinition((withPackageName("Sha256State"))),
|
||||||
|
isStateType = true
|
||||||
|
)
|
||||||
|
+ParameterDefinition("input", TypeDefinition.ARRAY_OF_UBYTES_LONG_SIZE)
|
||||||
|
}
|
||||||
|
|
||||||
|
+funcDef("crypto_hash_sha256_final", TypeDefinition.ARRAY_OF_UBYTES, outputLengthWhenArray = 32) {
|
||||||
|
+ParameterDefinition("state", CustomTypeDefinition((withPackageName("Sha256State"))))
|
||||||
|
+ParameterDefinition("out", TypeDefinition.ARRAY_OF_UBYTES_NO_SIZE, isActuallyAnOutputParam = true, dropParameterFromDefinition = true)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
--------------- SHA512
|
||||||
|
*/
|
||||||
|
+innerClassDef(
|
||||||
|
"Sha512State",
|
||||||
|
"com.goterl.lazycode.lazysodium.interfaces.Hash.State512",
|
||||||
|
"Sha512State",
|
||||||
|
"crypto_hash_sha512_state"
|
||||||
|
)
|
||||||
|
+funcDef(
|
||||||
|
"crypto_hash_sha512_init",
|
||||||
|
CustomTypeDefinition(ClassName(packageName, "Sha512State")),
|
||||||
|
true,
|
||||||
|
isStateCreationFunction = true
|
||||||
|
) {
|
||||||
|
+ParameterDefinition(
|
||||||
|
"state",
|
||||||
|
CustomTypeDefinition((withPackageName("Sha512State"))),
|
||||||
|
dropParameterFromDefinition = true,
|
||||||
|
isStateType = true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
+funcDef("crypto_hash_sha512_update", TypeDefinition.UNIT) {
|
||||||
|
+ParameterDefinition("state", CustomTypeDefinition((withPackageName("Sha512State"))))
|
||||||
|
+ParameterDefinition("input", TypeDefinition.ARRAY_OF_UBYTES_LONG_SIZE)
|
||||||
|
}
|
||||||
|
|
||||||
|
+funcDef("crypto_hash_sha512_final", TypeDefinition.ARRAY_OF_UBYTES, outputLengthWhenArray = 64) {
|
||||||
|
+ParameterDefinition("state", CustomTypeDefinition((withPackageName("Sha512State"))))
|
||||||
|
+ParameterDefinition("out", TypeDefinition.ARRAY_OF_UBYTES_NO_SIZE, isActuallyAnOutputParam = true, dropParameterFromDefinition = true)
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,89 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.generator.libsodium.generator
|
||||||
|
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.definitions.FunctionDefinition
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.definitions.InnerClassDefinition
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.definitions.KotlinFileDefinition
|
||||||
|
import com.squareup.kotlinpoet.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 31-Jul-2020
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum class MultiplatformModifier(val modifierList: List<KModifier>) {
|
||||||
|
EXPECT(listOf(KModifier.EXPECT)),
|
||||||
|
ACTUAL(listOf(KModifier.ACTUAL)),
|
||||||
|
NONE(listOf())
|
||||||
|
}
|
||||||
|
|
||||||
|
object CommonLibsodiumGenerator {
|
||||||
|
|
||||||
|
fun createCommonFile(packageName: String, fileDefinition: KotlinFileDefinition): FileSpec {
|
||||||
|
val fileBuilder = FileSpec.builder(packageName, fileDefinition.name)
|
||||||
|
for (commonClassDefinition in fileDefinition.commonClassList) {
|
||||||
|
//Create expected inner classes that will be represented by type-aliases
|
||||||
|
commonClassDefinition.innerClasses.forEach {
|
||||||
|
fileBuilder.addType(createCommonInnerClassSpec(it, MultiplatformModifier.EXPECT))
|
||||||
|
}
|
||||||
|
val commonClassSpec =
|
||||||
|
createClass(
|
||||||
|
commonClassDefinition,
|
||||||
|
MultiplatformModifier.EXPECT,
|
||||||
|
::createCommonMethodSpec
|
||||||
|
)
|
||||||
|
fileBuilder.addType(commonClassSpec.build())
|
||||||
|
}
|
||||||
|
val file = fileBuilder.build()
|
||||||
|
file.writeTo(System.out)
|
||||||
|
return file
|
||||||
|
}
|
||||||
|
|
||||||
|
fun createCommonInnerClassSpec(
|
||||||
|
innerClassDefinition: InnerClassDefinition,
|
||||||
|
multiplatformModifier: MultiplatformModifier
|
||||||
|
): TypeSpec {
|
||||||
|
val innerClassBuilder = TypeSpec.classBuilder(innerClassDefinition.name)
|
||||||
|
innerClassBuilder.modifiers += multiplatformModifier.modifierList
|
||||||
|
|
||||||
|
return innerClassBuilder.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun createCommonMethodSpec(methodDefinition: FunctionDefinition): FunSpec {
|
||||||
|
val methodBuilder = FunSpec.builder(methodDefinition.name)
|
||||||
|
var actualReturnType : TypeName = Any::class.asTypeName()
|
||||||
|
var actualReturnTypeFound : Boolean = false
|
||||||
|
for (paramDefinition in methodDefinition.parameterList) {
|
||||||
|
if ((paramDefinition.isStateType.not() || methodDefinition.isStateCreationFunction.not()) && paramDefinition.dropParameterFromDefinition.not()) {
|
||||||
|
val parameterSpec =
|
||||||
|
ParameterSpec.builder(paramDefinition.parameterName, paramDefinition.parameterType.typeName)
|
||||||
|
methodBuilder.addParameter(parameterSpec.build())
|
||||||
|
}
|
||||||
|
if (paramDefinition.isActuallyAnOutputParam) {
|
||||||
|
actualReturnTypeFound = true
|
||||||
|
actualReturnType = paramDefinition.parameterType.typeName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (actualReturnTypeFound) {
|
||||||
|
methodBuilder.returns(actualReturnType)
|
||||||
|
} else {
|
||||||
|
methodBuilder.returns(methodDefinition.returnType.typeName)
|
||||||
|
}
|
||||||
|
return methodBuilder.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.generator.libsodium.generator
|
||||||
|
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.definitions.LibSodiumDefinitions
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.definitions.packageName
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 31-Jul-2020
|
||||||
|
*/
|
||||||
|
object Coordinator {
|
||||||
|
|
||||||
|
fun run() {
|
||||||
|
|
||||||
|
val commonFileSpec = CommonLibsodiumGenerator.createCommonFile(packageName, LibSodiumDefinitions.testKotlinFile)
|
||||||
|
val jvmFileSpec = JvmLibsodiumGenerator.createJvmFile(packageName, LibSodiumDefinitions.testKotlinFile)
|
||||||
|
val nativeFileSpec = NativeLibsodiumGenerator.createNativeFile(packageName, LibSodiumDefinitions.testKotlinFile)
|
||||||
|
val jsFileSpec = JsLibsodiumGenerator.createJsFile(packageName, LibSodiumDefinitions.testKotlinFile)
|
||||||
|
|
||||||
|
val commonFile = File("multiplatform-crypto-libsodium-bindings/src/commonMain/kotlin/")
|
||||||
|
commonFileSpec.writeTo(commonFile)
|
||||||
|
val jvmFile = File("multiplatform-crypto-libsodium-bindings/src/jvmMain/kotlin/")
|
||||||
|
jvmFileSpec.writeTo(jvmFile)
|
||||||
|
val nativeFile = File("multiplatform-crypto-libsodium-bindings/src/nativeMain/kotlin/")
|
||||||
|
nativeFileSpec.writeTo(nativeFile)
|
||||||
|
val jsFile = File("multiplatform-crypto-libsodium-bindings/src/jsMain/kotlin/")
|
||||||
|
jsFileSpec.writeTo(jsFile)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,154 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.generator.libsodium.generator
|
||||||
|
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.definitions.*
|
||||||
|
import com.squareup.kotlinpoet.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 31-Jul-2020
|
||||||
|
*/
|
||||||
|
object JsLibsodiumGenerator {
|
||||||
|
|
||||||
|
|
||||||
|
fun createJsFile(packageName: String, fileDefinition: KotlinFileDefinition): FileSpec {
|
||||||
|
val fileBuilder = FileSpec.builder(packageName, fileDefinition.name)
|
||||||
|
fileBuilder.addImport("ext.libsodium.com.ionspin.kotlin.crypto", "toUInt8Array")
|
||||||
|
fileBuilder.addImport("ext.libsodium.com.ionspin.kotlin.crypto", "toUByteArray")
|
||||||
|
fileBuilder.addImport("com.ionspin.kotlin.crypto", "getSodium")
|
||||||
|
for (commonClassDefinition in fileDefinition.commonClassList) {
|
||||||
|
//Create type-aliases
|
||||||
|
commonClassDefinition.innerClasses.forEach {
|
||||||
|
fileBuilder.addTypeAlias(createJsInnerClassSpec(it, MultiplatformModifier.ACTUAL))
|
||||||
|
}
|
||||||
|
|
||||||
|
val commonClassSpec = createClass(
|
||||||
|
commonClassDefinition,
|
||||||
|
MultiplatformModifier.ACTUAL,
|
||||||
|
::createJsFunctionImplementation
|
||||||
|
)
|
||||||
|
fileBuilder.addType(commonClassSpec.build())
|
||||||
|
}
|
||||||
|
val file = fileBuilder.build()
|
||||||
|
file.writeTo(System.out)
|
||||||
|
return file
|
||||||
|
}
|
||||||
|
|
||||||
|
fun createJsInnerClassSpec(
|
||||||
|
innerClassDefinition: InnerClassDefinition,
|
||||||
|
multiplatformModifier: MultiplatformModifier
|
||||||
|
): TypeAliasSpec {
|
||||||
|
val innerClassBuilder = TypeAliasSpec.builder(innerClassDefinition.name, Any::class.asTypeName())
|
||||||
|
innerClassBuilder.modifiers += multiplatformModifier.modifierList
|
||||||
|
|
||||||
|
return innerClassBuilder.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun createJsFunctionImplementation(methodDefinition: FunctionDefinition): FunSpec {
|
||||||
|
val methodBuilder = FunSpec.builder(methodDefinition.name)
|
||||||
|
methodBuilder.modifiers += MultiplatformModifier.ACTUAL.modifierList
|
||||||
|
var returnModifierFound = false
|
||||||
|
var returnModifierName = ""
|
||||||
|
var actualReturnType: TypeName = DYNAMIC
|
||||||
|
var actualReturnTypeFound: Boolean = false
|
||||||
|
for (paramDefinition in methodDefinition.parameterList) {
|
||||||
|
if ((paramDefinition.isStateType.not() || methodDefinition.isStateCreationFunction.not()) && paramDefinition.isActuallyAnOutputParam.not()) {
|
||||||
|
val parameterSpec =
|
||||||
|
ParameterSpec.builder(paramDefinition.parameterName, paramDefinition.parameterType.typeName)
|
||||||
|
methodBuilder.addParameter(parameterSpec.build())
|
||||||
|
}
|
||||||
|
if (paramDefinition.modifiesReturn) {
|
||||||
|
if (returnModifierFound == true) {
|
||||||
|
throw RuntimeException("Return modifier already found")
|
||||||
|
}
|
||||||
|
returnModifierFound = true
|
||||||
|
returnModifierName = paramDefinition.parameterName
|
||||||
|
}
|
||||||
|
if (paramDefinition.isActuallyAnOutputParam) {
|
||||||
|
actualReturnTypeFound = true
|
||||||
|
actualReturnType = paramDefinition.parameterType.typeName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
methodBuilder.addStatement("println(\"Debug ${methodDefinition.name}\")")
|
||||||
|
val constructJsCall = StringBuilder()
|
||||||
|
when (methodDefinition.returnType) {
|
||||||
|
TypeDefinition.ARRAY_OF_UBYTES -> {
|
||||||
|
constructJsCall.append("return getSodium().${methodDefinition.jsName}")
|
||||||
|
constructJsCall.append(paramsToString(methodDefinition) + ".toUByteArray()")
|
||||||
|
}
|
||||||
|
TypeDefinition.INT -> {
|
||||||
|
constructJsCall.append("return getSodium().${methodDefinition.jsName}")
|
||||||
|
constructJsCall.append(paramsToString(methodDefinition))
|
||||||
|
}
|
||||||
|
TypeDefinition.UNIT -> {
|
||||||
|
constructJsCall.append("getSodium().${methodDefinition.jsName}")
|
||||||
|
constructJsCall.append(paramsToString(methodDefinition))
|
||||||
|
}
|
||||||
|
is CustomTypeDefinition -> {
|
||||||
|
if (methodDefinition.parameterList.filter { it.isStateType.not() }.size > 0) {
|
||||||
|
constructJsCall.append("return getSodium().${methodDefinition.jsName}")
|
||||||
|
constructJsCall.append(paramsToString(methodDefinition))
|
||||||
|
} else {
|
||||||
|
constructJsCall.append("val result = js(\"getSodium().${methodDefinition.jsName}()\")")
|
||||||
|
constructJsCall.append("\nreturn result")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
methodBuilder.addStatement(constructJsCall.toString())
|
||||||
|
if (actualReturnTypeFound) {
|
||||||
|
methodBuilder.returns(actualReturnType)
|
||||||
|
return methodBuilder.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (methodDefinition.dynamicJsReturn) {
|
||||||
|
methodBuilder.returns(Dynamic)
|
||||||
|
} else {
|
||||||
|
methodBuilder.returns(methodDefinition.returnType.typeName)
|
||||||
|
}
|
||||||
|
return methodBuilder.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun paramsToString(methodDefinition: FunctionDefinition): String {
|
||||||
|
val paramsBuilder = StringBuilder()
|
||||||
|
paramsBuilder.append("(")
|
||||||
|
val jsParams = methodDefinition.parameterList.filter { it.dropParameterFromDefinition.not() }
|
||||||
|
jsParams.forEachIndexed { index, paramDefinition ->
|
||||||
|
val separator = if (index == jsParams.size - 1) {
|
||||||
|
""
|
||||||
|
} else {
|
||||||
|
", "
|
||||||
|
}
|
||||||
|
if (paramDefinition.parameterType is CustomTypeDefinition) {
|
||||||
|
paramsBuilder.append(paramDefinition.parameterName + separator)
|
||||||
|
}
|
||||||
|
if (paramDefinition.parameterType is TypeDefinition) {
|
||||||
|
when (paramDefinition.parameterType) {
|
||||||
|
TypeDefinition.ARRAY_OF_UBYTES -> {
|
||||||
|
paramsBuilder.append(paramDefinition.parameterName + ".toUInt8Array()" + separator)
|
||||||
|
}
|
||||||
|
TypeDefinition.ARRAY_OF_UBYTES_LONG_SIZE -> {
|
||||||
|
paramsBuilder.append(paramDefinition.parameterName + ".toUInt8Array(), " + separator)
|
||||||
|
}
|
||||||
|
TypeDefinition.ARRAY_OF_UBYTES_NO_SIZE -> {
|
||||||
|
paramsBuilder.append(paramDefinition.parameterName + ".toUInt8Array()" + separator)
|
||||||
|
}
|
||||||
|
TypeDefinition.LONG -> {
|
||||||
|
paramsBuilder.append(paramDefinition.parameterName + separator)
|
||||||
|
}
|
||||||
|
TypeDefinition.INT -> {
|
||||||
|
paramsBuilder.append(paramDefinition.parameterName + separator)
|
||||||
|
}
|
||||||
|
TypeDefinition.STRING -> {
|
||||||
|
paramsBuilder.append(paramDefinition.parameterName + separator)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
paramsBuilder.append(')')
|
||||||
|
return paramsBuilder.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,215 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.generator.libsodium.generator
|
||||||
|
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.definitions.CustomTypeDefinition
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.definitions.FunctionDefinition
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.definitions.InnerClassDefinition
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.definitions.KotlinFileDefinition
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.definitions.ParameterDefinition
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.definitions.TypeDefinition
|
||||||
|
import com.squareup.kotlinpoet.ClassName
|
||||||
|
import com.squareup.kotlinpoet.CodeBlock
|
||||||
|
import com.squareup.kotlinpoet.FileSpec
|
||||||
|
import com.squareup.kotlinpoet.FunSpec
|
||||||
|
import com.squareup.kotlinpoet.ParameterSpec
|
||||||
|
import com.squareup.kotlinpoet.PropertySpec
|
||||||
|
import com.squareup.kotlinpoet.TypeAliasSpec
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 31-Jul-2020
|
||||||
|
*/
|
||||||
|
object JvmLibsodiumGenerator {
|
||||||
|
|
||||||
|
|
||||||
|
fun createJvmFile(packageName: String, fileDefinition: KotlinFileDefinition): FileSpec {
|
||||||
|
val fileBuilder = FileSpec.builder(packageName, fileDefinition.name)
|
||||||
|
val sodiumProperty = PropertySpec.builder("sodium", ClassName.bestGuess("com.goterl.lazycode.lazysodium.SodiumJava"))
|
||||||
|
sodiumProperty.initializer(CodeBlock.of("SodiumJava()"))
|
||||||
|
fileBuilder.addProperty(sodiumProperty.build())
|
||||||
|
for (commonClassDefinition in fileDefinition.commonClassList) {
|
||||||
|
//Create type-aliases
|
||||||
|
commonClassDefinition.innerClasses.forEach {
|
||||||
|
fileBuilder.addTypeAlias(createJvmInnerClassSpec(it, MultiplatformModifier.ACTUAL))
|
||||||
|
}
|
||||||
|
|
||||||
|
val commonClassSpec = createClass(
|
||||||
|
commonClassDefinition,
|
||||||
|
MultiplatformModifier.ACTUAL,
|
||||||
|
::createJvmFunctionImplementation
|
||||||
|
)
|
||||||
|
fileBuilder.addType(commonClassSpec.build())
|
||||||
|
}
|
||||||
|
val file = fileBuilder.build()
|
||||||
|
file.writeTo(System.out)
|
||||||
|
return file
|
||||||
|
}
|
||||||
|
|
||||||
|
fun createJvmInnerClassSpec(
|
||||||
|
innerClassDefinition: InnerClassDefinition,
|
||||||
|
multiplatformModifier: MultiplatformModifier
|
||||||
|
): TypeAliasSpec {
|
||||||
|
val innerClassBuilder = TypeAliasSpec.builder(innerClassDefinition.name, ClassName.bestGuess(innerClassDefinition.javaName))
|
||||||
|
innerClassBuilder.modifiers += multiplatformModifier.modifierList
|
||||||
|
|
||||||
|
return innerClassBuilder.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun createJvmFunctionImplementation(methodDefinition: FunctionDefinition): FunSpec {
|
||||||
|
val methodBuilder = FunSpec.builder(methodDefinition.name)
|
||||||
|
methodBuilder.modifiers += MultiplatformModifier.ACTUAL.modifierList
|
||||||
|
var returnModifierFound = false
|
||||||
|
var returnModifierName = ""
|
||||||
|
lateinit var actualReturnParameterDefinition: ParameterDefinition
|
||||||
|
var actualReturnTypeFound: Boolean = false
|
||||||
|
for (paramDefinition in methodDefinition.parameterList) {
|
||||||
|
if (paramDefinition.isStateType && methodDefinition.isStateCreationFunction) {
|
||||||
|
createStateParam(paramDefinition, methodBuilder)
|
||||||
|
}
|
||||||
|
if ((paramDefinition.isStateType.not() || methodDefinition.isStateCreationFunction.not()) && paramDefinition.isActuallyAnOutputParam.not()) {
|
||||||
|
val parameterSpec =
|
||||||
|
ParameterSpec.builder(paramDefinition.parameterName, paramDefinition.parameterType.typeName)
|
||||||
|
methodBuilder.addParameter(parameterSpec.build())
|
||||||
|
}
|
||||||
|
if (paramDefinition.modifiesReturn) {
|
||||||
|
if (returnModifierFound == true) {
|
||||||
|
throw RuntimeException("Return modifier already found")
|
||||||
|
}
|
||||||
|
returnModifierFound = true
|
||||||
|
returnModifierName = paramDefinition.parameterName
|
||||||
|
}
|
||||||
|
if (paramDefinition.isActuallyAnOutputParam) {
|
||||||
|
actualReturnParameterDefinition = paramDefinition
|
||||||
|
actualReturnTypeFound = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (actualReturnTypeFound) {
|
||||||
|
if (returnModifierFound) {
|
||||||
|
createOutputParam(
|
||||||
|
actualReturnParameterDefinition,
|
||||||
|
returnModifierName,
|
||||||
|
methodBuilder
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
if (methodDefinition.outputLengthWhenArray == -1) {
|
||||||
|
throw RuntimeException("Function definition lacks a way to define output array length, function ${methodDefinition.name}")
|
||||||
|
}
|
||||||
|
createOutputParam(
|
||||||
|
actualReturnParameterDefinition,
|
||||||
|
methodDefinition.outputLengthWhenArray.toString(),
|
||||||
|
methodBuilder
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
methodBuilder.addStatement("println(\"Debug ${methodDefinition.name}\")")
|
||||||
|
val constructJvmCall = StringBuilder()
|
||||||
|
if (methodDefinition.isStateCreationFunction) {
|
||||||
|
constructJvmCall.append("sodium.${methodDefinition.nativeName}")
|
||||||
|
constructJvmCall.append(paramsToString(methodDefinition))
|
||||||
|
methodBuilder.addStatement(constructJvmCall.toString())
|
||||||
|
methodBuilder.addStatement("return state")
|
||||||
|
} else if (actualReturnTypeFound) {
|
||||||
|
constructJvmCall.append("sodium.${methodDefinition.nativeName}")
|
||||||
|
constructJvmCall.append(paramsToString(methodDefinition))
|
||||||
|
methodBuilder.addStatement(constructJvmCall.toString())
|
||||||
|
methodBuilder.addStatement("return out")
|
||||||
|
} else {
|
||||||
|
when (methodDefinition.returnType) {
|
||||||
|
TypeDefinition.ARRAY_OF_UBYTES -> {
|
||||||
|
constructJvmCall.append("val result = sodium.${methodDefinition.nativeName}")
|
||||||
|
constructJvmCall.append(paramsToString(methodDefinition))
|
||||||
|
methodBuilder.addStatement(constructJvmCall.toString())
|
||||||
|
methodBuilder.addStatement("return result")
|
||||||
|
}
|
||||||
|
TypeDefinition.INT -> {
|
||||||
|
constructJvmCall.append("val result = sodium.${methodDefinition.nativeName}")
|
||||||
|
constructJvmCall.append(paramsToString(methodDefinition))
|
||||||
|
methodBuilder.addStatement(constructJvmCall.toString())
|
||||||
|
methodBuilder.addStatement("return result")
|
||||||
|
}
|
||||||
|
TypeDefinition.UNIT -> {
|
||||||
|
constructJvmCall.append("sodium.${methodDefinition.nativeName}")
|
||||||
|
constructJvmCall.append(paramsToString(methodDefinition))
|
||||||
|
methodBuilder.addStatement(constructJvmCall.toString())
|
||||||
|
}
|
||||||
|
is CustomTypeDefinition -> {
|
||||||
|
constructJvmCall.append("val result = sodium.${methodDefinition.nativeName}")
|
||||||
|
constructJvmCall.append(paramsToString(methodDefinition))
|
||||||
|
methodBuilder.addStatement(constructJvmCall.toString())
|
||||||
|
methodBuilder.addStatement("return result")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
methodBuilder.returns(methodDefinition.returnType.typeName)
|
||||||
|
return methodBuilder.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun createOutputParam(outputParam: ParameterDefinition, length: String?, methodBuilder: FunSpec.Builder) {
|
||||||
|
/*
|
||||||
|
val hashed = ByteArray(Sha256Properties.MAX_HASH_BYTES)
|
||||||
|
sodium.crypto_hash_sha256_final(state, hashed)
|
||||||
|
return hashed.asUByteArray()
|
||||||
|
*/
|
||||||
|
when (outputParam.parameterType) {
|
||||||
|
TypeDefinition.ARRAY_OF_UBYTES, TypeDefinition.ARRAY_OF_UBYTES_NO_SIZE, TypeDefinition.ARRAY_OF_UBYTES_LONG_SIZE -> {
|
||||||
|
methodBuilder.addStatement("val out = UByteArray($length)")
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
throw RuntimeException("Unhandled native output param type: ${outputParam.parameterType.typeName}")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun createStateParam(stateParameterDefinition: ParameterDefinition, methodBuilder: FunSpec.Builder) {
|
||||||
|
/*
|
||||||
|
val state = Hash.State256()
|
||||||
|
*/
|
||||||
|
val specificInitializer = stateParameterDefinition.specificJvmInitializer ?: ""
|
||||||
|
methodBuilder.addStatement("val state = ${stateParameterDefinition.parameterType.typeName}($specificInitializer)")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun paramsToString(methodDefinition: FunctionDefinition) : String {
|
||||||
|
val paramsBuilder = StringBuilder()
|
||||||
|
paramsBuilder.append("(")
|
||||||
|
methodDefinition.parameterList.forEachIndexed { index, paramDefinition ->
|
||||||
|
val separator = if (index == methodDefinition.parameterList.size - 1) {
|
||||||
|
""
|
||||||
|
} else {
|
||||||
|
", "
|
||||||
|
}
|
||||||
|
if (paramDefinition.parameterType is CustomTypeDefinition) {
|
||||||
|
paramsBuilder.append(paramDefinition.parameterName + separator)
|
||||||
|
}
|
||||||
|
if (paramDefinition.parameterType is TypeDefinition) {
|
||||||
|
when(paramDefinition.parameterType) {
|
||||||
|
TypeDefinition.ARRAY_OF_UBYTES -> {
|
||||||
|
paramsBuilder.append(paramDefinition.parameterName + ".asByteArray(), " + paramDefinition.parameterName + ".size" + separator)
|
||||||
|
}
|
||||||
|
TypeDefinition.ARRAY_OF_UBYTES_LONG_SIZE -> {
|
||||||
|
paramsBuilder.append(paramDefinition.parameterName + ".asByteArray(), " + paramDefinition.parameterName + ".size.toLong()" + separator)
|
||||||
|
}
|
||||||
|
TypeDefinition.ARRAY_OF_UBYTES_NO_SIZE -> {
|
||||||
|
paramsBuilder.append(paramDefinition.parameterName + ".asByteArray()" + separator)
|
||||||
|
}
|
||||||
|
TypeDefinition.LONG -> {
|
||||||
|
paramsBuilder.append(paramDefinition.parameterName + separator)
|
||||||
|
}
|
||||||
|
TypeDefinition.INT -> {
|
||||||
|
paramsBuilder.append(paramDefinition.parameterName + separator)
|
||||||
|
}
|
||||||
|
TypeDefinition.STRING -> {
|
||||||
|
paramsBuilder.append(paramDefinition.parameterName + separator)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
paramsBuilder.append(')')
|
||||||
|
return paramsBuilder.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,291 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.generator.libsodium.generator
|
||||||
|
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.definitions.CustomTypeDefinition
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.definitions.FunctionDefinition
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.definitions.InnerClassDefinition
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.definitions.KotlinFileDefinition
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.definitions.ParameterDefinition
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.definitions.TypeDefinition
|
||||||
|
import com.squareup.kotlinpoet.ClassName
|
||||||
|
import com.squareup.kotlinpoet.CodeBlock
|
||||||
|
import com.squareup.kotlinpoet.FileSpec
|
||||||
|
import com.squareup.kotlinpoet.FunSpec
|
||||||
|
import com.squareup.kotlinpoet.ParameterSpec
|
||||||
|
import com.squareup.kotlinpoet.PropertySpec
|
||||||
|
import com.squareup.kotlinpoet.TypeAliasSpec
|
||||||
|
import com.squareup.kotlinpoet.asTypeName
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 31-Jul-2020
|
||||||
|
*/
|
||||||
|
object NativeLibsodiumGenerator {
|
||||||
|
|
||||||
|
|
||||||
|
fun createNativeFile(packageName: String, fileDefinition: KotlinFileDefinition): FileSpec {
|
||||||
|
val fileBuilder = FileSpec.builder(packageName, fileDefinition.name)
|
||||||
|
fileBuilder.addImport("kotlinx.cinterop", "toCValues")
|
||||||
|
fileBuilder.addImport("kotlinx.cinterop", "convert")
|
||||||
|
fileBuilder.addImport("kotlinx.cinterop", "ptr")
|
||||||
|
fileBuilder.addImport("kotlinx.cinterop", "pin")
|
||||||
|
fileBuilder.addImport("kotlinx.cinterop", "addressOf")
|
||||||
|
fileBuilder.addImport("kotlinx.cinterop", "reinterpret")
|
||||||
|
fileBuilder.addImport("kotlinx.cinterop", "pointed")
|
||||||
|
fileBuilder.addImport("libsodium", "sodium_malloc")
|
||||||
|
|
||||||
|
for (commonClassDefinition in fileDefinition.commonClassList) {
|
||||||
|
//Create type-aliases
|
||||||
|
commonClassDefinition.innerClasses.forEach {
|
||||||
|
fileBuilder.addTypeAlias(createNativeInnerClassSpec(it, MultiplatformModifier.ACTUAL))
|
||||||
|
}
|
||||||
|
|
||||||
|
val commonClassSpec = createClass(
|
||||||
|
commonClassDefinition,
|
||||||
|
MultiplatformModifier.ACTUAL,
|
||||||
|
::createNativeFunctionImplementation
|
||||||
|
)
|
||||||
|
//Workarounds for native not emitting types
|
||||||
|
val byteEmitter = PropertySpec.builder("_emitByte", Byte::class.asTypeName())
|
||||||
|
byteEmitter.initializer(CodeBlock.of("0"))
|
||||||
|
val byteArrayEmitter = PropertySpec.builder("_emitByteArray", ByteArray::class.asTypeName())
|
||||||
|
byteArrayEmitter.initializer(CodeBlock.of("ByteArray(0)"))
|
||||||
|
commonClassSpec.addProperty(byteEmitter.build())
|
||||||
|
commonClassSpec.addProperty(byteArrayEmitter.build())
|
||||||
|
fileBuilder.addType(commonClassSpec.build())
|
||||||
|
}
|
||||||
|
val file = fileBuilder.build()
|
||||||
|
file.writeTo(System.out)
|
||||||
|
return file
|
||||||
|
}
|
||||||
|
|
||||||
|
fun createNativeInnerClassSpec(
|
||||||
|
innerClassDefinition: InnerClassDefinition,
|
||||||
|
multiplatformModifier: MultiplatformModifier
|
||||||
|
): TypeAliasSpec {
|
||||||
|
val innerClassBuilder =
|
||||||
|
TypeAliasSpec.builder(innerClassDefinition.name, ClassName("libsodium", innerClassDefinition.nativeName))
|
||||||
|
innerClassBuilder.modifiers += multiplatformModifier.modifierList
|
||||||
|
|
||||||
|
return innerClassBuilder.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun createNativeFunctionImplementation(methodDefinition: FunctionDefinition): FunSpec {
|
||||||
|
val methodBuilder = FunSpec.builder(methodDefinition.name)
|
||||||
|
methodBuilder.modifiers += MultiplatformModifier.ACTUAL.modifierList
|
||||||
|
var returnModifierFound = false
|
||||||
|
var returnModifierName = ""
|
||||||
|
lateinit var actualReturnParameterDefinition: ParameterDefinition
|
||||||
|
var actualReturnTypeFound: Boolean = false
|
||||||
|
for (paramDefinition in methodDefinition.parameterList) {
|
||||||
|
if (paramDefinition.isStateType && methodDefinition.isStateCreationFunction) {
|
||||||
|
createStateParam(paramDefinition, methodBuilder)
|
||||||
|
}
|
||||||
|
if ((paramDefinition.isStateType.not() || methodDefinition.isStateCreationFunction.not()) && paramDefinition.isActuallyAnOutputParam.not()) {
|
||||||
|
val parameterSpec =
|
||||||
|
ParameterSpec.builder(paramDefinition.parameterName, paramDefinition.parameterType.typeName)
|
||||||
|
methodBuilder.addParameter(parameterSpec.build())
|
||||||
|
}
|
||||||
|
if (paramDefinition.modifiesReturn) {
|
||||||
|
if (returnModifierFound == true) {
|
||||||
|
throw RuntimeException("Return modifier already found")
|
||||||
|
}
|
||||||
|
returnModifierFound = true
|
||||||
|
returnModifierName = paramDefinition.parameterName
|
||||||
|
}
|
||||||
|
if (paramDefinition.isActuallyAnOutputParam) {
|
||||||
|
actualReturnParameterDefinition = paramDefinition
|
||||||
|
actualReturnTypeFound = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (actualReturnTypeFound) {
|
||||||
|
if (returnModifierFound) {
|
||||||
|
createOutputParam(actualReturnParameterDefinition, returnModifierName, methodBuilder)
|
||||||
|
} else {
|
||||||
|
if (methodDefinition.outputLengthWhenArray == -1) {
|
||||||
|
throw RuntimeException("Function definition lacks a way to define output array length, function ${methodDefinition.name}")
|
||||||
|
}
|
||||||
|
createOutputParam(actualReturnParameterDefinition, methodDefinition.outputLengthWhenArray.toString(), methodBuilder)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
methodBuilder.addStatement("println(\"Debug ${methodDefinition.name}\")")
|
||||||
|
pinParams(methodDefinition, methodBuilder)
|
||||||
|
val constructNativeCall = StringBuilder()
|
||||||
|
if (methodDefinition.isStateCreationFunction) {
|
||||||
|
constructNativeCall.append("libsodium.${methodDefinition.nativeName}")
|
||||||
|
constructNativeCall.append(paramsToString(methodDefinition))
|
||||||
|
methodBuilder.addStatement(constructNativeCall.toString())
|
||||||
|
unpinParams(methodDefinition, methodBuilder)
|
||||||
|
methodBuilder.addStatement("return state")
|
||||||
|
} else if (actualReturnTypeFound) {
|
||||||
|
constructNativeCall.append("libsodium.${methodDefinition.nativeName}")
|
||||||
|
constructNativeCall.append(paramsToString(methodDefinition))
|
||||||
|
methodBuilder.addStatement(constructNativeCall.toString())
|
||||||
|
unpinParams(methodDefinition, methodBuilder)
|
||||||
|
methodBuilder.addStatement("return out")
|
||||||
|
} else {
|
||||||
|
when (methodDefinition.returnType) {
|
||||||
|
TypeDefinition.ARRAY_OF_UBYTES -> {
|
||||||
|
constructNativeCall.append("val result = libsodium.${methodDefinition.nativeName}")
|
||||||
|
constructNativeCall.append(paramsToString(methodDefinition))
|
||||||
|
methodBuilder.addStatement(constructNativeCall.toString())
|
||||||
|
unpinParams(methodDefinition, methodBuilder)
|
||||||
|
methodBuilder.addStatement("return result")
|
||||||
|
}
|
||||||
|
TypeDefinition.INT -> {
|
||||||
|
constructNativeCall.append("val result = libsodium.${methodDefinition.nativeName}")
|
||||||
|
constructNativeCall.append(paramsToString(methodDefinition))
|
||||||
|
methodBuilder.addStatement(constructNativeCall.toString())
|
||||||
|
unpinParams(methodDefinition, methodBuilder)
|
||||||
|
methodBuilder.addStatement("return result")
|
||||||
|
}
|
||||||
|
TypeDefinition.UNIT -> {
|
||||||
|
constructNativeCall.append("libsodium.${methodDefinition.nativeName}")
|
||||||
|
constructNativeCall.append(paramsToString(methodDefinition))
|
||||||
|
methodBuilder.addStatement(constructNativeCall.toString())
|
||||||
|
unpinParams(methodDefinition, methodBuilder)
|
||||||
|
}
|
||||||
|
is CustomTypeDefinition -> {
|
||||||
|
constructNativeCall.append("val result = libsodium.${methodDefinition.nativeName}")
|
||||||
|
constructNativeCall.append(paramsToString(methodDefinition))
|
||||||
|
methodBuilder.addStatement(constructNativeCall.toString())
|
||||||
|
unpinParams(methodDefinition, methodBuilder)
|
||||||
|
methodBuilder.addStatement("return result")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
methodBuilder.returns(methodDefinition.returnType.typeName)
|
||||||
|
|
||||||
|
return methodBuilder.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun createStateParam(stateParameterDefinition: ParameterDefinition, methodBuilder: FunSpec.Builder) {
|
||||||
|
/*
|
||||||
|
val allocated = sodium_malloc(crypto_hash_sha256_state.size.convert())!!
|
||||||
|
state = allocated.reinterpret<crypto_hash_sha256_state>().pointed
|
||||||
|
*/
|
||||||
|
methodBuilder.addStatement("val allocated = sodium_malloc(${stateParameterDefinition.parameterType.typeName}.size.convert())!!")
|
||||||
|
methodBuilder.addStatement("val state = allocated.reinterpret<${stateParameterDefinition.parameterType.typeName}>().pointed")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun createOutputParam(outputParam: ParameterDefinition, length: String?, methodBuilder: FunSpec.Builder) {
|
||||||
|
/*
|
||||||
|
val hashResult = UByteArray(Sha256Properties.MAX_HASH_BYTES)
|
||||||
|
val hashResultPinned = hashResult.pin()
|
||||||
|
crypto_hash_sha256_final(state.ptr, hashResultPinned.addressOf(0))
|
||||||
|
sodium_free(state.ptr)
|
||||||
|
return hashResult
|
||||||
|
*/
|
||||||
|
when (outputParam.parameterType) {
|
||||||
|
TypeDefinition.ARRAY_OF_UBYTES, TypeDefinition.ARRAY_OF_UBYTES_NO_SIZE, TypeDefinition.ARRAY_OF_UBYTES_LONG_SIZE -> {
|
||||||
|
methodBuilder.addStatement("val out = UByteArray($length)")
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
throw RuntimeException("Unhandled native output param type: ${outputParam.parameterType.typeName}")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun pinParams(methodDefinition: FunctionDefinition, methodBuilder: FunSpec.Builder) {
|
||||||
|
methodDefinition.parameterList.forEachIndexed { index, paramDefinition ->
|
||||||
|
if (paramDefinition.parameterType is TypeDefinition) {
|
||||||
|
when (paramDefinition.parameterType) {
|
||||||
|
TypeDefinition.ARRAY_OF_UBYTES -> {
|
||||||
|
methodBuilder.addStatement("val pinned${paramDefinition.parameterName.capitalize()} = ${paramDefinition.parameterName}.pin()")
|
||||||
|
}
|
||||||
|
TypeDefinition.ARRAY_OF_UBYTES_LONG_SIZE -> {
|
||||||
|
methodBuilder.addStatement("val pinned${paramDefinition.parameterName.capitalize()} = ${paramDefinition.parameterName}.pin()")
|
||||||
|
}
|
||||||
|
TypeDefinition.ARRAY_OF_UBYTES_NO_SIZE -> {
|
||||||
|
methodBuilder.addStatement("val pinned${paramDefinition.parameterName.capitalize()} = ${paramDefinition.parameterName}.pin()")
|
||||||
|
}
|
||||||
|
TypeDefinition.LONG -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
TypeDefinition.INT -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
TypeDefinition.STRING -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun unpinParams(methodDefinition: FunctionDefinition, methodBuilder: FunSpec.Builder) {
|
||||||
|
methodDefinition.parameterList.forEachIndexed { index, paramDefinition ->
|
||||||
|
if (paramDefinition.parameterType is TypeDefinition) {
|
||||||
|
when (paramDefinition.parameterType) {
|
||||||
|
TypeDefinition.ARRAY_OF_UBYTES -> {
|
||||||
|
methodBuilder.addStatement("pinned${paramDefinition.parameterName.capitalize()}.unpin()")
|
||||||
|
}
|
||||||
|
TypeDefinition.ARRAY_OF_UBYTES_LONG_SIZE -> {
|
||||||
|
methodBuilder.addStatement("pinned${paramDefinition.parameterName.capitalize()}.unpin()")
|
||||||
|
}
|
||||||
|
TypeDefinition.ARRAY_OF_UBYTES_NO_SIZE -> {
|
||||||
|
methodBuilder.addStatement("pinned${paramDefinition.parameterName.capitalize()}.unpin()")
|
||||||
|
}
|
||||||
|
TypeDefinition.LONG -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
TypeDefinition.INT -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
TypeDefinition.STRING -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun paramsToString(methodDefinition: FunctionDefinition): String {
|
||||||
|
val paramsBuilder = StringBuilder()
|
||||||
|
paramsBuilder.append("(")
|
||||||
|
methodDefinition.parameterList.forEachIndexed { index, paramDefinition ->
|
||||||
|
val separator = if (index == methodDefinition.parameterList.size - 1) {
|
||||||
|
""
|
||||||
|
} else {
|
||||||
|
", "
|
||||||
|
}
|
||||||
|
if (paramDefinition.parameterType is CustomTypeDefinition) {
|
||||||
|
paramsBuilder.append(paramDefinition.parameterName + ".ptr" + separator)
|
||||||
|
}
|
||||||
|
if (paramDefinition.parameterType is TypeDefinition) {
|
||||||
|
when (paramDefinition.parameterType) {
|
||||||
|
TypeDefinition.ARRAY_OF_UBYTES -> {
|
||||||
|
paramsBuilder.append("pinned" + paramDefinition.parameterName.capitalize() + ".addressOf(0), " + paramDefinition.parameterName + ".size.convert()" + separator)
|
||||||
|
}
|
||||||
|
TypeDefinition.ARRAY_OF_UBYTES_LONG_SIZE -> {
|
||||||
|
paramsBuilder.append("pinned" + paramDefinition.parameterName.capitalize() + ".addressOf(0), " + paramDefinition.parameterName + ".size.convert()" + separator)
|
||||||
|
}
|
||||||
|
TypeDefinition.ARRAY_OF_UBYTES_NO_SIZE -> {
|
||||||
|
paramsBuilder.append("pinned" + paramDefinition.parameterName.capitalize() + ".addressOf(0)" + separator)
|
||||||
|
}
|
||||||
|
TypeDefinition.LONG -> {
|
||||||
|
paramsBuilder.append(paramDefinition.parameterName + ".convert()" + separator)
|
||||||
|
}
|
||||||
|
TypeDefinition.INT -> {
|
||||||
|
paramsBuilder.append(paramDefinition.parameterName + ".convert()" + separator)
|
||||||
|
}
|
||||||
|
TypeDefinition.STRING -> {
|
||||||
|
paramsBuilder.append(paramDefinition.parameterName + separator)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
paramsBuilder.append(')')
|
||||||
|
return paramsBuilder.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.generator.libsodium.generator
|
||||||
|
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.definitions.ClassDefinition
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.definitions.FunctionDefinition
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.definitions.InnerClassDefinition
|
||||||
|
import com.squareup.kotlinpoet.FunSpec
|
||||||
|
import com.squareup.kotlinpoet.KModifier
|
||||||
|
import com.squareup.kotlinpoet.TypeSpec
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 31-Jul-2020
|
||||||
|
*/
|
||||||
|
fun createClass(
|
||||||
|
classDefinition: ClassDefinition,
|
||||||
|
multiplatformModifier: MultiplatformModifier,
|
||||||
|
methodCreator: (FunctionDefinition) -> FunSpec
|
||||||
|
): TypeSpec.Builder {
|
||||||
|
val commonClassBuilder = TypeSpec.classBuilder(classDefinition.name)
|
||||||
|
// Ugly
|
||||||
|
val primaryConstructor = FunSpec.constructorBuilder()
|
||||||
|
if (multiplatformModifier == MultiplatformModifier.EXPECT) {
|
||||||
|
primaryConstructor.addModifiers(KModifier.INTERNAL)
|
||||||
|
} else {
|
||||||
|
primaryConstructor.addModifiers(KModifier.INTERNAL, KModifier.ACTUAL)
|
||||||
|
}
|
||||||
|
|
||||||
|
commonClassBuilder.primaryConstructor(primaryConstructor.build())
|
||||||
|
commonClassBuilder.modifiers += multiplatformModifier.modifierList
|
||||||
|
for (methodDefinition in classDefinition.methods) {
|
||||||
|
commonClassBuilder.addFunction(methodCreator(methodDefinition))
|
||||||
|
}
|
||||||
|
return commonClassBuilder
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,101 @@
|
|||||||
|
// IntelliJ API Decompiler stub source generated from a class file
|
||||||
|
// Implementation of methods is not available
|
||||||
|
|
||||||
|
package libsodium
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CStruct public final class crypto_aead_aes256gcm_state_ public constructor(rawPtr: kotlinx.cinterop.NativePtr /* = kotlin.native.internal.NativePtr */) : kotlinx.cinterop.CStructVar {
|
||||||
|
@kotlinx.cinterop.internal.CStruct.VarType public companion object : kotlinx.cinterop.CStructVar.Type {
|
||||||
|
}
|
||||||
|
|
||||||
|
public final val opaque: kotlinx.cinterop.CArrayPointer<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */> /* = kotlinx.cinterop.CPointer<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */> */ /* compiled code */
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CStruct public final class crypto_hash_sha512_state public constructor(rawPtr: kotlinx.cinterop.NativePtr /* = kotlin.native.internal.NativePtr */) : kotlinx.cinterop.CStructVar {
|
||||||
|
@kotlinx.cinterop.internal.CStruct.VarType public companion object : kotlinx.cinterop.CStructVar.Type {
|
||||||
|
}
|
||||||
|
|
||||||
|
public final val buf: kotlinx.cinterop.CArrayPointer<platform.posix.uint8_tVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */> /* = kotlinx.cinterop.CPointer<platform.posix.uint8_tVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */> */ /* compiled code */
|
||||||
|
|
||||||
|
public final val count: kotlinx.cinterop.CArrayPointer<platform.posix.uint64_tVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */> /* = kotlinx.cinterop.CPointer<platform.posix.uint64_tVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */> */ /* compiled code */
|
||||||
|
|
||||||
|
public final val state: kotlinx.cinterop.CArrayPointer<platform.posix.uint64_tVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */> /* = kotlinx.cinterop.CPointer<platform.posix.uint64_tVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */> */ /* compiled code */
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CStruct public final class crypto_auth_hmacsha512_state public constructor(rawPtr: kotlinx.cinterop.NativePtr /* = kotlin.native.internal.NativePtr */) : kotlinx.cinterop.CStructVar {
|
||||||
|
@kotlinx.cinterop.internal.CStruct.VarType public companion object : kotlinx.cinterop.CStructVar.Type {
|
||||||
|
}
|
||||||
|
|
||||||
|
public final val ictx: libsodium.crypto_hash_sha512_state /* compiled code */
|
||||||
|
|
||||||
|
public final val octx: libsodium.crypto_hash_sha512_state /* compiled code */
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CStruct public final class crypto_hash_sha256_state public constructor(rawPtr: kotlinx.cinterop.NativePtr /* = kotlin.native.internal.NativePtr */) : kotlinx.cinterop.CStructVar {
|
||||||
|
@kotlinx.cinterop.internal.CStruct.VarType public companion object : kotlinx.cinterop.CStructVar.Type {
|
||||||
|
}
|
||||||
|
|
||||||
|
public final val buf: kotlinx.cinterop.CArrayPointer<platform.posix.uint8_tVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */> /* = kotlinx.cinterop.CPointer<platform.posix.uint8_tVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */> */ /* compiled code */
|
||||||
|
|
||||||
|
public final var count: platform.posix.uint64_t /* = kotlin.ULong */ /* compiled code */
|
||||||
|
|
||||||
|
public final val state: kotlinx.cinterop.CArrayPointer<platform.posix.uint32_tVar /* = kotlinx.cinterop.UIntVarOf<kotlin.UInt> */> /* = kotlinx.cinterop.CPointer<platform.posix.uint32_tVar /* = kotlinx.cinterop.UIntVarOf<kotlin.UInt> */> */ /* compiled code */
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CStruct public final class crypto_auth_hmacsha256_state public constructor(rawPtr: kotlinx.cinterop.NativePtr /* = kotlin.native.internal.NativePtr */) : kotlinx.cinterop.CStructVar {
|
||||||
|
@kotlinx.cinterop.internal.CStruct.VarType public companion object : kotlinx.cinterop.CStructVar.Type {
|
||||||
|
}
|
||||||
|
|
||||||
|
public final val ictx: libsodium.crypto_hash_sha256_state /* compiled code */
|
||||||
|
|
||||||
|
public final val octx: libsodium.crypto_hash_sha256_state /* compiled code */
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CStruct public final class crypto_generichash_blake2b_state public constructor(rawPtr: kotlinx.cinterop.NativePtr /* = kotlin.native.internal.NativePtr */) : kotlinx.cinterop.CStructVar {
|
||||||
|
@kotlinx.cinterop.internal.CStruct.VarType public companion object : kotlinx.cinterop.CStructVar.Type {
|
||||||
|
}
|
||||||
|
|
||||||
|
public final val opaque: kotlinx.cinterop.CArrayPointer<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */> /* = kotlinx.cinterop.CPointer<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */> */ /* compiled code */
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CStruct public final class crypto_onetimeauth_poly1305_state public constructor(rawPtr: kotlinx.cinterop.NativePtr /* = kotlin.native.internal.NativePtr */) : kotlinx.cinterop.CStructVar {
|
||||||
|
@kotlinx.cinterop.internal.CStruct.VarType public companion object : kotlinx.cinterop.CStructVar.Type {
|
||||||
|
}
|
||||||
|
|
||||||
|
public final val opaque: kotlinx.cinterop.CArrayPointer<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */> /* = kotlinx.cinterop.CPointer<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */> */ /* compiled code */
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CStruct public final class crypto_secretstream_xchacha20poly1305_state public constructor(rawPtr: kotlinx.cinterop.NativePtr /* = kotlin.native.internal.NativePtr */) : kotlinx.cinterop.CStructVar {
|
||||||
|
@kotlinx.cinterop.internal.CStruct.VarType public companion object : kotlinx.cinterop.CStructVar.Type {
|
||||||
|
}
|
||||||
|
|
||||||
|
public final val _pad: kotlinx.cinterop.CArrayPointer<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */> /* = kotlinx.cinterop.CPointer<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */> */ /* compiled code */
|
||||||
|
|
||||||
|
public final val k: kotlinx.cinterop.CArrayPointer<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */> /* = kotlinx.cinterop.CPointer<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */> */ /* compiled code */
|
||||||
|
|
||||||
|
public final val nonce: kotlinx.cinterop.CArrayPointer<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */> /* = kotlinx.cinterop.CPointer<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */> */ /* compiled code */
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CStruct public final class crypto_sign_ed25519ph_state public constructor(rawPtr: kotlinx.cinterop.NativePtr /* = kotlin.native.internal.NativePtr */) : kotlinx.cinterop.CStructVar {
|
||||||
|
@kotlinx.cinterop.internal.CStruct.VarType public companion object : kotlinx.cinterop.CStructVar.Type {
|
||||||
|
}
|
||||||
|
|
||||||
|
public final val hs: libsodium.crypto_hash_sha512_state /* compiled code */
|
||||||
|
}
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CStruct public final class randombytes_implementation public constructor(rawPtr: kotlinx.cinterop.NativePtr /* = kotlin.native.internal.NativePtr */) : kotlinx.cinterop.CStructVar {
|
||||||
|
@kotlinx.cinterop.internal.CStruct.VarType public companion object : kotlinx.cinterop.CStructVar.Type {
|
||||||
|
}
|
||||||
|
|
||||||
|
public final var buf: kotlinx.cinterop.CPointer<kotlinx.cinterop.CFunction<(kotlinx.cinterop.COpaquePointer? /* = kotlinx.cinterop.CPointer<out kotlinx.cinterop.CPointed>? */, platform.posix.size_t /* = kotlin.ULong */) -> kotlin.Unit>>? /* compiled code */
|
||||||
|
|
||||||
|
public final var close: kotlinx.cinterop.CPointer<kotlinx.cinterop.CFunction<() -> kotlin.Int>>? /* compiled code */
|
||||||
|
|
||||||
|
public final var implementation_name: kotlinx.cinterop.CPointer<kotlinx.cinterop.CFunction<() -> kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>?>>? /* compiled code */
|
||||||
|
|
||||||
|
public final var random: kotlinx.cinterop.CPointer<kotlinx.cinterop.CFunction<() -> platform.posix.uint32_t /* = kotlin.UInt */>>? /* compiled code */
|
||||||
|
|
||||||
|
public final var stir: kotlinx.cinterop.CPointer<kotlinx.cinterop.CFunction<() -> kotlin.Unit>>? /* compiled code */
|
||||||
|
|
||||||
|
public final var uniform: kotlinx.cinterop.CPointer<kotlinx.cinterop.CFunction<(platform.posix.uint32_t /* = kotlin.UInt */) -> platform.posix.uint32_t /* = kotlin.UInt */>>? /* compiled code */
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,261 @@
|
|||||||
|
// IntelliJ API Decompiler stub source generated from a class file
|
||||||
|
// Implementation of methods is not available
|
||||||
|
|
||||||
|
package libsodium
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aegis128l_abytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aegis128l_decrypt(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aegis128l_decrypt_detached(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aegis128l_encrypt(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aegis128l_encrypt_detached(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, maclen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aegis128l_is_available(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aegis128l_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aegis128l_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aegis128l_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aegis128l_npubbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aegis128l_nsecbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aegis256_abytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aegis256_decrypt(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aegis256_decrypt_detached(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aegis256_encrypt(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aegis256_encrypt_detached(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, maclen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aegis256_is_available(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aegis256_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aegis256_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aegis256_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aegis256_npubbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aegis256_nsecbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aes256gcm_abytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aes256gcm_beforenm(ctx_: kotlinx.cinterop.CValuesRef<libsodium.crypto_aead_aes256gcm_state /* = libsodium.crypto_aead_aes256gcm_state_ */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aes256gcm_decrypt(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aes256gcm_decrypt_afternm(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, ctx_: kotlinx.cinterop.CValuesRef<libsodium.crypto_aead_aes256gcm_state /* = libsodium.crypto_aead_aes256gcm_state_ */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aes256gcm_decrypt_detached(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aes256gcm_decrypt_detached_afternm(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, ctx_: kotlinx.cinterop.CValuesRef<libsodium.crypto_aead_aes256gcm_state /* = libsodium.crypto_aead_aes256gcm_state_ */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aes256gcm_encrypt(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aes256gcm_encrypt_afternm(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, ctx_: kotlinx.cinterop.CValuesRef<libsodium.crypto_aead_aes256gcm_state /* = libsodium.crypto_aead_aes256gcm_state_ */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aes256gcm_encrypt_detached(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, maclen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aes256gcm_encrypt_detached_afternm(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, maclen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, ctx_: kotlinx.cinterop.CValuesRef<libsodium.crypto_aead_aes256gcm_state /* = libsodium.crypto_aead_aes256gcm_state_ */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aes256gcm_is_available(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aes256gcm_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aes256gcm_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aes256gcm_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aes256gcm_npubbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aes256gcm_nsecbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_aes256gcm_statebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_chacha20poly1305_abytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_chacha20poly1305_decrypt(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_chacha20poly1305_decrypt_detached(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_chacha20poly1305_encrypt(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_chacha20poly1305_encrypt_detached(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, maclen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_chacha20poly1305_ietf_abytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_chacha20poly1305_ietf_decrypt(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_chacha20poly1305_ietf_decrypt_detached(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_chacha20poly1305_ietf_encrypt(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_chacha20poly1305_ietf_encrypt_detached(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, maclen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_chacha20poly1305_ietf_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_chacha20poly1305_ietf_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_chacha20poly1305_ietf_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_chacha20poly1305_ietf_npubbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_chacha20poly1305_ietf_nsecbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_chacha20poly1305_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_chacha20poly1305_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_chacha20poly1305_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_chacha20poly1305_npubbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_chacha20poly1305_nsecbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_xchacha20poly1305_ietf_abytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_xchacha20poly1305_ietf_decrypt(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_xchacha20poly1305_ietf_decrypt_detached(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_xchacha20poly1305_ietf_encrypt(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_xchacha20poly1305_ietf_encrypt_detached(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, maclen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, nsec: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, npub: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_xchacha20poly1305_ietf_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_xchacha20poly1305_ietf_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_xchacha20poly1305_ietf_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_xchacha20poly1305_ietf_npubbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_aead_xchacha20poly1305_ietf_nsecbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha256(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha256_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha256_final(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_auth_hmacsha256_state>?, out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha256_init(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_auth_hmacsha256_state>?, key: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, keylen: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha256_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha256_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha256_statebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha256_update(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_auth_hmacsha256_state>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha256_verify(h: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha512(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha512256(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha512256_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha512256_final(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_auth_hmacsha512256_state /* = libsodium.crypto_auth_hmacsha512_state */>?, out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha512256_init(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_auth_hmacsha512256_state /* = libsodium.crypto_auth_hmacsha512_state */>?, key: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, keylen: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha512256_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha512256_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha512256_statebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha512256_update(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_auth_hmacsha512256_state /* = libsodium.crypto_auth_hmacsha512_state */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha512256_verify(h: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha512_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha512_final(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_auth_hmacsha512_state>?, out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha512_init(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_auth_hmacsha512_state>?, key: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, keylen: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha512_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha512_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha512_statebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha512_update(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_auth_hmacsha512_state>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_hmacsha512_verify(h: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_primitive(): kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>? { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_auth_verify(h: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_hash_sha256(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_hash_sha256_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_hash_sha256_final(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_hash_sha256_state>?, out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_hash_sha256_init(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_hash_sha256_state>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_hash_sha256_statebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_hash_sha256_update(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_hash_sha256_state>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_hash_sha512(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_hash_sha512_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_hash_sha512_final(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_hash_sha512_state>?, out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_hash_sha512_init(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_hash_sha512_state>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_hash_sha512_statebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_hash_sha512_update(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_hash_sha512_state>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_xsalsa20(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_xsalsa20_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_xsalsa20_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_xsalsa20_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_xsalsa20_noncebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_xsalsa20_xor(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_xsalsa20_xor_ic(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, ic: platform.posix.uint64_t /* = kotlin.ULong */, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_init(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_library_minimal(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_library_version_major(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_library_version_minor(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_misuse(): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_set_misuse_handler(handler: kotlinx.cinterop.CPointer<kotlinx.cinterop.CFunction<() -> kotlin.Unit>>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_version_string(): kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>? { /* compiled code */ }
|
||||||
|
|
@ -0,0 +1,261 @@
|
|||||||
|
// IntelliJ API Decompiler stub source generated from a class file
|
||||||
|
// Implementation of methods is not available
|
||||||
|
|
||||||
|
package libsodium
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_afternm(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_beforenm(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_beforenmbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_boxzerobytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xsalsa20poly1305(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xsalsa20poly1305_afternm(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xsalsa20poly1305_beforenm(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xsalsa20poly1305_beforenmbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xsalsa20poly1305_boxzerobytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xsalsa20poly1305_keypair(pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xsalsa20poly1305_macbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xsalsa20poly1305_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xsalsa20poly1305_noncebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xsalsa20poly1305_open(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xsalsa20poly1305_open_afternm(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xsalsa20poly1305_publickeybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xsalsa20poly1305_secretkeybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xsalsa20poly1305_seed_keypair(pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, seed: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xsalsa20poly1305_seedbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xsalsa20poly1305_zerobytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_detached(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_detached_afternm(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_easy(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_easy_afternm(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_keypair(pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_macbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_noncebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_open(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_open_afternm(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_open_detached(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_open_detached_afternm(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_open_easy(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_open_easy_afternm(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_primitive(): kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>? { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_publickeybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_seal(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_seal_open(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_sealbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_secretkeybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_seed_keypair(pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, seed: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_seedbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_zerobytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_hchacha20(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_hchacha20_constbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_hchacha20_inputbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_hchacha20_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_hchacha20_outputbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_hsalsa20(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_hsalsa20_constbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_hsalsa20_inputbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_hsalsa20_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_hsalsa20_outputbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_salsa20(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_salsa2012(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_salsa2012_constbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_salsa2012_inputbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_salsa2012_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_salsa2012_outputbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_salsa208(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_salsa208_constbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_salsa208_inputbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_salsa208_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_salsa208_outputbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_salsa20_constbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_salsa20_inputbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_salsa20_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_salsa20_outputbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, outlen: platform.posix.size_t /* = kotlin.ULong */, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong, key: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, keylen: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_blake2b(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, outlen: platform.posix.size_t /* = kotlin.ULong */, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong, key: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, keylen: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_blake2b_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_blake2b_bytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_blake2b_bytes_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_blake2b_final(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_generichash_blake2b_state>?, out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, outlen: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_blake2b_init(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_generichash_blake2b_state>?, key: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, keylen: platform.posix.size_t /* = kotlin.ULong */, outlen: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_blake2b_init_salt_personal(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_generichash_blake2b_state>?, key: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, keylen: platform.posix.size_t /* = kotlin.ULong */, outlen: platform.posix.size_t /* = kotlin.ULong */, salt: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, personal: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_blake2b_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_blake2b_keybytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_blake2b_keybytes_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_blake2b_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_blake2b_personalbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_blake2b_salt_personal(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, outlen: platform.posix.size_t /* = kotlin.ULong */, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong, key: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, keylen: platform.posix.size_t /* = kotlin.ULong */, salt: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, personal: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_blake2b_saltbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_blake2b_statebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_blake2b_update(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_generichash_blake2b_state>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_bytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_bytes_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_final(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_generichash_state /* = libsodium.crypto_generichash_blake2b_state */>?, out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, outlen: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_init(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_generichash_state /* = libsodium.crypto_generichash_blake2b_state */>?, key: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, keylen: platform.posix.size_t /* = kotlin.ULong */, outlen: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_keybytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_keybytes_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_primitive(): kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>? { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_statebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_generichash_update(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_generichash_state /* = libsodium.crypto_generichash_blake2b_state */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_hash(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_hash_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_hash_primitive(): kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>? { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_blake2b_bytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_blake2b_bytes_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_blake2b_contextbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_blake2b_derive_from_key(subkey: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, subkey_len: platform.posix.size_t /* = kotlin.ULong */, subkey_id: platform.posix.uint64_t /* = kotlin.ULong */, ctx: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>?, key: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_blake2b_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_bytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_bytes_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_contextbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_derive_from_key(subkey: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, subkey_len: platform.posix.size_t /* = kotlin.ULong */, subkey_id: platform.posix.uint64_t /* = kotlin.ULong */, ctx: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>?, key: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_primitive(): kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>? { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kx_client_session_keys(rx: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, tx: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, client_pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, client_sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, server_pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kx_keypair(pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kx_primitive(): kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>? { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kx_publickeybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kx_secretkeybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kx_seed_keypair(pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, seed: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kx_seedbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kx_server_session_keys(rx: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, tx: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, server_pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, server_sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, client_pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kx_sessionkeybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_onetimeauth_poly1305(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_onetimeauth_poly1305_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_onetimeauth_poly1305_init(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_onetimeauth_poly1305_state>?, key: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_onetimeauth_poly1305_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_onetimeauth_poly1305_statebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_onetimeauth_poly1305_verify(h: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
@ -0,0 +1,261 @@
|
|||||||
|
// IntelliJ API Decompiler stub source generated from a class file
|
||||||
|
// Implementation of methods is not available
|
||||||
|
|
||||||
|
package libsodium
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_onetimeauth(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_onetimeauth_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_onetimeauth_final(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_onetimeauth_state /* = libsodium.crypto_onetimeauth_poly1305_state */>?, out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_onetimeauth_init(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_onetimeauth_state /* = libsodium.crypto_onetimeauth_poly1305_state */>?, key: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_onetimeauth_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_onetimeauth_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_onetimeauth_poly1305_final(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_onetimeauth_poly1305_state>?, out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_onetimeauth_poly1305_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_onetimeauth_poly1305_update(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_onetimeauth_poly1305_state>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_onetimeauth_primitive(): kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>? { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_onetimeauth_statebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_onetimeauth_update(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_onetimeauth_state /* = libsodium.crypto_onetimeauth_poly1305_state */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_onetimeauth_verify(h: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, outlen: kotlin.ULong, @kotlinx.cinterop.internal.CCall.CString passwd: kotlin.String?, passwdlen: kotlin.ULong, salt: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, opslimit: kotlin.ULong, memlimit: platform.posix.size_t /* = kotlin.ULong */, alg: kotlin.Int): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_alg_argon2i13(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_alg_argon2id13(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_alg_default(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2i(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, outlen: kotlin.ULong, @kotlinx.cinterop.internal.CCall.CString passwd: kotlin.String?, passwdlen: kotlin.ULong, salt: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, opslimit: kotlin.ULong, memlimit: platform.posix.size_t /* = kotlin.ULong */, alg: kotlin.Int): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2i_alg_argon2i13(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2i_bytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2i_bytes_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2i_memlimit_interactive(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2i_memlimit_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2i_memlimit_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2i_memlimit_moderate(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2i_memlimit_sensitive(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2i_opslimit_interactive(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2i_opslimit_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2i_opslimit_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2i_opslimit_moderate(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2i_opslimit_sensitive(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2i_passwd_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2i_passwd_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2i_saltbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2i_str(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>?, @kotlinx.cinterop.internal.CCall.CString passwd: kotlin.String?, passwdlen: kotlin.ULong, opslimit: kotlin.ULong, memlimit: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2i_str_needs_rehash(str: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>?, opslimit: kotlin.ULong, memlimit: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2i_str_verify(str: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>?, @kotlinx.cinterop.internal.CCall.CString passwd: kotlin.String?, passwdlen: kotlin.ULong): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2i_strbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2i_strprefix(): kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>? { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2id(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, outlen: kotlin.ULong, @kotlinx.cinterop.internal.CCall.CString passwd: kotlin.String?, passwdlen: kotlin.ULong, salt: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, opslimit: kotlin.ULong, memlimit: platform.posix.size_t /* = kotlin.ULong */, alg: kotlin.Int): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2id_alg_argon2id13(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2id_bytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2id_bytes_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2id_memlimit_interactive(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2id_memlimit_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2id_memlimit_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2id_memlimit_moderate(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2id_memlimit_sensitive(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2id_opslimit_interactive(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2id_opslimit_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2id_opslimit_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2id_opslimit_moderate(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2id_opslimit_sensitive(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2id_passwd_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2id_passwd_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2id_saltbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2id_str(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>?, @kotlinx.cinterop.internal.CCall.CString passwd: kotlin.String?, passwdlen: kotlin.ULong, opslimit: kotlin.ULong, memlimit: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2id_str_needs_rehash(str: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>?, opslimit: kotlin.ULong, memlimit: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2id_str_verify(str: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>?, @kotlinx.cinterop.internal.CCall.CString passwd: kotlin.String?, passwdlen: kotlin.ULong): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2id_strbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_argon2id_strprefix(): kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>? { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_bytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_bytes_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_memlimit_interactive(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_memlimit_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_memlimit_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_memlimit_moderate(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_memlimit_sensitive(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_opslimit_interactive(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_opslimit_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_opslimit_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_opslimit_moderate(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_opslimit_sensitive(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_passwd_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_passwd_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_primitive(): kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>? { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_saltbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_str(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>?, @kotlinx.cinterop.internal.CCall.CString passwd: kotlin.String?, passwdlen: kotlin.ULong, opslimit: kotlin.ULong, memlimit: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_str_alg(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>?, @kotlinx.cinterop.internal.CCall.CString passwd: kotlin.String?, passwdlen: kotlin.ULong, opslimit: kotlin.ULong, memlimit: platform.posix.size_t /* = kotlin.ULong */, alg: kotlin.Int): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_str_needs_rehash(str: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>?, opslimit: kotlin.ULong, memlimit: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_str_verify(str: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>?, @kotlinx.cinterop.internal.CCall.CString passwd: kotlin.String?, passwdlen: kotlin.ULong): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_strbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_strprefix(): kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>? { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_scalarmult(q: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_scalarmult_base(q: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_scalarmult_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_scalarmult_curve25519(q: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_scalarmult_curve25519_base(q: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_scalarmult_curve25519_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_scalarmult_curve25519_scalarbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_scalarmult_primitive(): kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>? { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_scalarmult_scalarbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_boxzerobytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_detached(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_easy(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_macbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_noncebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_open(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_open_detached(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_open_easy(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_primitive(): kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>? { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_xsalsa20poly1305(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_xsalsa20poly1305_boxzerobytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_xsalsa20poly1305_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_xsalsa20poly1305_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_xsalsa20poly1305_macbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_xsalsa20poly1305_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_xsalsa20poly1305_noncebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_xsalsa20poly1305_open(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_xsalsa20poly1305_zerobytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_zerobytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_chacha20(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_chacha20_ietf(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_chacha20_ietf_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_chacha20_ietf_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_chacha20_ietf_noncebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_chacha20_ietf_xor(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_chacha20_ietf_xor_ic(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, ic: platform.posix.uint32_t /* = kotlin.UInt */, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_chacha20_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_chacha20_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_chacha20_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_chacha20_noncebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_chacha20_xor(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_chacha20_xor_ic(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, ic: platform.posix.uint64_t /* = kotlin.ULong */, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
@ -0,0 +1,261 @@
|
|||||||
|
// IntelliJ API Decompiler stub source generated from a class file
|
||||||
|
// Implementation of methods is not available
|
||||||
|
|
||||||
|
package libsodium
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun _sodium_runtime_get_cpu_features(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretstream_xchacha20poly1305_abytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretstream_xchacha20poly1305_headerbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretstream_xchacha20poly1305_init_pull(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_secretstream_xchacha20poly1305_state>?, header: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretstream_xchacha20poly1305_init_push(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_secretstream_xchacha20poly1305_state>?, header: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretstream_xchacha20poly1305_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretstream_xchacha20poly1305_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretstream_xchacha20poly1305_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretstream_xchacha20poly1305_pull(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_secretstream_xchacha20poly1305_state>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, tag_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretstream_xchacha20poly1305_push(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_secretstream_xchacha20poly1305_state>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, ad: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, adlen: kotlin.ULong, tag: kotlin.UByte): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretstream_xchacha20poly1305_rekey(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_secretstream_xchacha20poly1305_state>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretstream_xchacha20poly1305_statebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretstream_xchacha20poly1305_tag_final(): kotlin.UByte { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretstream_xchacha20poly1305_tag_message(): kotlin.UByte { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretstream_xchacha20poly1305_tag_push(): kotlin.UByte { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretstream_xchacha20poly1305_tag_rekey(): kotlin.UByte { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_shorthash(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_shorthash_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_shorthash_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_shorthash_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_shorthash_primitive(): kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>? { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_shorthash_siphash24(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_shorthash_siphash24_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_shorthash_siphash24_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_shorthash_siphashx24(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, `in`: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, inlen: kotlin.ULong, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_shorthash_siphashx24_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_shorthash_siphashx24_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign(sm: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, smlen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_detached(sig: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, siglen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_ed25519(sm: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, smlen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_ed25519_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_ed25519_detached(sig: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, siglen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_ed25519_keypair(pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_ed25519_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_ed25519_open(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, sm: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, smlen: kotlin.ULong, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_ed25519_pk_to_curve25519(curve25519_pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, ed25519_pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_ed25519_publickeybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_ed25519_secretkeybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_ed25519_seed_keypair(pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, seed: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_ed25519_seedbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_ed25519_sk_to_curve25519(curve25519_sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, ed25519_sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_ed25519_sk_to_pk(pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_ed25519_sk_to_seed(seed: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_ed25519_verify_detached(sig: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_ed25519ph_final_create(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_sign_ed25519ph_state>?, sig: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, siglen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_ed25519ph_final_verify(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_sign_ed25519ph_state>?, sig: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_ed25519ph_init(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_sign_ed25519ph_state>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_ed25519ph_statebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_ed25519ph_update(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_sign_ed25519ph_state>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_final_create(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_sign_state /* = libsodium.crypto_sign_ed25519ph_state */>?, sig: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, siglen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_final_verify(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_sign_state /* = libsodium.crypto_sign_ed25519ph_state */>?, sig: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_init(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_sign_state /* = libsodium.crypto_sign_ed25519ph_state */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_keypair(pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_open(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen_p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ULongVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, sm: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, smlen: kotlin.ULong, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_primitive(): kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>? { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_publickeybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_secretkeybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_seed_keypair(pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, seed: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_seedbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_statebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_update(state: kotlinx.cinterop.CValuesRef<libsodium.crypto_sign_state /* = libsodium.crypto_sign_ed25519ph_state */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_sign_verify_detached(sig: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_chacha20_ietf_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_noncebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_primitive(): kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>? { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_salsa20(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_salsa20_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_salsa20_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_salsa20_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_salsa20_noncebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_salsa20_xor(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_salsa20_xor_ic(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, ic: platform.posix.uint64_t /* = kotlin.ULong */, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_xor(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_verify_16(x: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, y: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_verify_16_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_verify_32(x: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, y: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_verify_32_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_verify_64(x: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, y: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_verify_64_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun randombytes(buf: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, buf_len: kotlin.ULong): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun randombytes_buf(buf: kotlinx.cinterop.CValuesRef<*>?, size: platform.posix.size_t /* = kotlin.ULong */): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun randombytes_buf_deterministic(buf: kotlinx.cinterop.CValuesRef<*>?, size: platform.posix.size_t /* = kotlin.ULong */, seed: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun randombytes_close(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun randombytes_implementation_name(): kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>? { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun randombytes_random(): platform.posix.uint32_t /* = kotlin.UInt */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun randombytes_seedbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun randombytes_set_implementation(impl: kotlinx.cinterop.CValuesRef<libsodium.randombytes_implementation>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun randombytes_stir(): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun randombytes_uniform(upper_bound: platform.posix.uint32_t /* = kotlin.UInt */): platform.posix.uint32_t /* = kotlin.UInt */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_add(a: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, b: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, len: platform.posix.size_t /* = kotlin.ULong */): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_allocarray(count: platform.posix.size_t /* = kotlin.ULong */, size: platform.posix.size_t /* = kotlin.ULong */): kotlinx.cinterop.COpaquePointer? /* = kotlinx.cinterop.CPointer<out kotlinx.cinterop.CPointed>? */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_base642bin(bin: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, bin_maxlen: platform.posix.size_t /* = kotlin.ULong */, @kotlinx.cinterop.internal.CCall.CString b64: kotlin.String?, b64_len: platform.posix.size_t /* = kotlin.ULong */, @kotlinx.cinterop.internal.CCall.CString ignore: kotlin.String?, bin_len: kotlinx.cinterop.CValuesRef<platform.posix.size_tVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, b64_end: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.CPointerVar<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */> /* = kotlinx.cinterop.CPointerVarOf<kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>> */>?, variant: kotlin.Int): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_base64_encoded_len(bin_len: platform.posix.size_t /* = kotlin.ULong */, variant: kotlin.Int): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_bin2base64(b64: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>?, b64_maxlen: platform.posix.size_t /* = kotlin.ULong */, bin: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, bin_len: platform.posix.size_t /* = kotlin.ULong */, variant: kotlin.Int): kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>? { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_bin2hex(hex: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>?, hex_maxlen: platform.posix.size_t /* = kotlin.ULong */, bin: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, bin_len: platform.posix.size_t /* = kotlin.ULong */): kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>? { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_compare(b1_: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, b2_: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, len: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_free(ptr: kotlinx.cinterop.CValuesRef<*>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_hex2bin(bin: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, bin_maxlen: platform.posix.size_t /* = kotlin.ULong */, @kotlinx.cinterop.internal.CCall.CString hex: kotlin.String?, hex_len: platform.posix.size_t /* = kotlin.ULong */, @kotlinx.cinterop.internal.CCall.CString ignore: kotlin.String?, bin_len: kotlinx.cinterop.CValuesRef<platform.posix.size_tVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, hex_end: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.CPointerVar<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */> /* = kotlinx.cinterop.CPointerVarOf<kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_increment(n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, nlen: platform.posix.size_t /* = kotlin.ULong */): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_is_zero(n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, nlen: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_malloc(size: platform.posix.size_t /* = kotlin.ULong */): kotlinx.cinterop.COpaquePointer? /* = kotlinx.cinterop.CPointer<out kotlinx.cinterop.CPointed>? */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_memcmp(b1_: kotlinx.cinterop.CValuesRef<*>?, b2_: kotlinx.cinterop.CValuesRef<*>?, len: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_memzero(pnt: kotlinx.cinterop.CValuesRef<*>?, len: platform.posix.size_t /* = kotlin.ULong */): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_mlock(addr: kotlinx.cinterop.CValuesRef<*>?, len: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_mprotect_noaccess(ptr: kotlinx.cinterop.CValuesRef<*>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_mprotect_readonly(ptr: kotlinx.cinterop.CValuesRef<*>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_mprotect_readwrite(ptr: kotlinx.cinterop.CValuesRef<*>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_munlock(addr: kotlinx.cinterop.CValuesRef<*>?, len: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_runtime_has_aesni(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_runtime_has_armcrypto(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_runtime_has_avx(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_runtime_has_avx2(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_runtime_has_avx512f(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_runtime_has_neon(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_runtime_has_pclmul(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_runtime_has_rdrand(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_runtime_has_sse2(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_runtime_has_sse3(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_runtime_has_sse41(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_runtime_has_ssse3(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_stackzero(len: platform.posix.size_t /* = kotlin.ULong */): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_sub(a: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, b: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, len: platform.posix.size_t /* = kotlin.ULong */): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
@ -0,0 +1,261 @@
|
|||||||
|
// IntelliJ API Decompiler stub source generated from a class file
|
||||||
|
// Implementation of methods is not available
|
||||||
|
|
||||||
|
package libsodium
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun _sodium_alloc_init(): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xchacha20poly1305_beforenm(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xchacha20poly1305_beforenmbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xchacha20poly1305_detached(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xchacha20poly1305_detached_afternm(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xchacha20poly1305_easy(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xchacha20poly1305_easy_afternm(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xchacha20poly1305_keypair(pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xchacha20poly1305_macbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xchacha20poly1305_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xchacha20poly1305_noncebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xchacha20poly1305_open_detached(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xchacha20poly1305_open_detached_afternm(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xchacha20poly1305_open_easy(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xchacha20poly1305_open_easy_afternm(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xchacha20poly1305_publickeybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xchacha20poly1305_seal(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xchacha20poly1305_seal_open(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xchacha20poly1305_sealbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xchacha20poly1305_secretkeybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xchacha20poly1305_seed_keypair(pk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, sk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, seed: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_box_curve25519xchacha20poly1305_seedbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ed25519_add(r: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, q: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ed25519_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ed25519_from_string(p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, @kotlinx.cinterop.internal.CCall.CString ctx: kotlin.String?, msg: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, msg_len: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ed25519_from_string_ro(p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, @kotlinx.cinterop.internal.CCall.CString ctx: kotlin.String?, msg: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, msg_len: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ed25519_from_uniform(p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, r: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ed25519_hashbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ed25519_is_valid_point(p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ed25519_nonreducedscalarbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ed25519_random(p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ed25519_scalar_add(z: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, x: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, y: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ed25519_scalar_complement(comp: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, s: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ed25519_scalar_invert(recip: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, s: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ed25519_scalar_is_canonical(s: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ed25519_scalar_mul(z: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, x: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, y: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ed25519_scalar_negate(neg: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, s: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ed25519_scalar_random(r: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ed25519_scalar_reduce(r: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, s: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ed25519_scalar_sub(z: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, x: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, y: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ed25519_scalarbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ed25519_sub(r: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, q: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ed25519_uniformbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ristretto255_add(r: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, q: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ristretto255_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ristretto255_from_hash(p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, r: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ristretto255_hashbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ristretto255_is_valid_point(p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ristretto255_nonreducedscalarbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ristretto255_random(p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ristretto255_scalar_add(z: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, x: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, y: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ristretto255_scalar_complement(comp: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, s: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ristretto255_scalar_invert(recip: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, s: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ristretto255_scalar_is_canonical(s: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ristretto255_scalar_mul(z: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, x: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, y: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ristretto255_scalar_negate(neg: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, s: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ristretto255_scalar_random(r: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ristretto255_scalar_reduce(r: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, s: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ristretto255_scalar_sub(z: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, x: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, y: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ristretto255_scalarbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_core_ristretto255_sub(r: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, q: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_hkdf_sha256_bytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_hkdf_sha256_bytes_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_hkdf_sha256_expand(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, out_len: platform.posix.size_t /* = kotlin.ULong */, @kotlinx.cinterop.internal.CCall.CString ctx: kotlin.String?, ctx_len: platform.posix.size_t /* = kotlin.ULong */, prk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_hkdf_sha256_extract(prk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, salt: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, salt_len: platform.posix.size_t /* = kotlin.ULong */, ikm: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, ikm_len: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_hkdf_sha256_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_hkdf_sha256_keygen(prk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_hkdf_sha512_bytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_hkdf_sha512_bytes_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_hkdf_sha512_expand(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, out_len: platform.posix.size_t /* = kotlin.ULong */, @kotlinx.cinterop.internal.CCall.CString ctx: kotlin.String?, ctx_len: platform.posix.size_t /* = kotlin.ULong */, prk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_hkdf_sha512_extract(prk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, salt: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, salt_len: platform.posix.size_t /* = kotlin.ULong */, ikm: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, ikm_len: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_hkdf_sha512_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_kdf_hkdf_sha512_keygen(prk: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_scryptsalsa208sha256(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, outlen: kotlin.ULong, @kotlinx.cinterop.internal.CCall.CString passwd: kotlin.String?, passwdlen: kotlin.ULong, salt: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, opslimit: kotlin.ULong, memlimit: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_scryptsalsa208sha256_bytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_scryptsalsa208sha256_bytes_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_scryptsalsa208sha256_ll(passwd: kotlinx.cinterop.CValuesRef<platform.posix.uint8_tVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, passwdlen: platform.posix.size_t /* = kotlin.ULong */, salt: kotlinx.cinterop.CValuesRef<platform.posix.uint8_tVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, saltlen: platform.posix.size_t /* = kotlin.ULong */, N: platform.posix.uint64_t /* = kotlin.ULong */, r: platform.posix.uint32_t /* = kotlin.UInt */, p: platform.posix.uint32_t /* = kotlin.UInt */, buf: kotlinx.cinterop.CValuesRef<platform.posix.uint8_tVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, buflen: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_scryptsalsa208sha256_memlimit_interactive(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_scryptsalsa208sha256_memlimit_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_scryptsalsa208sha256_memlimit_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_scryptsalsa208sha256_opslimit_interactive(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_scryptsalsa208sha256_opslimit_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_scryptsalsa208sha256_opslimit_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_scryptsalsa208sha256_passwd_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_scryptsalsa208sha256_passwd_min(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_scryptsalsa208sha256_saltbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_scryptsalsa208sha256_str(out: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>?, @kotlinx.cinterop.internal.CCall.CString passwd: kotlin.String?, passwdlen: kotlin.ULong, opslimit: kotlin.ULong, memlimit: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_scryptsalsa208sha256_str_needs_rehash(str: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>?, opslimit: kotlin.ULong, memlimit: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_scryptsalsa208sha256_str_verify(str: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>?, @kotlinx.cinterop.internal.CCall.CString passwd: kotlin.String?, passwdlen: kotlin.ULong): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_scryptsalsa208sha256_strbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_pwhash_scryptsalsa208sha256_strprefix(): kotlinx.cinterop.CPointer<kotlinx.cinterop.ByteVar /* = kotlinx.cinterop.ByteVarOf<kotlin.Byte> */>? { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_scalarmult_ed25519(q: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_scalarmult_ed25519_base(q: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_scalarmult_ed25519_base_noclamp(q: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_scalarmult_ed25519_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_scalarmult_ed25519_noclamp(q: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_scalarmult_ed25519_scalarbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_scalarmult_ristretto255(q: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, p: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_scalarmult_ristretto255_base(q: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_scalarmult_ristretto255_bytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_scalarmult_ristretto255_scalarbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_xchacha20poly1305_detached(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_xchacha20poly1305_easy(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_xchacha20poly1305_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_xchacha20poly1305_macbytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_xchacha20poly1305_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_xchacha20poly1305_noncebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_xchacha20poly1305_open_detached(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mac: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_secretbox_xchacha20poly1305_open_easy(m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_salsa2012(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_salsa2012_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_salsa2012_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_salsa2012_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_salsa2012_noncebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_salsa2012_xor(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_salsa208_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_salsa208_noncebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_xchacha20(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_xchacha20_keybytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_xchacha20_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_xchacha20_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_xchacha20_noncebytes(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_xchacha20_xor(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_xchacha20_xor_ic(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, ic: platform.posix.uint64_t /* = kotlin.ULong */, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_pad(padded_buflen_p: kotlinx.cinterop.CValuesRef<platform.posix.size_tVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, buf: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, unpadded_buflen: platform.posix.size_t /* = kotlin.ULong */, blocksize: platform.posix.size_t /* = kotlin.ULong */, max_buflen: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun sodium_unpad(unpadded_buflen_p: kotlinx.cinterop.CValuesRef<platform.posix.size_tVar /* = kotlinx.cinterop.ULongVarOf<kotlin.ULong> */>?, buf: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, padded_buflen: platform.posix.size_t /* = kotlin.ULong */, blocksize: platform.posix.size_t /* = kotlin.ULong */): kotlin.Int { /* compiled code */ }
|
||||||
|
|
@ -0,0 +1,261 @@
|
|||||||
|
// IntelliJ API Decompiler stub source generated from a class file
|
||||||
|
// Implementation of methods is not available
|
||||||
|
|
||||||
|
package libsodium
|
||||||
|
|
||||||
|
public const val SODIUM_LIBRARY_VERSION_MAJOR: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val SODIUM_LIBRARY_VERSION_MINOR: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val SODIUM_SIZE_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val SODIUM_VERSION_STRING: kotlin.String /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_aegis128l_ABYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_aegis128l_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_aegis128l_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_aegis128l_NPUBBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_aegis128l_NSECBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_aegis256_ABYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_aegis256_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_aegis256_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_aegis256_NPUBBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_aegis256_NSECBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_aes256gcm_ABYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_aes256gcm_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_aes256gcm_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_aes256gcm_NPUBBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_aes256gcm_NSECBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_chacha20poly1305_ABYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_chacha20poly1305_IETF_ABYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_chacha20poly1305_IETF_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_chacha20poly1305_IETF_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_chacha20poly1305_IETF_NPUBBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_chacha20poly1305_IETF_NSECBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_chacha20poly1305_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_chacha20poly1305_NPUBBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_chacha20poly1305_NSECBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_chacha20poly1305_ietf_ABYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_chacha20poly1305_ietf_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_chacha20poly1305_ietf_NPUBBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_chacha20poly1305_ietf_NSECBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_xchacha20poly1305_IETF_ABYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_xchacha20poly1305_IETF_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_xchacha20poly1305_IETF_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_xchacha20poly1305_IETF_NPUBBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_xchacha20poly1305_IETF_NSECBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_xchacha20poly1305_ietf_ABYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_xchacha20poly1305_ietf_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_xchacha20poly1305_ietf_NPUBBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_aead_xchacha20poly1305_ietf_NSECBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_auth_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_auth_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_auth_PRIMITIVE: kotlin.String /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_auth_hmacsha256_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_auth_hmacsha256_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_auth_hmacsha512256_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_auth_hmacsha512256_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_auth_hmacsha512_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_auth_hmacsha512_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_BEFORENMBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_BOXZEROBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_MACBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_NONCEBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_PRIMITIVE: kotlin.String /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_PUBLICKEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_SEALBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_SECRETKEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_SEEDBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_ZEROBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_curve25519xsalsa20poly1305_MACBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_curve25519xsalsa20poly1305_NONCEBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_curve25519xsalsa20poly1305_SEEDBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_curve25519xsalsa20poly1305_ZEROBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_hchacha20_CONSTBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_hchacha20_INPUTBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_hchacha20_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_hchacha20_OUTPUTBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_hsalsa20_CONSTBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_hsalsa20_INPUTBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_hsalsa20_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_hsalsa20_OUTPUTBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_salsa2012_CONSTBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_salsa2012_INPUTBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_salsa2012_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_salsa2012_OUTPUTBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_salsa208_CONSTBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_salsa208_INPUTBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_salsa208_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_salsa208_OUTPUTBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_salsa20_CONSTBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_salsa20_INPUTBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_salsa20_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_salsa20_OUTPUTBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_generichash_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_generichash_BYTES_MAX: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_generichash_BYTES_MIN: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_generichash_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_generichash_KEYBYTES_MAX: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_generichash_KEYBYTES_MIN: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_generichash_PRIMITIVE: kotlin.String /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_generichash_blake2b_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_generichash_blake2b_BYTES_MAX: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_generichash_blake2b_BYTES_MIN: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_generichash_blake2b_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_generichash_blake2b_KEYBYTES_MAX: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_generichash_blake2b_KEYBYTES_MIN: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_generichash_blake2b_PERSONALBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_generichash_blake2b_SALTBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_hash_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_hash_PRIMITIVE: kotlin.String /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_hash_sha256_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_hash_sha512_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_kdf_blake2b_BYTES_MAX: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_kdf_blake2b_BYTES_MIN: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_xsalsa20_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_xsalsa20_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_xsalsa20_NONCEBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public val randombytes_internal_implementation: libsodium.randombytes_implementation /* compiled code */
|
||||||
|
|
||||||
|
public val randombytes_sysrandom_implementation: libsodium.randombytes_implementation /* compiled code */
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_salsa208(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, clen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_salsa208_keygen(k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Unit { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_salsa208_messagebytes_max(): platform.posix.size_t /* = kotlin.ULong */ { /* compiled code */ }
|
||||||
|
|
||||||
|
@kotlinx.cinterop.internal.CCall public external fun crypto_stream_salsa208_xor(c: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, m: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, mlen: kotlin.ULong, n: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?, k: kotlinx.cinterop.CValuesRef<kotlinx.cinterop.UByteVar /* = kotlinx.cinterop.UByteVarOf<kotlin.UByte> */>?): kotlin.Int { /* compiled code */ }
|
||||||
|
|
||||||
|
public typealias crypto_aead_aes256gcm_state = libsodium.crypto_aead_aes256gcm_state_
|
||||||
|
|
||||||
|
public typealias crypto_auth_hmacsha512256_state = libsodium.crypto_auth_hmacsha512_state
|
||||||
|
|
||||||
|
public typealias crypto_generichash_state = libsodium.crypto_generichash_blake2b_state
|
||||||
|
|
||||||
|
public typealias crypto_onetimeauth_state = libsodium.crypto_onetimeauth_poly1305_state
|
||||||
|
|
||||||
|
public typealias crypto_sign_state = libsodium.crypto_sign_ed25519ph_state
|
||||||
|
|
@ -0,0 +1,261 @@
|
|||||||
|
// IntelliJ API Decompiler stub source generated from a class file
|
||||||
|
// Implementation of methods is not available
|
||||||
|
|
||||||
|
package libsodium
|
||||||
|
|
||||||
|
public const val crypto_kdf_BYTES_MAX: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_kdf_BYTES_MIN: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_kdf_CONTEXTBYTES: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_kdf_KEYBYTES: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_kdf_PRIMITIVE: kotlin.String /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_kdf_blake2b_CONTEXTBYTES: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_kdf_blake2b_KEYBYTES: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_kx_PRIMITIVE: kotlin.String /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_kx_PUBLICKEYBYTES: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_kx_SECRETKEYBYTES: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_kx_SEEDBYTES: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_kx_SESSIONKEYBYTES: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_onetimeauth_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_onetimeauth_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_onetimeauth_PRIMITIVE: kotlin.String /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_onetimeauth_poly1305_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_onetimeauth_poly1305_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_ALG_ARGON2I13: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_ALG_ARGON2ID13: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_ALG_DEFAULT: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_BYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_BYTES_MIN: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_MEMLIMIT_INTERACTIVE: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_MEMLIMIT_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_MEMLIMIT_MIN: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_MEMLIMIT_MODERATE: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_MEMLIMIT_SENSITIVE: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_OPSLIMIT_INTERACTIVE: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_OPSLIMIT_MAX: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_OPSLIMIT_MIN: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_OPSLIMIT_MODERATE: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_OPSLIMIT_SENSITIVE: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_PASSWD_MAX: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_PASSWD_MIN: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_PRIMITIVE: kotlin.String /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_SALTBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_STRBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_STRPREFIX: kotlin.String /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2i_ALG_ARGON2I13: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2i_BYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2i_BYTES_MIN: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2i_MEMLIMIT_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2i_MEMLIMIT_MIN: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2i_MEMLIMIT_MODERATE: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2i_OPSLIMIT_MAX: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2i_OPSLIMIT_MIN: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2i_OPSLIMIT_MODERATE: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2i_PASSWD_MAX: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2i_PASSWD_MIN: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2i_SALTBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2i_STRBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2i_STRPREFIX: kotlin.String /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2id_ALG_ARGON2ID13: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2id_BYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2id_BYTES_MIN: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2id_MEMLIMIT_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2id_MEMLIMIT_MIN: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2id_MEMLIMIT_MODERATE: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2id_OPSLIMIT_MAX: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2id_OPSLIMIT_MIN: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2id_OPSLIMIT_MODERATE: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2id_PASSWD_MAX: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2id_PASSWD_MIN: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2id_SALTBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2id_STRBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_argon2id_STRPREFIX: kotlin.String /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_scalarmult_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_scalarmult_PRIMITIVE: kotlin.String /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_scalarmult_SCALARBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_scalarmult_curve25519_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_scalarmult_curve25519_SCALARBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretbox_BOXZEROBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretbox_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretbox_MACBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretbox_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretbox_NONCEBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretbox_PRIMITIVE: kotlin.String /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretbox_ZEROBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretbox_xsalsa20poly1305_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretbox_xsalsa20poly1305_MACBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretbox_xsalsa20poly1305_NONCEBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretbox_xsalsa20poly1305_ZEROBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretstream_xchacha20poly1305_ABYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretstream_xchacha20poly1305_HEADERBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretstream_xchacha20poly1305_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretstream_xchacha20poly1305_TAG_FINAL: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretstream_xchacha20poly1305_TAG_MESSAGE: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretstream_xchacha20poly1305_TAG_PUSH: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretstream_xchacha20poly1305_TAG_REKEY: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_shorthash_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_shorthash_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_shorthash_PRIMITIVE: kotlin.String /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_shorthash_siphash24_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_shorthash_siphash24_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_shorthash_siphashx24_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_shorthash_siphashx24_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_sign_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_sign_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_sign_PRIMITIVE: kotlin.String /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_sign_PUBLICKEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_sign_SECRETKEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_sign_SEEDBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_sign_ed25519_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_sign_ed25519_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_sign_ed25519_PUBLICKEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_sign_ed25519_SECRETKEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_sign_ed25519_SEEDBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_chacha20_IETF_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_chacha20_IETF_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_chacha20_IETF_NONCEBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_chacha20_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_chacha20_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_chacha20_NONCEBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_chacha20_ietf_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_chacha20_ietf_NONCEBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
@ -0,0 +1,145 @@
|
|||||||
|
// IntelliJ API Decompiler stub source generated from a class file
|
||||||
|
// Implementation of methods is not available
|
||||||
|
|
||||||
|
package libsodium
|
||||||
|
|
||||||
|
public const val crypto_box_curve25519xchacha20poly1305_BEFORENMBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_curve25519xchacha20poly1305_MACBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_curve25519xchacha20poly1305_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_curve25519xchacha20poly1305_NONCEBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_curve25519xchacha20poly1305_PUBLICKEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_curve25519xchacha20poly1305_SEALBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_curve25519xchacha20poly1305_SECRETKEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_box_curve25519xchacha20poly1305_SEEDBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_ed25519_BYTES: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_ed25519_HASHBYTES: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_ed25519_NONREDUCEDSCALARBYTES: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_ed25519_SCALARBYTES: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_ed25519_UNIFORMBYTES: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_ristretto255_BYTES: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_ristretto255_HASHBYTES: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_ristretto255_NONREDUCEDSCALARBYTES: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_core_ristretto255_SCALARBYTES: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_kdf_hkdf_sha256_BYTES_MAX: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_kdf_hkdf_sha256_BYTES_MIN: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_kdf_hkdf_sha256_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_kdf_hkdf_sha512_BYTES_MAX: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_kdf_hkdf_sha512_BYTES_MIN: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_kdf_hkdf_sha512_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_scryptsalsa208sha256_BYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_scryptsalsa208sha256_BYTES_MIN: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAX: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_scryptsalsa208sha256_SALTBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_scryptsalsa208sha256_STRBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_pwhash_scryptsalsa208sha256_STRPREFIX: kotlin.String /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_scalarmult_ed25519_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_scalarmult_ed25519_SCALARBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_scalarmult_ristretto255_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_scalarmult_ristretto255_SCALARBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretbox_xchacha20poly1305_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretbox_xchacha20poly1305_MACBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretbox_xchacha20poly1305_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_secretbox_xchacha20poly1305_NONCEBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_NONCEBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_PRIMITIVE: kotlin.String /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_salsa2012_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_salsa2012_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_salsa2012_NONCEBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_salsa208_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_salsa208_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_salsa208_NONCEBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_salsa20_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_salsa20_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_salsa20_NONCEBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_xchacha20_KEYBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_xchacha20_MESSAGEBYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_stream_xchacha20_NONCEBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_verify_16_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_verify_32_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val crypto_verify_64_BYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val randombytes_BYTES_MAX: kotlin.ULong /* compiled code */
|
||||||
|
|
||||||
|
public const val randombytes_SEEDBYTES: kotlin.UInt /* compiled code */
|
||||||
|
|
||||||
|
public const val sodium_base64_VARIANT_ORIGINAL: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val sodium_base64_VARIANT_ORIGINAL_NO_PADDING: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val sodium_base64_VARIANT_URLSAFE: kotlin.Int /* compiled code */
|
||||||
|
|
||||||
|
public const val sodium_base64_VARIANT_URLSAFE_NO_PADDING: kotlin.Int /* compiled code */
|
||||||
|
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.generator
|
||||||
|
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.generator.CommonLibsodiumGenerator
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.definitions.LibSodiumDefinitions
|
||||||
|
import com.ionspin.kotlin.crypto.generator.libsodium.generator.Coordinator
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 31-Jul-2020
|
||||||
|
*/
|
||||||
|
class DebugTest {
|
||||||
|
@Test
|
||||||
|
fun debugTest() {
|
||||||
|
Coordinator.run()
|
||||||
|
}
|
||||||
|
}
|
@ -16,6 +16,8 @@ fi
|
|||||||
#now we can do the delegated build
|
#now we can do the delegated build
|
||||||
cd ..
|
cd ..
|
||||||
./gradlew multiplatform-crypto-delegated:build
|
./gradlew multiplatform-crypto-delegated:build
|
||||||
|
#build libsodium bindings
|
||||||
|
./gradlew multiplatform-crypto-libsodium-bindings:build
|
||||||
#and finally pure build
|
#and finally pure build
|
||||||
./gradlew multiplatform-crypto:build
|
./gradlew multiplatform-crypto:build
|
||||||
set +e
|
set +e
|
||||||
|
@ -16,6 +16,8 @@ fi
|
|||||||
#now we can do the delegated build
|
#now we can do the delegated build
|
||||||
cd ..
|
cd ..
|
||||||
./gradlew multiplatform-crypto-delegated:build
|
./gradlew multiplatform-crypto-delegated:build
|
||||||
|
#build libsodium bindings
|
||||||
|
./gradlew multiplatform-crypto-libsodium-bindings:build
|
||||||
#and finally pure build
|
#and finally pure build
|
||||||
./gradlew multiplatform-crypto:build
|
./gradlew multiplatform-crypto:build
|
||||||
./gradlew publishJvmPublicationToSnapshotRepository publishJsPublicationToSnapshotRepository \
|
./gradlew publishJvmPublicationToSnapshotRepository publishJsPublicationToSnapshotRepository \
|
||||||
|
@ -10,9 +10,12 @@ cd sodiumWrapper
|
|||||||
cd ..
|
cd ..
|
||||||
./gradlew multiplatform-crypto-delegated:iosArm32MainKlibrary multiplatform-crypto-delegated:iosArm32TestKlibrary \
|
./gradlew multiplatform-crypto-delegated:iosArm32MainKlibrary multiplatform-crypto-delegated:iosArm32TestKlibrary \
|
||||||
multiplatform-crypto-delegated:iosArm64MainKlibrary multiplatform-crypto-delegated:iosArm64TestKlibrary \
|
multiplatform-crypto-delegated:iosArm64MainKlibrary multiplatform-crypto-delegated:iosArm64TestKlibrary \
|
||||||
multiplatform-crypto-delegated:iosX64MainKlibrary multiplatform-crypto-delegated:iosX64TestKlibrary \
|
multiplatform-crypto-delegated:iosX64MainKlibrary multiplatform-crypto-delegated:iosX64TestKlibrary
|
||||||
multiplatform-crypto-delegated:macosX64MainKlibrary multiplatform-crypto-delegated:macosX64TestKlibrary
|
|
||||||
./gradlew multiplatform-crypto-delegated:iosX64Test
|
./gradlew multiplatform-crypto-delegated:iosX64Test
|
||||||
./gradlew multiplatform-crypto-delegated:macosX64Test
|
|
||||||
|
./gradlew multiplatform-crypto-libsodium-bindings:iosArm32MainKlibrary multiplatform-crypto-libsodium-bindings:iosArm32TestKlibrary \
|
||||||
|
multiplatform-crypto-libsodium-bindings:iosArm64MainKlibrary multiplatform-crypto-libsodium-bindings:iosArm64TestKlibrary \
|
||||||
|
multiplatform-crypto-libsodium-bindings:iosX64MainKlibrary multiplatform-crypto-libsodium-bindings:iosX64TestKlibrary
|
||||||
|
./gradlew multiplatform-crypto-libsodium-bindings:iosX64Test
|
||||||
set +e
|
set +e
|
||||||
|
|
17
macBuild-mac.sh
Executable file
17
macBuild-mac.sh
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
set -e
|
||||||
|
#!/bin/sh
|
||||||
|
#this will hopefully download all konan dependancies that we use in the build scripts
|
||||||
|
./gradlew multiplatform-crypto-api:build
|
||||||
|
#now let's build linux deps
|
||||||
|
cd sodiumWrapper
|
||||||
|
./makeMacosX86-64.sh
|
||||||
|
./makeIos.sh
|
||||||
|
#now we can do the delegated build of ios and macos libraries
|
||||||
|
cd ..
|
||||||
|
./gradlew multiplatform-crypto-delegated:macosX64MainKlibrary multiplatform-crypto-delegated:macosX64TestKlibrary
|
||||||
|
./gradlew multiplatform-crypto-delegated:macosX64Test
|
||||||
|
|
||||||
|
./gradlew multiplatform-crypto-libsodium-bindings:macosX64MainKlibrary multiplatform-crypto-libsodium-bindings:macosX64TestKlibrary
|
||||||
|
./gradlew multiplatform-crypto-libsodium-bindings:macosX64Test
|
||||||
|
set +e
|
||||||
|
|
9
macBuild-pure-ios.sh
Executable file
9
macBuild-pure-ios.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
set -e
|
||||||
|
#!/bin/sh
|
||||||
|
./gradlew multiplatform-crypto-api:build
|
||||||
|
./gradlew multiplatform-crypto:iosArm32MainKlibrary multiplatform-crypto:iosArm32TestKlibrary \
|
||||||
|
multiplatform-crypto:iosArm64MainKlibrary multiplatform-crypto:iosArm64TestKlibrary \
|
||||||
|
multiplatform-crypto:iosX64MainKlibrary multiplatform-crypto:iosX64TestKlibrary
|
||||||
|
./gradlew multiplatform-crypto:iosX64Test
|
||||||
|
|
||||||
|
set +e
|
7
macBuild-pure-mac.sh
Executable file
7
macBuild-pure-mac.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
set -e
|
||||||
|
#!/bin/sh
|
||||||
|
./gradlew multiplatform-crypto-api:build
|
||||||
|
./gradlew multiplatform-crypto:macosX64MainKlibrary multiplatform-crypto:macosX64TestKlibrary
|
||||||
|
./gradlew multiplatform-crypto:macosX64Test
|
||||||
|
|
||||||
|
set +e
|
7
macBuild-pure-tvos.sh
Executable file
7
macBuild-pure-tvos.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
set -e
|
||||||
|
#!/bin/sh
|
||||||
|
./gradlew multiplatform-crypto-api:build
|
||||||
|
./gradlew multiplatform-crypto:tvosArm64MainKlibrary multiplatform-crypto:tvosArm64TestKlibrary \
|
||||||
|
multiplatform-crypto:tvosX64MainKlibrary multiplatform-crypto:tvosX64TestKlibrary
|
||||||
|
./gradlew multiplatform-crypto:tvosX64Test
|
||||||
|
set +e
|
8
macBuild-pure-watchos.sh
Executable file
8
macBuild-pure-watchos.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
set -e
|
||||||
|
#!/bin/sh
|
||||||
|
./gradlew multiplatform-crypto-api:build
|
||||||
|
./gradlew multiplatform-crypto:watchosArm32MainKlibrary multiplatform-crypto:watchosArm32TestKlibrary \
|
||||||
|
multiplatform-crypto:watchosArm64MainKlibrary multiplatform-crypto:watchosArm64TestKlibrary \
|
||||||
|
multiplatform-crypto:watchosX86MainKlibrary multiplatform-crypto:watchosX86TestKlibrary
|
||||||
|
./gradlew multiplatform-crypto:watchosX86Test
|
||||||
|
set +e
|
@ -1,5 +0,0 @@
|
|||||||
set -e
|
|
||||||
#!/bin/sh
|
|
||||||
./gradlew multiplatform-crypto-api:build
|
|
||||||
./gradlew multiplatform-crypto:build
|
|
||||||
set +e
|
|
@ -10,4 +10,8 @@ cd ..
|
|||||||
./gradlew multiplatform-crypto-delegated:tvosArm64MainKlibrary multiplatform-crypto-delegated:tvosArm64TestKlibrary \
|
./gradlew multiplatform-crypto-delegated:tvosArm64MainKlibrary multiplatform-crypto-delegated:tvosArm64TestKlibrary \
|
||||||
multiplatform-crypto-delegated:tvosX64MainKlibrary multiplatform-crypto-delegated:tvosX64TestKlibrary
|
multiplatform-crypto-delegated:tvosX64MainKlibrary multiplatform-crypto-delegated:tvosX64TestKlibrary
|
||||||
./gradlew multiplatform-crypto-delegated:tvosX64Test
|
./gradlew multiplatform-crypto-delegated:tvosX64Test
|
||||||
|
|
||||||
|
./gradlew multiplatform-crypto-libsodium-bindings:tvosArm64MainKlibrary multiplatform-crypto-libsodium-bindings:tvosArm64TestKlibrary \
|
||||||
|
multiplatform-crypto-libsodium-bindings:tvosX64MainKlibrary multiplatform-crypto-libsodium-bindings:tvosX64TestKlibrary
|
||||||
|
./gradlew multiplatform-crypto-libsodium-bindings:tvosX64Test
|
||||||
set +e
|
set +e
|
@ -11,4 +11,9 @@ cd ..
|
|||||||
multiplatform-crypto-delegated:watchosArm64MainKlibrary multiplatform-crypto-delegated:watchosArm64TestKlibrary \
|
multiplatform-crypto-delegated:watchosArm64MainKlibrary multiplatform-crypto-delegated:watchosArm64TestKlibrary \
|
||||||
multiplatform-crypto-delegated:watchosX86MainKlibrary multiplatform-crypto-delegated:watchosX86TestKlibrary
|
multiplatform-crypto-delegated:watchosX86MainKlibrary multiplatform-crypto-delegated:watchosX86TestKlibrary
|
||||||
./gradlew multiplatform-crypto-delegated:watchosX86Test
|
./gradlew multiplatform-crypto-delegated:watchosX86Test
|
||||||
|
|
||||||
|
./gradlew multiplatform-crypto-libsodium-bindings:watchosArm32MainKlibrary multiplatform-crypto-libsodium-bindings:watchosArm32TestKlibrary \
|
||||||
|
multiplatform-crypto-libsodium-bindings:watchosArm64MainKlibrary multiplatform-crypto-libsodium-bindings:watchosArm64TestKlibrary \
|
||||||
|
multiplatform-crypto-libsodium-bindings:watchosX86MainKlibrary multiplatform-crypto-libsodium-bindings:watchosX86TestKlibrary
|
||||||
|
./gradlew multiplatform-crypto-libsodium-bindings:watchosX86Test
|
||||||
set +e
|
set +e
|
@ -4,12 +4,14 @@ set -e
|
|||||||
./gradlew multiplatform-crypto-api:build
|
./gradlew multiplatform-crypto-api:build
|
||||||
#now let's build linux deps
|
#now let's build linux deps
|
||||||
cd sodiumWrapper
|
cd sodiumWrapper
|
||||||
./makeMacosX86-64.sh
|
|
||||||
./makeIos.sh
|
./makeIos.sh
|
||||||
#now we can do the delegated build of ios and macos libraries
|
#now we can do the delegated build of ios and macos libraries
|
||||||
cd ..
|
cd ..
|
||||||
./gradlew multiplatform-crypto-delegated:publishIosArm32PublicationToSnapshotRepository \
|
./gradlew multiplatform-crypto-delegated:publishIosArm32PublicationToSnapshotRepository \
|
||||||
multiplatform-crypto-delegated:publishIosArm64PublicationToSnapshotRepository \
|
multiplatform-crypto-delegated:publishIosArm64PublicationToSnapshotRepository \
|
||||||
multiplatform-crypto-delegated:publishIosX64PublicationToSnapshotRepository \
|
multiplatform-crypto-delegated:publishIosX64PublicationToSnapshotRepository
|
||||||
multiplatform-crypto-delegated:publishMacosX64PublicationToSnapshotRepository
|
|
||||||
|
./gradlew multiplatform-crypto-libsodium-bindings:publishIosArm32PublicationToSnapshotRepository \
|
||||||
|
multiplatform-crypto-libsodium-bindings:publishIosArm64PublicationToSnapshotRepository \
|
||||||
|
multiplatform-crypto-libsodium-bindings:publishIosX64PublicationToSnapshotRepository
|
||||||
set +e
|
set +e
|
13
macBuildAndPublish-mac.sh
Executable file
13
macBuildAndPublish-mac.sh
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
set -e
|
||||||
|
#!/bin/sh
|
||||||
|
#this will hopefully download all konan dependancies that we use in the build scripts
|
||||||
|
./gradlew multiplatform-crypto-api:build
|
||||||
|
#now let's build linux deps
|
||||||
|
cd sodiumWrapper
|
||||||
|
./makeMacosX86-64.sh
|
||||||
|
#now we can do the delegated build of ios and macos libraries
|
||||||
|
cd ..
|
||||||
|
./gradlew multiplatform-crypto-delegated:publishMacosX64PublicationToSnapshotRepository
|
||||||
|
|
||||||
|
./gradlew multiplatform-crypto-libsodium-bindings:publishMacosX64PublicationToSnapshotRepository
|
||||||
|
set +e
|
8
macBuildAndPublish-pure-ios.sh
Executable file
8
macBuildAndPublish-pure-ios.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
set -e
|
||||||
|
#!/bin/sh
|
||||||
|
#this will hopefully download all konan dependancies that we use in the build scripts
|
||||||
|
./gradlew multiplatform-crypto-api:build
|
||||||
|
./gradlew multiplatform-crypto:publishIos32ArmPublicationToSnapshotRepository \
|
||||||
|
multiplatform-crypto:publishIos64ArmPublicationToSnapshotRepository \
|
||||||
|
multiplatform-crypto:publishIosPublicationToSnapshotRepository
|
||||||
|
set +e
|
6
macBuildAndPublish-pure-mac-ios.sh
Executable file
6
macBuildAndPublish-pure-mac-ios.sh
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
set -e
|
||||||
|
#!/bin/sh
|
||||||
|
#this will hopefully download all konan dependancies that we use in the build scripts
|
||||||
|
./gradlew multiplatform-crypto-api:build
|
||||||
|
./gradlew multiplatform-crypto:publishMacosX64PublicationToSnapshotRepository
|
||||||
|
set +e
|
8
macBuildAndPublish-pure-tvos.sh
Executable file
8
macBuildAndPublish-pure-tvos.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
set -e
|
||||||
|
#!/bin/sh
|
||||||
|
#this will hopefully download all konan dependancies that we use in the build scripts
|
||||||
|
./gradlew multiplatform-crypto-api:build
|
||||||
|
./gradlew multiplatform-crypto-delegated:publishTvosArm64PublicationToSnapshotRepository \
|
||||||
|
multiplatform-crypto-delegated:publishTvosX64PublicationToSnapshotRepository
|
||||||
|
|
||||||
|
set +e
|
8
macBuildAndPublish-pure-watchos.sh
Executable file
8
macBuildAndPublish-pure-watchos.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
set -e
|
||||||
|
#!/bin/sh
|
||||||
|
#this will hopefully download all konan dependancies that we use in the build scripts
|
||||||
|
./gradlew multiplatform-crypto-api:build
|
||||||
|
./gradlew multiplatform-crypto:publishWatchosArm32PublicationToSnapshotRepository \
|
||||||
|
multiplatform-crypto:publishWatchosArm64PublicationToSnapshotRepository \
|
||||||
|
multiplatform-crypto:publishWatchosX86PublicationToSnapshotRepository
|
||||||
|
set +e
|
@ -1,14 +0,0 @@
|
|||||||
set -e
|
|
||||||
#!/bin/sh
|
|
||||||
#this will hopefully download all konan dependancies that we use in the build scripts
|
|
||||||
./gradlew multiplatform-crypto-api:build
|
|
||||||
./gradlew multiplatform-crypto:publishIos32ArmPublicationToSnapshotRepository \
|
|
||||||
multiplatform-crypto:publishIos64ArmPublicationToSnapshotRepository \
|
|
||||||
multiplatform-crypto:publishIosPublicationToSnapshotRepository \
|
|
||||||
multiplatform-crypto:publishMacosX64PublicationToSnapshotRepository \
|
|
||||||
multiplatform-crypto:publishTvosArm64PublicationToSnapshotRepository \
|
|
||||||
multiplatform-crypto:publishTvosX64PublicationToSnapshotRepository \
|
|
||||||
multiplatform-crypto:publishWatchosArm32PublicationToSnapshotRepository \
|
|
||||||
multiplatform-crypto:publishWatchosArm64PublicationToSnapshotRepository \
|
|
||||||
multiplatform-crypto:publishWatchosX86PublicationToSnapshotRepository
|
|
||||||
set +e
|
|
@ -2,11 +2,7 @@ set -e
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#this will hopefully download all konan dependancies that we use in the build scripts
|
#this will hopefully download all konan dependancies that we use in the build scripts
|
||||||
./gradlew multiplatform-crypto-api:build
|
./gradlew multiplatform-crypto-api:build
|
||||||
#now let's build linux deps
|
./gradlew multiplatform-crypto:publishTvosArm64PublicationToSnapshotRepository \
|
||||||
cd sodiumWrapper
|
multiplatform-crypto:publishTvosX64PublicationToSnapshotRepository
|
||||||
./makeTvos.sh
|
|
||||||
#now we can do the delegated build of ios and macos libraries
|
|
||||||
cd ..
|
|
||||||
./gradlew multiplatform-crypto-delegated:publishTvosArm64PublicationToSnapshotRepository \
|
|
||||||
multiplatform-crypto-delegated:publishTvosX64PublicationToSnapshotRepository
|
|
||||||
set +e
|
set +e
|
||||||
|
@ -10,4 +10,8 @@ cd ..
|
|||||||
./gradlew multiplatform-crypto-delegated:publishWatchosArm32PublicationToSnapshotRepository \
|
./gradlew multiplatform-crypto-delegated:publishWatchosArm32PublicationToSnapshotRepository \
|
||||||
multiplatform-crypto-delegated:publishWatchosArm64PublicationToSnapshotRepository \
|
multiplatform-crypto-delegated:publishWatchosArm64PublicationToSnapshotRepository \
|
||||||
multiplatform-crypto-delegated:publishWatchosX86PublicationToSnapshotRepository
|
multiplatform-crypto-delegated:publishWatchosX86PublicationToSnapshotRepository
|
||||||
|
|
||||||
|
./gradlew multiplatform-crypto-libsodium-bindings:publishWatchosArm32PublicationToSnapshotRepository \
|
||||||
|
multiplatform-crypto-libsodium-bindings:publishWatchosArm64PublicationToSnapshotRepository \
|
||||||
|
multiplatform-crypto-libsodium-bindings:publishWatchosX86PublicationToSnapshotRepository
|
||||||
set +e
|
set +e
|
||||||
|
@ -22,9 +22,9 @@ import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeTest
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin(PluginsDeps.multiplatform)
|
kotlin(PluginsDeps.multiplatform)
|
||||||
id (PluginsDeps.mavenPublish)
|
id(PluginsDeps.mavenPublish)
|
||||||
id (PluginsDeps.signing)
|
id(PluginsDeps.signing)
|
||||||
id (PluginsDeps.dokka)
|
id(PluginsDeps.dokka)
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@ -69,7 +69,6 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Not supported in OFFICIAL coroutines at the moment
|
|
||||||
linuxArm64() {
|
linuxArm64() {
|
||||||
binaries {
|
binaries {
|
||||||
staticLib {
|
staticLib {
|
||||||
@ -77,7 +76,6 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Not supported in OFFICAL coroutines at the moment
|
|
||||||
linuxArm32Hfp() {
|
linuxArm32Hfp() {
|
||||||
binaries {
|
binaries {
|
||||||
staticLib {
|
staticLib {
|
||||||
@ -269,12 +267,12 @@ kotlin {
|
|||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
create<Jar>("javadocJar") {
|
create<Jar>("javadocJar") {
|
||||||
dependsOn(dokka)
|
dependsOn(dokkaJavadoc)
|
||||||
archiveClassifier.set("javadoc")
|
archiveClassifier.set("javadoc")
|
||||||
from(dokka.get().outputDirectory)
|
from(dokkaJavadoc.get().outputDirectory)
|
||||||
}
|
}
|
||||||
|
|
||||||
dokka {
|
dokkaJavadoc {
|
||||||
println("Dokka !")
|
println("Dokka !")
|
||||||
}
|
}
|
||||||
if (getHostOsName() == "linux" && getHostArchitecture() == "x86-64") {
|
if (getHostOsName() == "linux" && getHostArchitecture() == "x86-64") {
|
||||||
|
@ -0,0 +1,87 @@
|
|||||||
|
package com.ionspin.kotlin.crypto
|
||||||
|
|
||||||
|
import com.ionspin.kotlin.crypto.hash.MultipartHash
|
||||||
|
import com.ionspin.kotlin.crypto.hash.encodeToUByteArray
|
||||||
|
import com.ionspin.kotlin.crypto.util.toHexString
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 23-Jun-2020
|
||||||
|
*/
|
||||||
|
inline class EncryptableString(val content: String) : Encryptable<EncryptableString> {
|
||||||
|
override fun toEncryptableForm(): UByteArray {
|
||||||
|
return content.encodeToUByteArray()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun fromEncryptableForm(): (UByteArray) -> EncryptableString {
|
||||||
|
return { uByteArray ->
|
||||||
|
EncryptableString(uByteArray.toByteArray().decodeToString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun asString() : String = content
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun String.asEncryptableString() : EncryptableString {
|
||||||
|
return EncryptableString(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Encryptable<T> {
|
||||||
|
fun toEncryptableForm() : UByteArray
|
||||||
|
fun fromEncryptableForm() : (UByteArray) -> T
|
||||||
|
}
|
||||||
|
|
||||||
|
data class HashedData(val hash: UByteArray) {
|
||||||
|
fun toHexString() : String {
|
||||||
|
return hash.toHexString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data class SymmetricKey(val value : UByteArray) {
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data class EncryptedData constructor(val ciphertext: UByteArray, val nonce: UByteArray)
|
||||||
|
|
||||||
|
interface HashApi {
|
||||||
|
fun hash(data: UByteArray, key : UByteArray = ubyteArrayOf()) : HashedData
|
||||||
|
fun multipartHash(key: UByteArray? = null) : MultipartHash
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EncryptionApi {
|
||||||
|
fun encrypt(key: SymmetricKey, data : Encryptable<*>, additionalData : UByteArray) : EncryptedData
|
||||||
|
fun <T: Encryptable<T>> decrypt(key: SymmetricKey, encryptedData : EncryptedData, additionalData: UByteArray, byteArrayDeserializer : (UByteArray) -> T) : T
|
||||||
|
fun createMultipartEncryptor(key: SymmetricKey) : MultipartAuthenticatedEncryption
|
||||||
|
fun createMultipartDecryptor(key: SymmetricKey, header: MultipartEncryptionHeader) : MultipartAuthenticatedDecryption
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
interface AuthenticatedEncryption {
|
||||||
|
fun encrypt(key: UByteArray, nonce: UByteArray, message: UByteArray, additionalData: UByteArray = ubyteArrayOf()) : UByteArray
|
||||||
|
fun decrypt(key: UByteArray, nonce: UByteArray, cipherText: UByteArray, additionalData: UByteArray = ubyteArrayOf()) : UByteArray
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
data class EncryptedDataPart(val data : UByteArray)
|
||||||
|
data class DecryptedDataPart(val data : UByteArray)
|
||||||
|
|
||||||
|
data class MultipartEncryptionHeader(val nonce: UByteArray)
|
||||||
|
|
||||||
|
class InvalidTagException : RuntimeException("Tag mismatch! Encrypted data is corrupted or tampered with.")
|
||||||
|
|
||||||
|
interface MultipartAuthenticatedDecryption {
|
||||||
|
fun decryptPartialData(data: EncryptedDataPart, additionalData: UByteArray = ubyteArrayOf()) : DecryptedDataPart
|
||||||
|
fun cleanup()
|
||||||
|
}
|
||||||
|
|
||||||
|
interface MultipartAuthenticatedEncryption {
|
||||||
|
fun encryptPartialData(data: UByteArray, additionalData: UByteArray = ubyteArrayOf()) : EncryptedDataPart
|
||||||
|
fun startEncryption() : MultipartEncryptionHeader
|
||||||
|
fun cleanup()
|
||||||
|
|
||||||
|
}
|
@ -5,8 +5,10 @@ package com.ionspin.kotlin.crypto
|
|||||||
* ugljesa.jovanovic@ionspin.com
|
* ugljesa.jovanovic@ionspin.com
|
||||||
* on 27-May-2020
|
* on 27-May-2020
|
||||||
*/
|
*/
|
||||||
interface CryptoProvider {
|
interface CryptoInitializer {
|
||||||
suspend fun initialize()
|
suspend fun initialize()
|
||||||
|
|
||||||
|
fun isInitialized() : Boolean
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.ionspin.kotlin.crypto
|
||||||
|
|
||||||
|
import com.ionspin.kotlin.crypto.hash.blake2b.Blake2bMultipart
|
||||||
|
import com.ionspin.kotlin.crypto.hash.blake2b.Blake2bProperties
|
||||||
|
import com.ionspin.kotlin.crypto.hash.sha.Sha256
|
||||||
|
import com.ionspin.kotlin.crypto.hash.sha.Sha512Multipart
|
||||||
|
import com.ionspin.kotlin.crypto.keyderivation.ArgonResult
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 23-Jun-2020
|
||||||
|
*/
|
||||||
|
interface PrimitivesApi {
|
||||||
|
fun hashBlake2bMultipart(key: UByteArray? = null, hashLength: Int = Blake2bProperties.MAX_HASH_BYTES): Blake2bMultipart
|
||||||
|
fun hashBlake2b(message: UByteArray, key: UByteArray = ubyteArrayOf(), hashLength: Int = Blake2bProperties.MAX_HASH_BYTES): UByteArray
|
||||||
|
|
||||||
|
fun hashSha256Multipart(): Sha256
|
||||||
|
fun hashSha256(message: UByteArray) : UByteArray
|
||||||
|
|
||||||
|
fun hashSha512Multipart(): Sha512Multipart
|
||||||
|
fun hashSha512(message: UByteArray) : UByteArray
|
||||||
|
|
||||||
|
fun deriveKey(
|
||||||
|
password: String,
|
||||||
|
salt: String? = null,
|
||||||
|
key: String,
|
||||||
|
associatedData: String,
|
||||||
|
parallelism: Int = 16,
|
||||||
|
tagLength: Int = 64,
|
||||||
|
memory: Int = 4096,
|
||||||
|
numberOfIterations: Int = 10,
|
||||||
|
) : ArgonResult
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.authenticated
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 14-Jun-2020
|
||||||
|
*/
|
||||||
|
interface XChaCha20Poly1305
|
@ -22,12 +22,12 @@ package com.ionspin.kotlin.crypto.hash
|
|||||||
* ugljesa.jovanovic@ionspin.com
|
* ugljesa.jovanovic@ionspin.com
|
||||||
* on 20-Jul-2019
|
* on 20-Jul-2019
|
||||||
*/
|
*/
|
||||||
interface Hash {
|
interface HashFunction {
|
||||||
val MAX_HASH_BYTES : Int
|
val MAX_HASH_BYTES : Int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
interface UpdatableHash : Hash {
|
interface MultipartHash : HashFunction {
|
||||||
fun update(data : UByteArray)
|
fun update(data : UByteArray)
|
||||||
|
|
||||||
fun digest() : UByteArray
|
fun digest() : UByteArray
|
||||||
@ -35,11 +35,15 @@ interface UpdatableHash : Hash {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
interface StatelessHash : Hash {
|
interface Hash : HashFunction {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun String.encodeToUByteArray() : UByteArray{
|
fun String.encodeToUByteArray() : UByteArray{
|
||||||
return encodeToByteArray().toUByteArray()
|
return encodeToByteArray().asUByteArray()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun UByteArray.decodeToString() : String {
|
||||||
|
return this.asByteArray().contentToString()
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
package com.ionspin.kotlin.crypto.hash.blake2b
|
package com.ionspin.kotlin.crypto.hash.blake2b
|
||||||
|
|
||||||
import com.ionspin.kotlin.crypto.hash.StatelessHash
|
import com.ionspin.kotlin.crypto.hash.Hash
|
||||||
import com.ionspin.kotlin.crypto.hash.UpdatableHash
|
import com.ionspin.kotlin.crypto.hash.MultipartHash
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Ugljesa Jovanovic
|
* Created by Ugljesa Jovanovic
|
||||||
@ -13,12 +13,12 @@ object Blake2bProperties {
|
|||||||
const val MAX_HASH_BYTES = 64
|
const val MAX_HASH_BYTES = 64
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Blake2b : UpdatableHash {
|
interface Blake2bMultipart : MultipartHash {
|
||||||
override val MAX_HASH_BYTES: Int
|
override val MAX_HASH_BYTES: Int
|
||||||
get() = Blake2bProperties.MAX_HASH_BYTES
|
get() = Blake2bProperties.MAX_HASH_BYTES
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Blake2bStateless : StatelessHash {
|
interface Blake2b : Hash {
|
||||||
override val MAX_HASH_BYTES: Int
|
override val MAX_HASH_BYTES: Int
|
||||||
get() = Blake2bProperties.MAX_HASH_BYTES
|
get() = Blake2bProperties.MAX_HASH_BYTES
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.ionspin.kotlin.crypto.hash.sha
|
package com.ionspin.kotlin.crypto.hash.sha
|
||||||
|
|
||||||
import com.ionspin.kotlin.crypto.hash.StatelessHash
|
import com.ionspin.kotlin.crypto.hash.Hash
|
||||||
import com.ionspin.kotlin.crypto.hash.UpdatableHash
|
import com.ionspin.kotlin.crypto.hash.MultipartHash
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Ugljesa Jovanovic
|
* Created by Ugljesa Jovanovic
|
||||||
@ -12,11 +12,11 @@ object Sha256Properties {
|
|||||||
const val MAX_HASH_BYTES = 32
|
const val MAX_HASH_BYTES = 32
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Sha256 : UpdatableHash {
|
interface Sha256 : MultipartHash {
|
||||||
override val MAX_HASH_BYTES: Int
|
override val MAX_HASH_BYTES: Int
|
||||||
get() = Sha256Properties.MAX_HASH_BYTES
|
get() = Sha256Properties.MAX_HASH_BYTES
|
||||||
}
|
}
|
||||||
interface StatelessSha256 : StatelessHash {
|
interface StatelessSha256 : Hash {
|
||||||
override val MAX_HASH_BYTES: Int
|
override val MAX_HASH_BYTES: Int
|
||||||
get() = Sha256Properties.MAX_HASH_BYTES
|
get() = Sha256Properties.MAX_HASH_BYTES
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.ionspin.kotlin.crypto.hash.sha
|
package com.ionspin.kotlin.crypto.hash.sha
|
||||||
|
|
||||||
import com.ionspin.kotlin.crypto.hash.StatelessHash
|
import com.ionspin.kotlin.crypto.hash.Hash
|
||||||
import com.ionspin.kotlin.crypto.hash.UpdatableHash
|
import com.ionspin.kotlin.crypto.hash.MultipartHash
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Ugljesa Jovanovic
|
* Created by Ugljesa Jovanovic
|
||||||
@ -11,11 +11,11 @@ import com.ionspin.kotlin.crypto.hash.UpdatableHash
|
|||||||
object Sha512Properties {
|
object Sha512Properties {
|
||||||
const val MAX_HASH_BYTES = 64
|
const val MAX_HASH_BYTES = 64
|
||||||
}
|
}
|
||||||
interface Sha512 : UpdatableHash {
|
interface Sha512Multipart : MultipartHash {
|
||||||
override val MAX_HASH_BYTES: Int
|
override val MAX_HASH_BYTES: Int
|
||||||
get() = Sha256Properties.MAX_HASH_BYTES
|
get() = Sha256Properties.MAX_HASH_BYTES
|
||||||
}
|
}
|
||||||
interface StatelessSha512 : StatelessHash {
|
interface Sha512 : Hash {
|
||||||
override val MAX_HASH_BYTES: Int
|
override val MAX_HASH_BYTES: Int
|
||||||
get() = Sha512Properties.MAX_HASH_BYTES
|
get() = Sha512Properties.MAX_HASH_BYTES
|
||||||
|
|
||||||
|
@ -24,3 +24,12 @@ package com.ionspin.kotlin.crypto.keyderivation
|
|||||||
interface KeyDerivationFunction {
|
interface KeyDerivationFunction {
|
||||||
fun derive() : UByteArray
|
fun derive() : UByteArray
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data class ArgonResult(
|
||||||
|
val hashBytes: UByteArray,
|
||||||
|
val salt: UByteArray
|
||||||
|
) {
|
||||||
|
val hashString by lazy { hashBytes.map { it.toString(16).padStart(2, '0') }.joinToString(separator = "") }
|
||||||
|
val saltString by lazy { salt.map { it.toString(16).padStart(2, '0') }.joinToString(separator = "") }
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -0,0 +1,47 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.symmetric
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 14-Jun-2020
|
||||||
|
*/
|
||||||
|
interface XChaCha20 {
|
||||||
|
interface Nonce {
|
||||||
|
val content: UByteArray
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Key {
|
||||||
|
val content : UByteArray
|
||||||
|
}
|
||||||
|
fun encrypt(key: Key, inputMessage: UByteArray) : XChaCha20EncryptionResult
|
||||||
|
|
||||||
|
fun decrypt(key: Key, nonce: Nonce) : UByteArray
|
||||||
|
}
|
||||||
|
|
||||||
|
data class XChaCha20EncryptionResult(val nonce: UByteArray, val encryptionData: UByteArray) {
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (other == null || this::class != other::class) return false
|
||||||
|
|
||||||
|
other as XChaCha20EncryptionResult
|
||||||
|
|
||||||
|
if (nonce != other.nonce) return false
|
||||||
|
if (encryptionData != other.encryptionData) return false
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
var result = nonce.hashCode()
|
||||||
|
result = 31 * result + encryptionData.hashCode()
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
interface XChaCha20KeyProvider {
|
||||||
|
fun generateNewKey() : XChaCha20.Key
|
||||||
|
|
||||||
|
fun createFromUByteArray(uByteArray: UByteArray) : XChaCha20.Key
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.util
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 26-Jul-2020
|
||||||
|
*/
|
||||||
|
fun UByteArray.fromLittleEndianUByteArrayToBigEndianUByteArray() : UByteArray {
|
||||||
|
return this.reversedArray()
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.util
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 22-Jun-2020
|
||||||
|
*/
|
||||||
|
val _emit = IntArray(0)
|
||||||
|
|
||||||
|
fun UByteArray.overwriteWithZeroes() {
|
||||||
|
for (i in 0 until size) {
|
||||||
|
this[i] = 0U
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun UIntArray.overwriteWithZeroes() {
|
||||||
|
for (i in 0 until size) {
|
||||||
|
this[i] = 0U
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.util
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 22-Jun-2020
|
||||||
|
*/
|
||||||
|
fun Array<Byte>.hexColumsPrint() {
|
||||||
|
val printout = this.map { it.toString(16) }.chunked(16)
|
||||||
|
printout.forEach { println(it.joinToString(separator = " ") { it.toUpperCase() }) }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Array<UByte>.hexColumsPrint(chunk : Int = 16) {
|
||||||
|
val printout = this.map { it.toString(16).padStart(2, '0') }.chunked(chunk)
|
||||||
|
printout.forEach { println(it.joinToString(separator = " ") { it.toUpperCase() }) }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun UByteArray.hexColumsPrint(chunk : Int = 16) {
|
||||||
|
val printout = this.map { it.toString(16).padStart(2, '0') }.chunked(chunk)
|
||||||
|
printout.forEach { println(it.joinToString(separator = " ") { it.toUpperCase() }) }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Array<ULong>.hexColumsPrint(chunk: Int = 3) {
|
||||||
|
val printout = this.map { it.toString(16) }.chunked(chunk)
|
||||||
|
printout.forEach { println(it.joinToString(separator = " ") { it.toUpperCase() }) }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun String.hexStringToTypedUByteArray() : Array<UByte> {
|
||||||
|
return this.chunked(2).map { it.toUByte(16) }.toTypedArray()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun String.hexStringToUByteArray() : UByteArray {
|
||||||
|
return this.chunked(2).map { it.toUByte(16) }.toUByteArray()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Array<UByte>.toHexString() : String {
|
||||||
|
return this.joinToString(separator = "") {
|
||||||
|
if (it <= 0x0FU) {
|
||||||
|
"0${it.toString(16)}"
|
||||||
|
} else {
|
||||||
|
it.toString(16)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun UByteArray.toHexString() : String {
|
||||||
|
return this.joinToString(separator = "") {
|
||||||
|
if (it <= 0x0FU) {
|
||||||
|
"0${it.toString(16)}"
|
||||||
|
} else {
|
||||||
|
it.toString(16)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -131,7 +131,6 @@ kotlin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Not supported in OFFICIAL coroutines at the moment (we're running a custom build)
|
|
||||||
runningOnLinuxArm64 {
|
runningOnLinuxArm64 {
|
||||||
println("Configuring Linux Arm 64 targets")
|
println("Configuring Linux Arm 64 targets")
|
||||||
|
|
||||||
@ -249,7 +248,6 @@ kotlin {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin(Deps.Common.stdLib))
|
implementation(kotlin(Deps.Common.stdLib))
|
||||||
implementation(kotlin(Deps.Common.test))
|
implementation(kotlin(Deps.Common.test))
|
||||||
implementation(Deps.Common.coroutines)
|
|
||||||
implementation(Deps.Common.kotlinBigNum)
|
implementation(Deps.Common.kotlinBigNum)
|
||||||
api(project(Deps.Common.apiProject))
|
api(project(Deps.Common.apiProject))
|
||||||
}
|
}
|
||||||
@ -262,7 +260,6 @@ kotlin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val nativeDependencies = independentDependencyBlock {
|
val nativeDependencies = independentDependencyBlock {
|
||||||
implementation(Deps.Native.coroutines)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val nativeMain by creating {
|
val nativeMain by creating {
|
||||||
@ -281,7 +278,6 @@ kotlin {
|
|||||||
kotlin.setSrcDirs(emptySet<String>())
|
kotlin.setSrcDirs(emptySet<String>())
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(Deps.Native.coroutines)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,7 +416,6 @@ kotlin {
|
|||||||
implementation(kotlin(Deps.Jvm.stdLib))
|
implementation(kotlin(Deps.Jvm.stdLib))
|
||||||
implementation(kotlin(Deps.Jvm.test))
|
implementation(kotlin(Deps.Jvm.test))
|
||||||
implementation(kotlin(Deps.Jvm.testJUnit))
|
implementation(kotlin(Deps.Jvm.testJUnit))
|
||||||
implementation(Deps.Jvm.coroutinesCore)
|
|
||||||
|
|
||||||
//lazysodium
|
//lazysodium
|
||||||
implementation(Deps.Jvm.Delegated.lazysodium)
|
implementation(Deps.Jvm.Delegated.lazysodium)
|
||||||
@ -431,20 +426,17 @@ kotlin {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin(Deps.Jvm.test))
|
implementation(kotlin(Deps.Jvm.test))
|
||||||
implementation(kotlin(Deps.Jvm.testJUnit))
|
implementation(kotlin(Deps.Jvm.testJUnit))
|
||||||
implementation(Deps.Jvm.coroutinesTest)
|
|
||||||
implementation(kotlin(Deps.Jvm.reflection))
|
implementation(kotlin(Deps.Jvm.reflection))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val jsMain by getting {
|
val jsMain by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin(Deps.Js.stdLib))
|
implementation(kotlin(Deps.Js.stdLib))
|
||||||
implementation(Deps.Js.coroutines)
|
|
||||||
implementation(npm(Deps.Js.Npm.libsodiumWrappers.first, Deps.Js.Npm.libsodiumWrappers.second))
|
implementation(npm(Deps.Js.Npm.libsodiumWrappers.first, Deps.Js.Npm.libsodiumWrappers.second))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val jsTest by getting {
|
val jsTest by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(Deps.Js.coroutines)
|
|
||||||
implementation(kotlin(Deps.Js.test))
|
implementation(kotlin(Deps.Js.test))
|
||||||
implementation(npm(Deps.Js.Npm.libsodiumWrappers.first, Deps.Js.Npm.libsodiumWrappers.second))
|
implementation(npm(Deps.Js.Npm.libsodiumWrappers.first, Deps.Js.Npm.libsodiumWrappers.second))
|
||||||
}
|
}
|
||||||
@ -536,12 +528,12 @@ tasks {
|
|||||||
|
|
||||||
|
|
||||||
create<Jar>("javadocJar") {
|
create<Jar>("javadocJar") {
|
||||||
dependsOn(dokka)
|
dependsOn(dokkaJavadoc)
|
||||||
archiveClassifier.set("javadoc")
|
archiveClassifier.set("javadoc")
|
||||||
from(dokka.get().outputDirectory)
|
from(dokkaJavadoc.get().outputDirectory)
|
||||||
}
|
}
|
||||||
|
|
||||||
dokka {
|
dokkaJavadoc {
|
||||||
println("Dokka !")
|
println("Dokka !")
|
||||||
}
|
}
|
||||||
if (getHostOsName() == "linux" && getHostArchitecture() == "x86-64") {
|
if (getHostOsName() == "linux" && getHostArchitecture() == "x86-64") {
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
package com.ionspin.kotlin.crypto
|
package com.ionspin.kotlin.crypto
|
||||||
|
|
||||||
|
import com.ionspin.kotlin.crypto.authenticated.XChaCha20Poly1305Delegated
|
||||||
import com.ionspin.kotlin.crypto.hash.blake2b.Blake2bProperties
|
import com.ionspin.kotlin.crypto.hash.blake2b.Blake2bProperties
|
||||||
import com.ionspin.kotlin.crypto.hash.blake2b.Blake2bDelegated
|
import com.ionspin.kotlin.crypto.hash.blake2b.Blake2bDelegated
|
||||||
import com.ionspin.kotlin.crypto.hash.blake2b.Blake2bDelegatedStateless
|
import com.ionspin.kotlin.crypto.hash.blake2b.Blake2bDelegatedStateless
|
||||||
|
import com.ionspin.kotlin.crypto.hash.blake2b.Blake2bMultipart
|
||||||
import com.ionspin.kotlin.crypto.hash.sha.*
|
import com.ionspin.kotlin.crypto.hash.sha.*
|
||||||
|
import com.ionspin.kotlin.crypto.keyderivation.ArgonResult
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Ugljesa Jovanovic
|
* Created by Ugljesa Jovanovic
|
||||||
@ -11,7 +14,7 @@ import com.ionspin.kotlin.crypto.hash.sha.*
|
|||||||
* on 24-May-2020
|
* on 24-May-2020
|
||||||
*/
|
*/
|
||||||
|
|
||||||
object Crypto : CryptoProvider {
|
object CryptoInitializerDelegated : CryptoInitializer {
|
||||||
override suspend fun initialize() {
|
override suspend fun initialize() {
|
||||||
Initializer.initialize()
|
Initializer.initialize()
|
||||||
}
|
}
|
||||||
@ -20,9 +23,15 @@ object Crypto : CryptoProvider {
|
|||||||
Initializer.initializeWithCallback(done)
|
Initializer.initializeWithCallback(done)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun isInitialized(): Boolean {
|
||||||
|
return Initializer.isInitialized()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
object CryptoPrimitives : PrimitivesApi {
|
||||||
|
|
||||||
object Blake2b {
|
object Blake2b {
|
||||||
fun updateable(key: UByteArray? = null, hashLength: Int = Blake2bProperties.MAX_HASH_BYTES): com.ionspin.kotlin.crypto.hash.blake2b.Blake2b {
|
fun updateable(key: UByteArray? = null, hashLength: Int = Blake2bProperties.MAX_HASH_BYTES): com.ionspin.kotlin.crypto.hash.blake2b.Blake2bMultipart {
|
||||||
checkInitialization()
|
checkInitialization()
|
||||||
return Blake2bDelegated(key, hashLength)
|
return Blake2bDelegated(key, hashLength)
|
||||||
}
|
}
|
||||||
@ -46,7 +55,7 @@ object Crypto : CryptoProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
object Sha512 {
|
object Sha512 {
|
||||||
fun updateable(): com.ionspin.kotlin.crypto.hash.sha.Sha512 {
|
fun updateable(): Sha512Multipart {
|
||||||
checkInitialization()
|
checkInitialization()
|
||||||
return Sha512Delegated()
|
return Sha512Delegated()
|
||||||
}
|
}
|
||||||
@ -63,12 +72,136 @@ object Crypto : CryptoProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun hashBlake2bMultipart(key: UByteArray?, hashLength: Int): Blake2bMultipart {
|
||||||
|
checkInitialization()
|
||||||
|
return Blake2bDelegated(key, hashLength)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashBlake2b(message: UByteArray, key: UByteArray, hashLength: Int): UByteArray {
|
||||||
|
checkInitialization()
|
||||||
|
return Blake2bDelegatedStateless.digest(message, key, hashLength)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashSha256Multipart(): com.ionspin.kotlin.crypto.hash.sha.Sha256 {
|
||||||
|
checkInitialization()
|
||||||
|
return Sha256Delegated()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashSha256(message: UByteArray): UByteArray {
|
||||||
|
checkInitialization()
|
||||||
|
return Sha256StatelessDelegated.digest(inputMessage = message)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashSha512Multipart(): com.ionspin.kotlin.crypto.hash.sha.Sha512Multipart {
|
||||||
|
checkInitialization()
|
||||||
|
return Sha512Delegated()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashSha512(message: UByteArray): UByteArray {
|
||||||
|
checkInitialization()
|
||||||
|
return Sha512StatelessDelegated.digest(inputMessage = message)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun deriveKey(
|
||||||
|
password: String,
|
||||||
|
salt: String?,
|
||||||
|
key: String,
|
||||||
|
associatedData: String,
|
||||||
|
parallelism: Int,
|
||||||
|
tagLength: Int,
|
||||||
|
memory: Int,
|
||||||
|
numberOfIterations: Int
|
||||||
|
): ArgonResult {
|
||||||
|
// return Argon2Delegated.derive(
|
||||||
|
// password,
|
||||||
|
// salt,
|
||||||
|
// key,
|
||||||
|
// associatedData,
|
||||||
|
// parallelism
|
||||||
|
// tagLength,
|
||||||
|
// memory,
|
||||||
|
// numberOfIterations
|
||||||
|
// )
|
||||||
|
TODO()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
object SimpleCrypto {
|
fun SymmetricKey.Companion.randomKey() : SymmetricKey {
|
||||||
fun hash(message: String): UByteArray {
|
return SymmetricKey(SRNG.getRandomBytes(32))
|
||||||
return ubyteArrayOf(0U)
|
}
|
||||||
|
|
||||||
|
object Crypto {
|
||||||
|
|
||||||
|
object Hash : HashApi {
|
||||||
|
override fun hash(data: UByteArray, key : UByteArray) : HashedData {
|
||||||
|
return HashedData(Blake2bDelegatedStateless.digest(data, key))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun multipartHash(key: UByteArray?) : com.ionspin.kotlin.crypto.hash.MultipartHash {
|
||||||
|
return Blake2bDelegated(key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
object Encryption : EncryptionApi {
|
||||||
|
override fun encrypt(key: SymmetricKey, data : Encryptable<*>, additionalData : UByteArray) : EncryptedData {
|
||||||
|
if (key.value.size != 32) {
|
||||||
|
throw RuntimeException("Invalid key size! Required 32, supplied ${key.value.size}")
|
||||||
|
}
|
||||||
|
val nonce = SRNG.getRandomBytes(24)
|
||||||
|
return EncryptedData(XChaCha20Poly1305Delegated.encrypt(key.value, nonce, data.toEncryptableForm(), additionalData), nonce)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun <T: Encryptable<T>> decrypt(key: SymmetricKey, encryptedData : EncryptedData, additionalData: UByteArray, byteArrayDeserializer : (UByteArray) -> T) : T {
|
||||||
|
return byteArrayDeserializer(XChaCha20Poly1305Delegated.decrypt(key.value, encryptedData.nonce, encryptedData.ciphertext, additionalData))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createMultipartEncryptor(key: SymmetricKey): MultipartAuthenticatedEncryption {
|
||||||
|
return MultipartAuthenticatedEncryptor(key)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createMultipartDecryptor(key: SymmetricKey, header: MultipartEncryptionHeader) : MultipartAuthenticatedDecryption {
|
||||||
|
val decryptor = XChaCha20Poly1305Delegated()
|
||||||
|
decryptor.initializeForDecryption(key.value, header.nonce)
|
||||||
|
return MultipartAuthenticatedDecryptor(decryptor)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MultipartAuthenticatedEncryptor internal constructor(val key : SymmetricKey) : MultipartAuthenticatedEncryption {
|
||||||
|
|
||||||
|
val header : MultipartEncryptionHeader
|
||||||
|
val primitive = XChaCha20Poly1305Delegated()
|
||||||
|
init {
|
||||||
|
header = MultipartEncryptionHeader(primitive.initializeForEncryption(key.value))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun startEncryption(): MultipartEncryptionHeader {
|
||||||
|
return header
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun encryptPartialData(data: UByteArray, additionalData: UByteArray): EncryptedDataPart {
|
||||||
|
return EncryptedDataPart(primitive.encrypt(data, additionalData))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun cleanup() {
|
||||||
|
primitive.cleanup()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class MultipartAuthenticatedDecryptor internal constructor(val decryptor: XChaCha20Poly1305Delegated) : MultipartAuthenticatedDecryption {
|
||||||
|
override fun decryptPartialData(data: EncryptedDataPart, additionalData: UByteArray): DecryptedDataPart {
|
||||||
|
return DecryptedDataPart(decryptor.decrypt(data.data, additionalData))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun cleanup() {
|
||||||
|
decryptor.cleanup()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.authenticated
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 14-Jun-2020
|
||||||
|
*/
|
||||||
|
expect class XChaCha20Poly1305Delegated internal constructor() {
|
||||||
|
internal constructor(key: UByteArray, testState : UByteArray, testHeader: UByteArray, isDecryptor: Boolean)
|
||||||
|
companion object {
|
||||||
|
fun encrypt(key: UByteArray, nonce: UByteArray, message: UByteArray, additionalData: UByteArray) : UByteArray
|
||||||
|
fun decrypt(key: UByteArray, nonce: UByteArray, ciphertext: UByteArray, additionalData: UByteArray) : UByteArray
|
||||||
|
}
|
||||||
|
fun initializeForEncryption(key: UByteArray) : UByteArray
|
||||||
|
fun initializeForDecryption(key: UByteArray, header: UByteArray)
|
||||||
|
fun encrypt(data: UByteArray, additionalData: UByteArray = ubyteArrayOf()) : UByteArray
|
||||||
|
fun decrypt(data: UByteArray, additionalData: UByteArray = ubyteArrayOf()) : UByteArray
|
||||||
|
fun cleanup()
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -23,9 +23,9 @@ package com.ionspin.kotlin.crypto.hash.blake2b
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
expect class Blake2bDelegated(key: UByteArray? = null, hashLength: Int = Blake2bProperties.MAX_HASH_BYTES) : Blake2b
|
expect class Blake2bDelegated(key: UByteArray? = null, hashLength: Int = Blake2bProperties.MAX_HASH_BYTES) : Blake2bMultipart
|
||||||
|
|
||||||
|
|
||||||
expect object Blake2bDelegatedStateless : Blake2bStateless
|
expect object Blake2bDelegatedStateless : Blake2b
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,6 +24,6 @@ package com.ionspin.kotlin.crypto.hash.sha
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
expect class Sha512Delegated() : Sha512
|
expect class Sha512Delegated() : Sha512Multipart
|
||||||
|
|
||||||
expect object Sha512StatelessDelegated : StatelessSha512
|
expect object Sha512StatelessDelegated : Sha512
|
||||||
|
@ -1,241 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2019 Ugljesa Jovanovic
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.ionspin.kotlin.crypto.symmetric
|
|
||||||
|
|
||||||
import com.ionspin.kotlin.crypto.SRNG
|
|
||||||
import com.ionspin.kotlin.crypto.util.xor
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Advanced encryption standard with cipher block chaining and PKCS #5
|
|
||||||
*
|
|
||||||
* For bulk encryption/decryption use [AesCbcPure.encrypt] and [AesCbcPure.decrypt]
|
|
||||||
*
|
|
||||||
* To get an instance of AesCbc and then feed it data sequentially with [addData] use [createEncryptor] and [createDecryptor]
|
|
||||||
*
|
|
||||||
* Created by Ugljesa Jovanovic
|
|
||||||
* ugljesa.jovanovic@ionspin.com
|
|
||||||
* on 21-Sep-2019
|
|
||||||
*/
|
|
||||||
|
|
||||||
class AesCbcPure internal constructor(val aesKey: AesKey, val mode: Mode, initializationVector: UByteArray? = null) {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
const val BLOCK_BYTES = 16
|
|
||||||
/**
|
|
||||||
* Creates and returns AesCbc instance that can be fed data using [addData]. Once you have submitted all
|
|
||||||
* data call [encrypt]
|
|
||||||
*/
|
|
||||||
fun createEncryptor(aesKey: AesKey) : AesCbcPure {
|
|
||||||
return AesCbcPure(aesKey, Mode.ENCRYPT)
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Creates and returns AesCbc instance that can be fed data using [addData]. Once you have submitted all
|
|
||||||
* data call [decrypt]
|
|
||||||
*/
|
|
||||||
fun createDecryptor(aesKey : AesKey) : AesCbcPure {
|
|
||||||
return AesCbcPure(aesKey, Mode.DECRYPT)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Bulk encryption, returns encrypted data and a random initialization vector
|
|
||||||
*/
|
|
||||||
fun encrypt(aesKey: AesKey, data: UByteArray): EncryptedDataAndInitializationVector {
|
|
||||||
val aesCbc = AesCbcPure(aesKey, Mode.ENCRYPT)
|
|
||||||
aesCbc.addData(data)
|
|
||||||
return aesCbc.encrypt()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Bulk decryption, returns decrypted data
|
|
||||||
*/
|
|
||||||
fun decrypt(aesKey: AesKey, data: UByteArray, initialCounter: UByteArray? = null): UByteArray {
|
|
||||||
val aesCbc = AesCbcPure(aesKey, Mode.DECRYPT, initialCounter)
|
|
||||||
aesCbc.addData(data)
|
|
||||||
return aesCbc.decrypt()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun padToBlock(unpadded: UByteArray): UByteArray {
|
|
||||||
val paddingSize = 16 - unpadded.size
|
|
||||||
if (unpadded.size == BLOCK_BYTES) {
|
|
||||||
return unpadded
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unpadded.size == BLOCK_BYTES) {
|
|
||||||
return UByteArray(BLOCK_BYTES) {
|
|
||||||
BLOCK_BYTES.toUByte()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unpadded.size > BLOCK_BYTES) {
|
|
||||||
throw IllegalStateException("Block larger than 128 bytes")
|
|
||||||
}
|
|
||||||
|
|
||||||
return UByteArray(BLOCK_BYTES) {
|
|
||||||
when (it) {
|
|
||||||
in unpadded.indices -> unpadded[it]
|
|
||||||
else -> paddingSize.toUByte()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var currentOutput: UByteArray = ubyteArrayOf()
|
|
||||||
var previousEncrypted: UByteArray = ubyteArrayOf()
|
|
||||||
val initVector = if (initializationVector.isNullOrEmpty()) {
|
|
||||||
SRNG.getRandomBytes(16)
|
|
||||||
} else {
|
|
||||||
initializationVector
|
|
||||||
}
|
|
||||||
|
|
||||||
val output = MutableList<UByteArray>(0) { ubyteArrayOf() }
|
|
||||||
|
|
||||||
var buffer: UByteArray = UByteArray(16) { 0U }
|
|
||||||
var bufferCounter = 0
|
|
||||||
|
|
||||||
fun addData(data: UByteArray) {
|
|
||||||
//Padding
|
|
||||||
when {
|
|
||||||
bufferCounter + data.size < BLOCK_BYTES -> appendToBuffer(data, bufferCounter)
|
|
||||||
bufferCounter + data.size >= BLOCK_BYTES -> {
|
|
||||||
val chunked = data.chunked(BLOCK_BYTES)
|
|
||||||
chunked.forEach { chunk ->
|
|
||||||
if (bufferCounter + chunk.size < BLOCK_BYTES) {
|
|
||||||
appendToBuffer(chunk.toUByteArray(), bufferCounter)
|
|
||||||
} else {
|
|
||||||
chunk.toUByteArray().copyInto(
|
|
||||||
destination = buffer,
|
|
||||||
destinationOffset = bufferCounter,
|
|
||||||
startIndex = 0,
|
|
||||||
endIndex = BLOCK_BYTES - bufferCounter
|
|
||||||
)
|
|
||||||
output += consumeBlock(buffer)
|
|
||||||
buffer = UByteArray(BLOCK_BYTES) {
|
|
||||||
when (it) {
|
|
||||||
in (0 until (chunk.size - (BLOCK_BYTES - bufferCounter))) -> {
|
|
||||||
chunk[it + (BLOCK_BYTES - bufferCounter)]
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
0U
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
bufferCounter = chunk.size - (BLOCK_BYTES - bufferCounter)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Encrypt fed data and return it alongside the randomly chosen initialization vector
|
|
||||||
* @return Encrypted data and initialization vector
|
|
||||||
*/
|
|
||||||
fun encrypt(): EncryptedDataAndInitializationVector {
|
|
||||||
if (bufferCounter > 0) {
|
|
||||||
val lastBlockPadded = padToBlock(buffer)
|
|
||||||
if (lastBlockPadded.size > BLOCK_BYTES) {
|
|
||||||
val chunks = lastBlockPadded.chunked(BLOCK_BYTES).map { it.toUByteArray() }
|
|
||||||
output += consumeBlock(chunks[0])
|
|
||||||
output += consumeBlock(chunks[1])
|
|
||||||
} else {
|
|
||||||
output += consumeBlock(lastBlockPadded)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return EncryptedDataAndInitializationVector(
|
|
||||||
output.reversed().foldRight(UByteArray(0) { 0U }) { arrayOfUBytes, acc -> acc + arrayOfUBytes },
|
|
||||||
initVector
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Decrypt data
|
|
||||||
* @return Decrypted data
|
|
||||||
*/
|
|
||||||
fun decrypt(): UByteArray {
|
|
||||||
val removePaddingCount = output.last().last()
|
|
||||||
|
|
||||||
|
|
||||||
val removedPadding = if (removePaddingCount > 0U && removePaddingCount < 16U) {
|
|
||||||
output.last().dropLast(removePaddingCount.toInt() and 0x7F)
|
|
||||||
} else {
|
|
||||||
output.last().toList()
|
|
||||||
}.toUByteArray()
|
|
||||||
val preparedOutput = (output.dropLast(1) + listOf(removedPadding))
|
|
||||||
//JS compiler freaks out here if we don't supply exact type
|
|
||||||
val reversed : List<UByteArray> = preparedOutput.reversed() as List<UByteArray>
|
|
||||||
val folded : UByteArray = reversed.foldRight(UByteArray(0) { 0U }) { uByteArray, acc ->
|
|
||||||
acc + uByteArray
|
|
||||||
}
|
|
||||||
return folded
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun appendToBuffer(array: UByteArray, start: Int) {
|
|
||||||
array.copyInto(destination = buffer, destinationOffset = start, startIndex = 0, endIndex = array.size)
|
|
||||||
bufferCounter += array.size
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun consumeBlock(data: UByteArray): UByteArray {
|
|
||||||
return when (mode) {
|
|
||||||
Mode.ENCRYPT -> {
|
|
||||||
currentOutput = if (currentOutput.isEmpty()) {
|
|
||||||
println("IV: $initVector")
|
|
||||||
AesPure.encrypt(aesKey, data xor initVector)
|
|
||||||
} else {
|
|
||||||
AesPure.encrypt(aesKey, data xor currentOutput)
|
|
||||||
}
|
|
||||||
currentOutput
|
|
||||||
}
|
|
||||||
Mode.DECRYPT -> {
|
|
||||||
if (currentOutput.isEmpty()) {
|
|
||||||
currentOutput = AesPure.decrypt(aesKey, data) xor initVector
|
|
||||||
} else {
|
|
||||||
currentOutput = AesPure.decrypt(aesKey, data) xor previousEncrypted
|
|
||||||
}
|
|
||||||
previousEncrypted = data
|
|
||||||
currentOutput
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
data class EncryptedDataAndInitializationVector(val encryptedData : UByteArray, val initilizationVector : UByteArray) {
|
|
||||||
override fun equals(other: Any?): Boolean {
|
|
||||||
if (this === other) return true
|
|
||||||
if (other == null || this::class != other::class) return false
|
|
||||||
|
|
||||||
other as EncryptedDataAndInitializationVector
|
|
||||||
|
|
||||||
if (!encryptedData.contentEquals(other.encryptedData)) return false
|
|
||||||
if (!initilizationVector.contentEquals(other.initilizationVector)) return false
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
|
||||||
var result = encryptedData.contentHashCode()
|
|
||||||
result = 31 * result + initilizationVector.contentHashCode()
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,208 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2019 Ugljesa Jovanovic
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.ionspin.kotlin.crypto.symmetric
|
|
||||||
|
|
||||||
import com.ionspin.kotlin.bignum.Endianness
|
|
||||||
import com.ionspin.kotlin.bignum.integer.BigInteger
|
|
||||||
import com.ionspin.kotlin.bignum.modular.ModularBigInteger
|
|
||||||
import com.ionspin.kotlin.crypto.SRNG
|
|
||||||
import com.ionspin.kotlin.crypto.symmetric.AesCtrPure.Companion.encrypt
|
|
||||||
import com.ionspin.kotlin.crypto.util.xor
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Advanced encryption standard with counter mode
|
|
||||||
*
|
|
||||||
* For bulk encryption/decryption use [AesCtrPure.encrypt] and [AesCtrPure.decrypt]
|
|
||||||
*
|
|
||||||
* To get an instance of AesCtr and then feed it data sequentially with [addData] use [createEncryptor] and [createDecryptor]
|
|
||||||
*
|
|
||||||
* Created by Ugljesa Jovanovic
|
|
||||||
* ugljesa.jovanovic@ionspin.com
|
|
||||||
* on 22-Sep-2019
|
|
||||||
*/
|
|
||||||
|
|
||||||
class AesCtrPure internal constructor(val aesKey: AesKey, val mode: Mode, initialCounter: UByteArray? = null) {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
const val BLOCK_BYTES = 16
|
|
||||||
|
|
||||||
val modularCreator = ModularBigInteger.creatorForModulo(BigInteger.ONE.shl(128) - 1)
|
|
||||||
/**
|
|
||||||
* Creates and returns AesCtr instance that can be fed data using [addData]. Once you have submitted all
|
|
||||||
* data call [encrypt]
|
|
||||||
*/
|
|
||||||
fun createEncryptor(aesKey: AesKey) : AesCtrPure {
|
|
||||||
return AesCtrPure(aesKey, Mode.ENCRYPT)
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Creates and returns AesCtr instance that can be fed data using [addData]. Once you have submitted all
|
|
||||||
* data call [decrypt]
|
|
||||||
*/
|
|
||||||
fun createDecryptor(aesKey : AesKey) : AesCtrPure {
|
|
||||||
return AesCtrPure(aesKey, Mode.DECRYPT)
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Bulk encryption, returns encrypted data and a random initial counter
|
|
||||||
*/
|
|
||||||
fun encrypt(aesKey: AesKey, data: UByteArray): EncryptedDataAndInitialCounter {
|
|
||||||
val aesCtr = AesCtrPure(aesKey, Mode.ENCRYPT)
|
|
||||||
aesCtr.addData(data)
|
|
||||||
return aesCtr.encrypt()
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Bulk decryption, returns decrypted data
|
|
||||||
*/
|
|
||||||
fun decrypt(aesKey: AesKey, data: UByteArray, initialCounter: UByteArray? = null): UByteArray {
|
|
||||||
val aesCtr = AesCtrPure(aesKey, Mode.DECRYPT, initialCounter)
|
|
||||||
aesCtr.addData(data)
|
|
||||||
return aesCtr.decrypt()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
var currentOutput: UByteArray = ubyteArrayOf()
|
|
||||||
var previousEncrypted: UByteArray = ubyteArrayOf()
|
|
||||||
val counterStart = if (initialCounter.isNullOrEmpty()) {
|
|
||||||
SRNG.getRandomBytes(16)
|
|
||||||
} else {
|
|
||||||
initialCounter
|
|
||||||
}
|
|
||||||
var blockCounter = modularCreator.fromBigInteger(BigInteger.fromUByteArray(counterStart.toTypedArray(), Endianness.BIG))
|
|
||||||
|
|
||||||
val output = MutableList<UByteArray>(0) { ubyteArrayOf() }
|
|
||||||
|
|
||||||
var buffer: UByteArray = UByteArray(16) { 0U }
|
|
||||||
var bufferCounter = 0
|
|
||||||
|
|
||||||
fun addData(data: UByteArray) {
|
|
||||||
//Padding
|
|
||||||
when {
|
|
||||||
bufferCounter + data.size < BLOCK_BYTES -> appendToBuffer(data, bufferCounter)
|
|
||||||
bufferCounter + data.size >= BLOCK_BYTES -> {
|
|
||||||
val chunked = data.chunked(BLOCK_BYTES)
|
|
||||||
chunked.forEach { chunk ->
|
|
||||||
if (bufferCounter + chunk.size < BLOCK_BYTES) {
|
|
||||||
appendToBuffer(chunk.toUByteArray(), bufferCounter)
|
|
||||||
} else {
|
|
||||||
chunk.toUByteArray().copyInto(
|
|
||||||
destination = buffer,
|
|
||||||
destinationOffset = bufferCounter,
|
|
||||||
startIndex = 0,
|
|
||||||
endIndex = BLOCK_BYTES - bufferCounter
|
|
||||||
)
|
|
||||||
output += consumeBlock(buffer, blockCounter)
|
|
||||||
blockCounter += 1
|
|
||||||
buffer = UByteArray(BLOCK_BYTES) {
|
|
||||||
when (it) {
|
|
||||||
in (0 until (chunk.size - (BLOCK_BYTES - bufferCounter))) -> {
|
|
||||||
chunk[it + (BLOCK_BYTES - bufferCounter)]
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
0U
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
bufferCounter = chunk.size - (BLOCK_BYTES - bufferCounter)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Encrypt fed data and return it alongside the randomly chosen initial counter state
|
|
||||||
* @return Encrypted data and initial counter state
|
|
||||||
*/
|
|
||||||
fun encrypt(): EncryptedDataAndInitialCounter {
|
|
||||||
if (bufferCounter > 0) {
|
|
||||||
output += consumeBlock(buffer, blockCounter)
|
|
||||||
}
|
|
||||||
return EncryptedDataAndInitialCounter(
|
|
||||||
output.reversed().foldRight(UByteArray(0) { 0U }) { arrayOfUBytes, acc -> acc + arrayOfUBytes },
|
|
||||||
counterStart
|
|
||||||
)
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Decrypt data
|
|
||||||
* @return Decrypted data
|
|
||||||
*/
|
|
||||||
fun decrypt(): UByteArray {
|
|
||||||
if (bufferCounter > 0) {
|
|
||||||
output += consumeBlock(buffer, blockCounter)
|
|
||||||
}
|
|
||||||
//JS compiler freaks out here if we don't supply exact type
|
|
||||||
val reversed: List<UByteArray> = output.reversed() as List<UByteArray>
|
|
||||||
val folded: UByteArray = reversed.foldRight(UByteArray(0) { 0U }) { arrayOfUBytes, acc ->
|
|
||||||
acc + arrayOfUBytes
|
|
||||||
}
|
|
||||||
return folded
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun appendToBuffer(array: UByteArray, start: Int) {
|
|
||||||
array.copyInto(destination = buffer, destinationOffset = start, startIndex = 0, endIndex = array.size)
|
|
||||||
bufferCounter += array.size
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun consumeBlock(data: UByteArray, blockCount: ModularBigInteger): UByteArray {
|
|
||||||
val blockCountAsByteArray = blockCount.toUByteArray(Endianness.BIG).toUByteArray().expandCounterTo16Bytes()
|
|
||||||
return when (mode) {
|
|
||||||
Mode.ENCRYPT -> {
|
|
||||||
AesPure.encrypt(aesKey, blockCountAsByteArray) xor data
|
|
||||||
}
|
|
||||||
Mode.DECRYPT -> {
|
|
||||||
AesPure.encrypt(aesKey, blockCountAsByteArray) xor data
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun UByteArray.expandCounterTo16Bytes() : UByteArray {
|
|
||||||
return if (this.size < 16) {
|
|
||||||
println("Expanding")
|
|
||||||
val diff = 16 - this.size
|
|
||||||
val pad = UByteArray(diff) { 0U }
|
|
||||||
pad + this
|
|
||||||
} else {
|
|
||||||
this
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
data class EncryptedDataAndInitialCounter(val encryptedData : UByteArray, val initialCounter : UByteArray) {
|
|
||||||
override fun equals(other: Any?): Boolean {
|
|
||||||
if (this === other) return true
|
|
||||||
if (other == null || this::class != other::class) return false
|
|
||||||
|
|
||||||
other as EncryptedDataAndInitializationVector
|
|
||||||
|
|
||||||
if (!encryptedData.contentEquals(other.encryptedData)) return false
|
|
||||||
if (!initialCounter.contentEquals(other.initilizationVector)) return false
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
|
||||||
var result = encryptedData.contentHashCode()
|
|
||||||
result = 31 * result + initialCounter.contentHashCode()
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,378 +0,0 @@
|
|||||||
package com.ionspin.kotlin.crypto.symmetric
|
|
||||||
|
|
||||||
import com.ionspin.kotlin.crypto.util.flattenToUByteArray
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Ugljesa Jovanovic (jovanovic.ugljesa@gmail.com) on 07/Sep/2019
|
|
||||||
*/
|
|
||||||
|
|
||||||
internal class AesPure internal constructor(val aesKey: AesKey, val input: UByteArray) {
|
|
||||||
companion object {
|
|
||||||
private val debug = false
|
|
||||||
|
|
||||||
private val sBox: UByteArray =
|
|
||||||
ubyteArrayOf(
|
|
||||||
// @formatter:off
|
|
||||||
0x63U, 0x7cU, 0x77U, 0x7bU, 0xf2U, 0x6bU, 0x6fU, 0xc5U, 0x30U, 0x01U, 0x67U, 0x2bU, 0xfeU, 0xd7U, 0xabU, 0x76U,
|
|
||||||
0xcaU, 0x82U, 0xc9U, 0x7dU, 0xfaU, 0x59U, 0x47U, 0xf0U, 0xadU, 0xd4U, 0xa2U, 0xafU, 0x9cU, 0xa4U, 0x72U, 0xc0U,
|
|
||||||
0xb7U, 0xfdU, 0x93U, 0x26U, 0x36U, 0x3fU, 0xf7U, 0xccU, 0x34U, 0xa5U, 0xe5U, 0xf1U, 0x71U, 0xd8U, 0x31U, 0x15U,
|
|
||||||
0x04U, 0xc7U, 0x23U, 0xc3U, 0x18U, 0x96U, 0x05U, 0x9aU, 0x07U, 0x12U, 0x80U, 0xe2U, 0xebU, 0x27U, 0xb2U, 0x75U,
|
|
||||||
0x09U, 0x83U, 0x2cU, 0x1aU, 0x1bU, 0x6eU, 0x5aU, 0xa0U, 0x52U, 0x3bU, 0xd6U, 0xb3U, 0x29U, 0xe3U, 0x2fU, 0x84U,
|
|
||||||
0x53U, 0xd1U, 0x00U, 0xedU, 0x20U, 0xfcU, 0xb1U, 0x5bU, 0x6aU, 0xcbU, 0xbeU, 0x39U, 0x4aU, 0x4cU, 0x58U, 0xcfU,
|
|
||||||
0xd0U, 0xefU, 0xaaU, 0xfbU, 0x43U, 0x4dU, 0x33U, 0x85U, 0x45U, 0xf9U, 0x02U, 0x7fU, 0x50U, 0x3cU, 0x9fU, 0xa8U,
|
|
||||||
0x51U, 0xa3U, 0x40U, 0x8fU, 0x92U, 0x9dU, 0x38U, 0xf5U, 0xbcU, 0xb6U, 0xdaU, 0x21U, 0x10U, 0xffU, 0xf3U, 0xd2U,
|
|
||||||
0xcdU, 0x0cU, 0x13U, 0xecU, 0x5fU, 0x97U, 0x44U, 0x17U, 0xc4U, 0xa7U, 0x7eU, 0x3dU, 0x64U, 0x5dU, 0x19U, 0x73U,
|
|
||||||
0x60U, 0x81U, 0x4fU, 0xdcU, 0x22U, 0x2aU, 0x90U, 0x88U, 0x46U, 0xeeU, 0xb8U, 0x14U, 0xdeU, 0x5eU, 0x0bU, 0xdbU,
|
|
||||||
0xe0U, 0x32U, 0x3aU, 0x0aU, 0x49U, 0x06U, 0x24U, 0x5cU, 0xc2U, 0xd3U, 0xacU, 0x62U, 0x91U, 0x95U, 0xe4U, 0x79U,
|
|
||||||
0xe7U, 0xc8U, 0x37U, 0x6dU, 0x8dU, 0xd5U, 0x4eU, 0xa9U, 0x6cU, 0x56U, 0xf4U, 0xeaU, 0x65U, 0x7aU, 0xaeU, 0x08U,
|
|
||||||
0xbaU, 0x78U, 0x25U, 0x2eU, 0x1cU, 0xa6U, 0xb4U, 0xc6U, 0xe8U, 0xddU, 0x74U, 0x1fU, 0x4bU, 0xbdU, 0x8bU, 0x8aU,
|
|
||||||
0x70U, 0x3eU, 0xb5U, 0x66U, 0x48U, 0x03U, 0xf6U, 0x0eU, 0x61U, 0x35U, 0x57U, 0xb9U, 0x86U, 0xc1U, 0x1dU, 0x9eU,
|
|
||||||
0xe1U, 0xf8U, 0x98U, 0x11U, 0x69U, 0xd9U, 0x8eU, 0x94U, 0x9bU, 0x1eU, 0x87U, 0xe9U, 0xceU, 0x55U, 0x28U, 0xdfU,
|
|
||||||
0x8cU, 0xa1U, 0x89U, 0x0dU, 0xbfU, 0xe6U, 0x42U, 0x68U, 0x41U, 0x99U, 0x2dU, 0x0fU, 0xb0U, 0x54U, 0xbbU, 0x16U
|
|
||||||
// @formatter:on
|
|
||||||
)
|
|
||||||
|
|
||||||
private val inverseSBox: UByteArray =
|
|
||||||
ubyteArrayOf(
|
|
||||||
// @formatter:off
|
|
||||||
0x52U, 0x09U, 0x6aU, 0xd5U, 0x30U, 0x36U, 0xa5U, 0x38U, 0xbfU, 0x40U, 0xa3U, 0x9eU, 0x81U, 0xf3U, 0xd7U, 0xfbU,
|
|
||||||
0x7cU, 0xe3U, 0x39U, 0x82U, 0x9bU, 0x2fU, 0xffU, 0x87U, 0x34U, 0x8eU, 0x43U, 0x44U, 0xc4U, 0xdeU, 0xe9U, 0xcbU,
|
|
||||||
0x54U, 0x7bU, 0x94U, 0x32U, 0xa6U, 0xc2U, 0x23U, 0x3dU, 0xeeU, 0x4cU, 0x95U, 0x0bU, 0x42U, 0xfaU, 0xc3U, 0x4eU,
|
|
||||||
0x08U, 0x2eU, 0xa1U, 0x66U, 0x28U, 0xd9U, 0x24U, 0xb2U, 0x76U, 0x5bU, 0xa2U, 0x49U, 0x6dU, 0x8bU, 0xd1U, 0x25U,
|
|
||||||
0x72U, 0xf8U, 0xf6U, 0x64U, 0x86U, 0x68U, 0x98U, 0x16U, 0xd4U, 0xa4U, 0x5cU, 0xccU, 0x5dU, 0x65U, 0xb6U, 0x92U,
|
|
||||||
0x6cU, 0x70U, 0x48U, 0x50U, 0xfdU, 0xedU, 0xb9U, 0xdaU, 0x5eU, 0x15U, 0x46U, 0x57U, 0xa7U, 0x8dU, 0x9dU, 0x84U,
|
|
||||||
0x90U, 0xd8U, 0xabU, 0x00U, 0x8cU, 0xbcU, 0xd3U, 0x0aU, 0xf7U, 0xe4U, 0x58U, 0x05U, 0xb8U, 0xb3U, 0x45U, 0x06U,
|
|
||||||
0xd0U, 0x2cU, 0x1eU, 0x8fU, 0xcaU, 0x3fU, 0x0fU, 0x02U, 0xc1U, 0xafU, 0xbdU, 0x03U, 0x01U, 0x13U, 0x8aU, 0x6bU,
|
|
||||||
0x3aU, 0x91U, 0x11U, 0x41U, 0x4fU, 0x67U, 0xdcU, 0xeaU, 0x97U, 0xf2U, 0xcfU, 0xceU, 0xf0U, 0xb4U, 0xe6U, 0x73U,
|
|
||||||
0x96U, 0xacU, 0x74U, 0x22U, 0xe7U, 0xadU, 0x35U, 0x85U, 0xe2U, 0xf9U, 0x37U, 0xe8U, 0x1cU, 0x75U, 0xdfU, 0x6eU,
|
|
||||||
0x47U, 0xf1U, 0x1aU, 0x71U, 0x1dU, 0x29U, 0xc5U, 0x89U, 0x6fU, 0xb7U, 0x62U, 0x0eU, 0xaaU, 0x18U, 0xbeU, 0x1bU,
|
|
||||||
0xfcU, 0x56U, 0x3eU, 0x4bU, 0xc6U, 0xd2U, 0x79U, 0x20U, 0x9aU, 0xdbU, 0xc0U, 0xfeU, 0x78U, 0xcdU, 0x5aU, 0xf4U,
|
|
||||||
0x1fU, 0xddU, 0xa8U, 0x33U, 0x88U, 0x07U, 0xc7U, 0x31U, 0xb1U, 0x12U, 0x10U, 0x59U, 0x27U, 0x80U, 0xecU, 0x5fU,
|
|
||||||
0x60U, 0x51U, 0x7fU, 0xa9U, 0x19U, 0xb5U, 0x4aU, 0x0dU, 0x2dU, 0xe5U, 0x7aU, 0x9fU, 0x93U, 0xc9U, 0x9cU, 0xefU,
|
|
||||||
0xa0U, 0xe0U, 0x3bU, 0x4dU, 0xaeU, 0x2aU, 0xf5U, 0xb0U, 0xc8U, 0xebU, 0xbbU, 0x3cU, 0x83U, 0x53U, 0x99U, 0x61U,
|
|
||||||
0x17U, 0x2bU, 0x04U, 0x7eU, 0xbaU, 0x77U, 0xd6U, 0x26U, 0xe1U, 0x69U, 0x14U, 0x63U, 0x55U, 0x21U, 0x0cU, 0x7dU
|
|
||||||
// @formatter:on
|
|
||||||
)
|
|
||||||
|
|
||||||
val rcon: UByteArray = ubyteArrayOf(0x8DU, 0x01U, 0x02U, 0x04U, 0x08U, 0x10U, 0x20U, 0x40U, 0x80U, 0x1BU, 0x36U)
|
|
||||||
|
|
||||||
fun encrypt(aesKey: AesKey, input: UByteArray): UByteArray {
|
|
||||||
return AesPure(aesKey, input).encrypt()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun decrypt(aesKey: AesKey, input: UByteArray): UByteArray {
|
|
||||||
return AesPure(aesKey, input).decrypt()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
val state: Array<UByteArray> = (0 until 4).map { outerCounter ->
|
|
||||||
UByteArray(4) { innerCounter -> input[innerCounter * 4 + outerCounter] }
|
|
||||||
}.toTypedArray()
|
|
||||||
|
|
||||||
val numberOfRounds = when (aesKey) {
|
|
||||||
is AesKey.Aes128Key -> 10
|
|
||||||
is AesKey.Aes192Key -> 12
|
|
||||||
is AesKey.Aes256Key -> 14
|
|
||||||
}
|
|
||||||
|
|
||||||
val expandedKey: Array<UByteArray> = expandKey()
|
|
||||||
|
|
||||||
|
|
||||||
var round = 0
|
|
||||||
var completed : Boolean = false
|
|
||||||
private set
|
|
||||||
|
|
||||||
fun subBytes() {
|
|
||||||
state.forEachIndexed { indexRow, row ->
|
|
||||||
row.forEachIndexed { indexColumn, element ->
|
|
||||||
state[indexRow][indexColumn] = getSBoxValue(element)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getSBoxValue(element: UByte): UByte {
|
|
||||||
val firstDigit = (element / 16U).toInt()
|
|
||||||
val secondDigit = (element % 16U).toInt()
|
|
||||||
return sBox[firstDigit * 16 + secondDigit]
|
|
||||||
}
|
|
||||||
|
|
||||||
fun inverseSubBytes() {
|
|
||||||
state.forEachIndexed { indexRow, row ->
|
|
||||||
row.forEachIndexed { indexColumn, element ->
|
|
||||||
state[indexRow][indexColumn] = getInverseSBoxValue(element)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getInverseSBoxValue(element: UByte): UByte {
|
|
||||||
val firstDigit = (element / 16U).toInt()
|
|
||||||
val secondDigit = (element % 16U).toInt()
|
|
||||||
return inverseSBox[firstDigit * 16 + secondDigit]
|
|
||||||
}
|
|
||||||
|
|
||||||
fun shiftRows() {
|
|
||||||
state[0] = ubyteArrayOf(state[0][0], state[0][1], state[0][2], state[0][3])
|
|
||||||
state[1] = ubyteArrayOf(state[1][1], state[1][2], state[1][3], state[1][0])
|
|
||||||
state[2] = ubyteArrayOf(state[2][2], state[2][3], state[2][0], state[2][1])
|
|
||||||
state[3] = ubyteArrayOf(state[3][3], state[3][0], state[3][1], state[3][2])
|
|
||||||
}
|
|
||||||
|
|
||||||
fun inversShiftRows() {
|
|
||||||
state[0] = ubyteArrayOf(state[0][0], state[0][1], state[0][2], state[0][3])
|
|
||||||
state[1] = ubyteArrayOf(state[1][3], state[1][0], state[1][1], state[1][2])
|
|
||||||
state[2] = ubyteArrayOf(state[2][2], state[2][3], state[2][0], state[2][1])
|
|
||||||
state[3] = ubyteArrayOf(state[3][1], state[3][2], state[3][3], state[3][0])
|
|
||||||
}
|
|
||||||
|
|
||||||
fun mixColumns() {
|
|
||||||
val stateMixed: Array<UByteArray> = (0 until 4).map {
|
|
||||||
UByteArray(4) { 0U }
|
|
||||||
}.toTypedArray()
|
|
||||||
for (c in 0..3) {
|
|
||||||
|
|
||||||
stateMixed[0][c] = (2U gfm state[0][c]) xor (3U gfm state[1][c]) xor state[2][c] xor state[3][c]
|
|
||||||
stateMixed[1][c] = state[0][c] xor (2U gfm state[1][c]) xor (3U gfm state[2][c]) xor state[3][c]
|
|
||||||
stateMixed[2][c] = state[0][c] xor state[1][c] xor (2U gfm state[2][c]) xor (3U gfm state[3][c])
|
|
||||||
stateMixed[3][c] = 3U gfm state[0][c] xor state[1][c] xor state[2][c] xor (2U gfm state[3][c])
|
|
||||||
}
|
|
||||||
stateMixed.copyInto(state)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun inverseMixColumns() {
|
|
||||||
val stateMixed: Array<UByteArray> = (0 until 4).map {
|
|
||||||
UByteArray(4) { 0U }
|
|
||||||
}.toTypedArray()
|
|
||||||
for (c in 0..3) {
|
|
||||||
stateMixed[0][c] =
|
|
||||||
(0x0eU gfm state[0][c]) xor (0x0bU gfm state[1][c]) xor (0x0dU gfm state[2][c]) xor (0x09U gfm state[3][c])
|
|
||||||
stateMixed[1][c] =
|
|
||||||
(0x09U gfm state[0][c]) xor (0x0eU gfm state[1][c]) xor (0x0bU gfm state[2][c]) xor (0x0dU gfm state[3][c])
|
|
||||||
stateMixed[2][c] =
|
|
||||||
(0x0dU gfm state[0][c]) xor (0x09U gfm state[1][c]) xor (0x0eU gfm state[2][c]) xor (0x0bU gfm state[3][c])
|
|
||||||
stateMixed[3][c] =
|
|
||||||
(0x0bU gfm state[0][c]) xor (0x0dU gfm state[1][c]) xor (0x09U gfm state[2][c]) xor (0x0eU gfm state[3][c])
|
|
||||||
}
|
|
||||||
stateMixed.copyInto(state)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun galoisFieldAdd(first: UByte, second: UByte): UByte {
|
|
||||||
return first xor second
|
|
||||||
}
|
|
||||||
|
|
||||||
fun galoisFieldMultiply(first: UByte, second: UByte): UByte {
|
|
||||||
var result: UInt = 0U
|
|
||||||
var firstInt = first.toUInt()
|
|
||||||
var secondInt = second.toUInt()
|
|
||||||
var carry: UInt = 0U
|
|
||||||
for (i in 0..7) {
|
|
||||||
if (secondInt and 0x01U == 1U) {
|
|
||||||
result = result xor firstInt
|
|
||||||
}
|
|
||||||
carry = firstInt and 0x80U
|
|
||||||
firstInt = firstInt shl 1
|
|
||||||
if (carry == 0x80U) {
|
|
||||||
firstInt = firstInt xor 0x001BU
|
|
||||||
}
|
|
||||||
secondInt = secondInt shr 1
|
|
||||||
firstInt = firstInt and 0xFFU
|
|
||||||
}
|
|
||||||
return result.toUByte()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun addRoundKey() {
|
|
||||||
|
|
||||||
for (i in 0 until 4) {
|
|
||||||
state[0][i] = state[0][i] xor expandedKey[round * 4 + i][0]
|
|
||||||
state[1][i] = state[1][i] xor expandedKey[round * 4 + i][1]
|
|
||||||
state[2][i] = state[2][i] xor expandedKey[round * 4 + i][2]
|
|
||||||
state[3][i] = state[3][i] xor expandedKey[round * 4 + i][3]
|
|
||||||
}
|
|
||||||
round++
|
|
||||||
}
|
|
||||||
|
|
||||||
fun inverseAddRoundKey() {
|
|
||||||
for (i in 0 until 4) {
|
|
||||||
state[0][i] = state[0][i] xor expandedKey[round * 4 + i][0]
|
|
||||||
state[1][i] = state[1][i] xor expandedKey[round * 4 + i][1]
|
|
||||||
state[2][i] = state[2][i] xor expandedKey[round * 4 + i][2]
|
|
||||||
state[3][i] = state[3][i] xor expandedKey[round * 4 + i][3]
|
|
||||||
}
|
|
||||||
round--
|
|
||||||
}
|
|
||||||
|
|
||||||
infix fun UInt.gfm(second: UByte): UByte {
|
|
||||||
return galoisFieldMultiply(this.toUByte(), second)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun expandKey(): Array<UByteArray> {
|
|
||||||
val expandedKey = (0 until 4 * (numberOfRounds + 1)).map {
|
|
||||||
UByteArray(4) { 0U }
|
|
||||||
}.toTypedArray()
|
|
||||||
// First round
|
|
||||||
for (i in 0 until aesKey.numberOf32BitWords) {
|
|
||||||
expandedKey[i][0] = aesKey.keyArray[i * 4 + 0]
|
|
||||||
expandedKey[i][1] = aesKey.keyArray[i * 4 + 1]
|
|
||||||
expandedKey[i][2] = aesKey.keyArray[i * 4 + 2]
|
|
||||||
expandedKey[i][3] = aesKey.keyArray[i * 4 + 3]
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i in aesKey.numberOf32BitWords until 4 * (numberOfRounds + 1)) {
|
|
||||||
val temp = expandedKey[i - 1].copyOf()
|
|
||||||
if (i % aesKey.numberOf32BitWords == 0) {
|
|
||||||
//RotWord
|
|
||||||
val tempTemp = temp[0]
|
|
||||||
temp[0] = temp[1]
|
|
||||||
temp[1] = temp[2]
|
|
||||||
temp[2] = temp[3]
|
|
||||||
temp[3] = tempTemp
|
|
||||||
|
|
||||||
//SubWord
|
|
||||||
temp[0] = getSBoxValue(temp[0])
|
|
||||||
temp[1] = getSBoxValue(temp[1])
|
|
||||||
temp[2] = getSBoxValue(temp[2])
|
|
||||||
temp[3] = getSBoxValue(temp[3])
|
|
||||||
|
|
||||||
temp[0] = temp[0] xor rcon[i / aesKey.numberOf32BitWords]
|
|
||||||
|
|
||||||
} else if (aesKey is AesKey.Aes256Key && i % aesKey.numberOf32BitWords == 4) {
|
|
||||||
temp[0] = getSBoxValue(temp[0])
|
|
||||||
temp[1] = getSBoxValue(temp[1])
|
|
||||||
temp[2] = getSBoxValue(temp[2])
|
|
||||||
temp[3] = getSBoxValue(temp[3])
|
|
||||||
}
|
|
||||||
expandedKey[i] = expandedKey[i - aesKey.numberOf32BitWords].mapIndexed { index, it ->
|
|
||||||
it xor temp[index]
|
|
||||||
}.toUByteArray()
|
|
||||||
clearArray(temp)
|
|
||||||
}
|
|
||||||
return expandedKey
|
|
||||||
}
|
|
||||||
|
|
||||||
fun encrypt(): UByteArray {
|
|
||||||
if (completed) {
|
|
||||||
throw RuntimeException("Encrypt can only be called once per Aes instance, since the state is cleared at the " +
|
|
||||||
"end of the operation")
|
|
||||||
}
|
|
||||||
printState()
|
|
||||||
addRoundKey()
|
|
||||||
printState()
|
|
||||||
for (i in 0 until numberOfRounds - 1) {
|
|
||||||
subBytes()
|
|
||||||
printState()
|
|
||||||
shiftRows()
|
|
||||||
printState()
|
|
||||||
mixColumns()
|
|
||||||
printState()
|
|
||||||
addRoundKey()
|
|
||||||
printState()
|
|
||||||
}
|
|
||||||
|
|
||||||
subBytes()
|
|
||||||
printState()
|
|
||||||
shiftRows()
|
|
||||||
printState()
|
|
||||||
addRoundKey()
|
|
||||||
printState()
|
|
||||||
val transposedMatrix = (0 until 4).map { outerCounter ->
|
|
||||||
UByteArray(4) { 0U }
|
|
||||||
}
|
|
||||||
for (i in 0 until 4) {
|
|
||||||
for (j in 0 until 4) {
|
|
||||||
transposedMatrix[i][j] = state[j][i]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
state.forEach { clearArray(it) }
|
|
||||||
completed = true
|
|
||||||
return transposedMatrix.flattenToUByteArray()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun decrypt(): UByteArray {
|
|
||||||
if (completed) {
|
|
||||||
throw RuntimeException("Decrypt can only be called once per Aes instance, since the state is cleared at the " +
|
|
||||||
"end of the operation")
|
|
||||||
}
|
|
||||||
round = numberOfRounds
|
|
||||||
printState()
|
|
||||||
inverseAddRoundKey()
|
|
||||||
printState()
|
|
||||||
for (i in 0 until numberOfRounds - 1) {
|
|
||||||
inversShiftRows()
|
|
||||||
printState()
|
|
||||||
inverseSubBytes()
|
|
||||||
printState()
|
|
||||||
inverseAddRoundKey()
|
|
||||||
printState()
|
|
||||||
inverseMixColumns()
|
|
||||||
printState()
|
|
||||||
}
|
|
||||||
|
|
||||||
inversShiftRows()
|
|
||||||
printState()
|
|
||||||
inverseSubBytes()
|
|
||||||
printState()
|
|
||||||
inverseAddRoundKey()
|
|
||||||
printState()
|
|
||||||
|
|
||||||
val transposedMatrix = (0 until 4).map { outerCounter ->
|
|
||||||
UByteArray(4) { 0U }
|
|
||||||
}
|
|
||||||
for (i in 0 until 4) {
|
|
||||||
for (j in 0 until 4) {
|
|
||||||
transposedMatrix[i][j] = state[j][i]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
state.forEach { clearArray(it) }
|
|
||||||
completed = true
|
|
||||||
return transposedMatrix.flattenToUByteArray()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun clearArray(array : UByteArray) {
|
|
||||||
array.indices.forEach { array[it] = 0U }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private fun printState() {
|
|
||||||
if (!debug) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
println()
|
|
||||||
state.forEach {
|
|
||||||
println(it.joinToString(separator = " ") { it.toString(16) })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun printState(specific : List<UByteArray>) {
|
|
||||||
if (!debug) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
println()
|
|
||||||
specific.forEach {
|
|
||||||
println(it.joinToString(separator = " ") { it.toString(16) })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class AesKey(val key: String, val keyLength: Int) {
|
|
||||||
val keyArray: UByteArray = key.chunked(2).map { it.toUByte(16) }.toUByteArray()
|
|
||||||
val numberOf32BitWords = keyLength / 32
|
|
||||||
|
|
||||||
class Aes128Key(key: String) : AesKey(key, 128)
|
|
||||||
class Aes192Key(key: String) : AesKey(key, 192)
|
|
||||||
class Aes256Key(key: String) : AesKey(key, 256)
|
|
||||||
|
|
||||||
init {
|
|
||||||
checkKeyLength(key, keyLength)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun checkKeyLength(key: String, expectedLength: Int) {
|
|
||||||
if ((key.length / 2) != expectedLength / 8) {
|
|
||||||
throw RuntimeException("Invalid key length")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -23,25 +23,7 @@ package com.ionspin.kotlin.crypto.util
|
|||||||
* ugljesa.jovanovic@ionspin.com
|
* ugljesa.jovanovic@ionspin.com
|
||||||
* on 15-Jul-2019
|
* on 15-Jul-2019
|
||||||
*/
|
*/
|
||||||
fun Array<Byte>.hexColumsPrint() {
|
|
||||||
val printout = this.map { it.toString(16) }.chunked(16)
|
|
||||||
printout.forEach { println(it.joinToString(separator = " ") { it.toUpperCase() }) }
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Array<UByte>.hexColumsPrint(chunk : Int = 16) {
|
|
||||||
val printout = this.map { it.toString(16).padStart(2, '0') }.chunked(chunk)
|
|
||||||
printout.forEach { println(it.joinToString(separator = " ") { it.toUpperCase() }) }
|
|
||||||
}
|
|
||||||
|
|
||||||
fun UByteArray.hexColumsPrint(chunk : Int = 16) {
|
|
||||||
val printout = this.map { it.toString(16).padStart(2, '0') }.chunked(chunk)
|
|
||||||
printout.forEach { println(it.joinToString(separator = " ") { it.toUpperCase() }) }
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Array<ULong>.hexColumsPrint(chunk: Int = 3) {
|
|
||||||
val printout = this.map { it.toString(16) }.chunked(chunk)
|
|
||||||
printout.forEach { println(it.joinToString(separator = " ") { it.toUpperCase() }) }
|
|
||||||
}
|
|
||||||
|
|
||||||
inline fun <reified T> Array<T>.chunked(sliceSize: Int): Array<Array<T>> {
|
inline fun <reified T> Array<T>.chunked(sliceSize: Int): Array<Array<T>> {
|
||||||
val last = this.size % sliceSize
|
val last = this.size % sliceSize
|
||||||
@ -89,36 +71,8 @@ infix fun UByteArray.xor(other : UByteArray) : UByteArray {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun String.hexStringToTypedUByteArray() : Array<UByte> {
|
|
||||||
return this.chunked(2).map { it.toUByte(16) }.toTypedArray()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fun String.hexStringToUByteArray() : UByteArray {
|
|
||||||
return this.chunked(2).map { it.toUByte(16) }.toUByteArray()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fun Array<UByte>.toHexString() : String {
|
|
||||||
return this.joinToString(separator = "") {
|
|
||||||
if (it <= 0x0FU) {
|
|
||||||
"0${it.toString(16)}"
|
|
||||||
} else {
|
|
||||||
it.toString(16)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fun UByteArray.toHexString() : String {
|
|
||||||
return this.joinToString(separator = "") {
|
|
||||||
if (it <= 0x0FU) {
|
|
||||||
"0${it.toString(16)}"
|
|
||||||
} else {
|
|
||||||
it.toString(16)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// UInt / Array utils
|
// UInt / Array utils
|
||||||
|
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.ionspin.kotlin.crypto
|
||||||
|
|
||||||
|
import kotlin.test.Test
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 17-Jul-2020
|
||||||
|
*/
|
||||||
|
class DebugTest {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -28,7 +28,7 @@ import kotlin.test.assertTrue
|
|||||||
class SRNGTest {
|
class SRNGTest {
|
||||||
@Test
|
@Test
|
||||||
fun testSrng() = testBlocking {
|
fun testSrng() = testBlocking {
|
||||||
Crypto.initialize()
|
CryptoInitializerDelegated.initialize()
|
||||||
//Just a sanity test, need to add better srng tests.
|
//Just a sanity test, need to add better srng tests.
|
||||||
val randomBytes1 = SRNG.getRandomBytes(10)
|
val randomBytes1 = SRNG.getRandomBytes(10)
|
||||||
val randomBytes2 = SRNG.getRandomBytes(10)
|
val randomBytes2 = SRNG.getRandomBytes(10)
|
||||||
|
@ -0,0 +1,238 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.authenticated
|
||||||
|
|
||||||
|
import com.ionspin.kotlin.crypto.CryptoInitializerDelegated
|
||||||
|
import com.ionspin.kotlin.crypto.Initializer
|
||||||
|
import com.ionspin.kotlin.crypto.hash.encodeToUByteArray
|
||||||
|
import com.ionspin.kotlin.crypto.util.hexColumsPrint
|
||||||
|
import com.ionspin.kotlin.crypto.util.testBlocking
|
||||||
|
import kotlin.test.Ignore
|
||||||
|
import kotlin.test.Test
|
||||||
|
import kotlin.test.assertFails
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 17-Jun-2020
|
||||||
|
*/
|
||||||
|
class XChaCha20Poly1305Test {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun xChaCha20Poly1305() = testBlocking {
|
||||||
|
CryptoInitializerDelegated.initialize()
|
||||||
|
|
||||||
|
assertTrue {
|
||||||
|
val message = ("Ladies and Gentlemen of the class of '99: If I could offer you " +
|
||||||
|
"only one tip for the future, sunscreen would be it.").encodeToUByteArray()
|
||||||
|
|
||||||
|
val additionalData = ubyteArrayOf(
|
||||||
|
0x50U, 0x51U, 0x52U, 0x53U, 0xc0U, 0xc1U, 0xc2U, 0xc3U, 0xc4U, 0xc5U, 0xc6U, 0xc7U
|
||||||
|
)
|
||||||
|
val key = ubyteArrayOf(
|
||||||
|
0x80U, 0x81U, 0x82U, 0x83U, 0x84U, 0x85U, 0x86U, 0x87U,
|
||||||
|
0x88U, 0x89U, 0x8aU, 0x8bU, 0x8cU, 0x8dU, 0x8eU, 0x8fU,
|
||||||
|
0x90U, 0x91U, 0x92U, 0x93U, 0x94U, 0x95U, 0x96U, 0x97U,
|
||||||
|
0x98U, 0x99U, 0x9aU, 0x9bU, 0x9cU, 0x9dU, 0x9eU, 0x9fU,
|
||||||
|
)
|
||||||
|
|
||||||
|
val nonce = ubyteArrayOf(
|
||||||
|
0x40U, 0x41U, 0x42U, 0x43U, 0x44U, 0x45U, 0x46U, 0x47U,
|
||||||
|
0x48U, 0x49U, 0x4aU, 0x4bU, 0x4cU, 0x4dU, 0x4eU, 0x4fU,
|
||||||
|
0x50U, 0x51U, 0x52U, 0x53U, 0x54U, 0x55U, 0x56U, 0x57U,
|
||||||
|
)
|
||||||
|
|
||||||
|
val expected = ubyteArrayOf(
|
||||||
|
0xbdU, 0x6dU, 0x17U, 0x9dU, 0x3eU, 0x83U, 0xd4U, 0x3bU,
|
||||||
|
0x95U, 0x76U, 0x57U, 0x94U, 0x93U, 0xc0U, 0xe9U, 0x39U,
|
||||||
|
0x57U, 0x2aU, 0x17U, 0x00U, 0x25U, 0x2bU, 0xfaU, 0xccU,
|
||||||
|
0xbeU, 0xd2U, 0x90U, 0x2cU, 0x21U, 0x39U, 0x6cU, 0xbbU,
|
||||||
|
0x73U, 0x1cU, 0x7fU, 0x1bU, 0x0bU, 0x4aU, 0xa6U, 0x44U,
|
||||||
|
0x0bU, 0xf3U, 0xa8U, 0x2fU, 0x4eU, 0xdaU, 0x7eU, 0x39U,
|
||||||
|
0xaeU, 0x64U, 0xc6U, 0x70U, 0x8cU, 0x54U, 0xc2U, 0x16U,
|
||||||
|
0xcbU, 0x96U, 0xb7U, 0x2eU, 0x12U, 0x13U, 0xb4U, 0x52U,
|
||||||
|
0x2fU, 0x8cU, 0x9bU, 0xa4U, 0x0dU, 0xb5U, 0xd9U, 0x45U,
|
||||||
|
0xb1U, 0x1bU, 0x69U, 0xb9U, 0x82U, 0xc1U, 0xbbU, 0x9eU,
|
||||||
|
0x3fU, 0x3fU, 0xacU, 0x2bU, 0xc3U, 0x69U, 0x48U, 0x8fU,
|
||||||
|
0x76U, 0xb2U, 0x38U, 0x35U, 0x65U, 0xd3U, 0xffU, 0xf9U,
|
||||||
|
0x21U, 0xf9U, 0x66U, 0x4cU, 0x97U, 0x63U, 0x7dU, 0xa9U,
|
||||||
|
0x76U, 0x88U, 0x12U, 0xf6U, 0x15U, 0xc6U, 0x8bU, 0x13U,
|
||||||
|
0xb5U, 0x2eU, 0xc0U, 0x87U, 0x59U, 0x24U, 0xc1U, 0xc7U,
|
||||||
|
0x98U, 0x79U, 0x47U, 0xdeU, 0xafU, 0xd8U, 0x78U, 0x0aU,
|
||||||
|
0xcfU, 0x49U
|
||||||
|
)
|
||||||
|
val encrypted = XChaCha20Poly1305Delegated.encrypt(key, nonce, message, additionalData)
|
||||||
|
encrypted.hexColumsPrint()
|
||||||
|
val decrypted = XChaCha20Poly1305Delegated.decrypt(key, nonce, encrypted, additionalData)
|
||||||
|
println("Decrypted")
|
||||||
|
decrypted.hexColumsPrint()
|
||||||
|
println("----------")
|
||||||
|
encrypted.contentEquals(expected) && decrypted.contentEquals(message)
|
||||||
|
}
|
||||||
|
|
||||||
|
assertTrue {
|
||||||
|
val message = ubyteArrayOf(
|
||||||
|
0x00U
|
||||||
|
)
|
||||||
|
val additionalData = ubyteArrayOf(
|
||||||
|
0x00U
|
||||||
|
)
|
||||||
|
val key = ubyteArrayOf(
|
||||||
|
0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U,
|
||||||
|
0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U,
|
||||||
|
0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U,
|
||||||
|
0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U,
|
||||||
|
)
|
||||||
|
|
||||||
|
val nonce = ubyteArrayOf(
|
||||||
|
0x00U, 0x01U, 0x02U, 0x03U, 0x04U, 0x05U, 0x06U, 0x07U, 0x08U, 0x09U, 0x0aU, 0x0bU,
|
||||||
|
0x0cU, 0x0dU, 0x0eU, 0x0fU, 0x10U, 0x11U, 0x12U, 0x13U, 0x14U, 0x15U, 0x16U, 0x17U,
|
||||||
|
)
|
||||||
|
|
||||||
|
val expected = ubyteArrayOf(
|
||||||
|
0xbdU, 0x3bU, 0x8aU, 0xd7U, 0xa1U, 0x9dU, 0xe8U, 0xc4U, 0x55U,
|
||||||
|
0x84U, 0x6fU, 0xfcU, 0x75U, 0x31U, 0xbfU, 0x0cU, 0x2dU
|
||||||
|
)
|
||||||
|
val encrypted = XChaCha20Poly1305Delegated.encrypt(key, nonce, message, additionalData)
|
||||||
|
val decrypted = XChaCha20Poly1305Delegated.decrypt(key, nonce, encrypted, additionalData)
|
||||||
|
|
||||||
|
encrypted.contentEquals(expected) && decrypted.contentEquals(message)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Ignore() //"Will fail because nonce is not a parameter any more"
|
||||||
|
@Test
|
||||||
|
fun updateableXChaCha20Poly1305() {
|
||||||
|
assertTrue {
|
||||||
|
val message = ("Ladies and Gentlemen of the class of '99: If I could offer you " +
|
||||||
|
"only one tip for the future, sunscreen would be it.").encodeToUByteArray()
|
||||||
|
|
||||||
|
val additionalData = ubyteArrayOf(
|
||||||
|
0x50U, 0x51U, 0x52U, 0x53U, 0xc0U, 0xc1U, 0xc2U, 0xc3U, 0xc4U, 0xc5U, 0xc6U, 0xc7U
|
||||||
|
)
|
||||||
|
val key = ubyteArrayOf(
|
||||||
|
0x80U, 0x81U, 0x82U, 0x83U, 0x84U, 0x85U, 0x86U, 0x87U,
|
||||||
|
0x88U, 0x89U, 0x8aU, 0x8bU, 0x8cU, 0x8dU, 0x8eU, 0x8fU,
|
||||||
|
0x90U, 0x91U, 0x92U, 0x93U, 0x94U, 0x95U, 0x96U, 0x97U,
|
||||||
|
0x98U, 0x99U, 0x9aU, 0x9bU, 0x9cU, 0x9dU, 0x9eU, 0x9fU,
|
||||||
|
)
|
||||||
|
|
||||||
|
val nonce = ubyteArrayOf(
|
||||||
|
0x40U, 0x41U, 0x42U, 0x43U, 0x44U, 0x45U, 0x46U, 0x47U,
|
||||||
|
0x48U, 0x49U, 0x4aU, 0x4bU, 0x4cU, 0x4dU, 0x4eU, 0x4fU,
|
||||||
|
0x50U, 0x51U, 0x52U, 0x53U, 0x54U, 0x55U, 0x56U, 0x57U,
|
||||||
|
)
|
||||||
|
|
||||||
|
val expected = ubyteArrayOf(
|
||||||
|
0xbdU, 0x6dU, 0x17U, 0x9dU, 0x3eU, 0x83U, 0xd4U, 0x3bU,
|
||||||
|
0x95U, 0x76U, 0x57U, 0x94U, 0x93U, 0xc0U, 0xe9U, 0x39U,
|
||||||
|
0x57U, 0x2aU, 0x17U, 0x00U, 0x25U, 0x2bU, 0xfaU, 0xccU,
|
||||||
|
0xbeU, 0xd2U, 0x90U, 0x2cU, 0x21U, 0x39U, 0x6cU, 0xbbU,
|
||||||
|
0x73U, 0x1cU, 0x7fU, 0x1bU, 0x0bU, 0x4aU, 0xa6U, 0x44U,
|
||||||
|
0x0bU, 0xf3U, 0xa8U, 0x2fU, 0x4eU, 0xdaU, 0x7eU, 0x39U,
|
||||||
|
0xaeU, 0x64U, 0xc6U, 0x70U, 0x8cU, 0x54U, 0xc2U, 0x16U,
|
||||||
|
0xcbU, 0x96U, 0xb7U, 0x2eU, 0x12U, 0x13U, 0xb4U, 0x52U,
|
||||||
|
0x2fU, 0x8cU, 0x9bU, 0xa4U, 0x0dU, 0xb5U, 0xd9U, 0x45U,
|
||||||
|
0xb1U, 0x1bU, 0x69U, 0xb9U, 0x82U, 0xc1U, 0xbbU, 0x9eU,
|
||||||
|
0x3fU, 0x3fU, 0xacU, 0x2bU, 0xc3U, 0x69U, 0x48U, 0x8fU,
|
||||||
|
0x76U, 0xb2U, 0x38U, 0x35U, 0x65U, 0xd3U, 0xffU, 0xf9U,
|
||||||
|
0x21U, 0xf9U, 0x66U, 0x4cU, 0x97U, 0x63U, 0x7dU, 0xa9U,
|
||||||
|
0x76U, 0x88U, 0x12U, 0xf6U, 0x15U, 0xc6U, 0x8bU, 0x13U,
|
||||||
|
0xb5U, 0x2eU, 0xc0U, 0x87U, 0x59U, 0x24U, 0xc1U, 0xc7U,
|
||||||
|
0x98U, 0x79U, 0x47U, 0xdeU, 0xafU, 0xd8U, 0x78U, 0x0aU,
|
||||||
|
0xcfU, 0x49U
|
||||||
|
)
|
||||||
|
// val xChaChaPoly = XChaCha20Poly1305Delegated(key, additionalData)
|
||||||
|
// val firstChunk = xChaChaPoly.encrypt(message)
|
||||||
|
// val finalChunk = xChaChaPoly.finishEncryption().first
|
||||||
|
// val result = firstChunk + finalChunk
|
||||||
|
|
||||||
|
// result.contentEquals(expected)
|
||||||
|
1 == 1
|
||||||
|
}
|
||||||
|
|
||||||
|
assertTrue {
|
||||||
|
val message = ubyteArrayOf(
|
||||||
|
0x00U
|
||||||
|
)
|
||||||
|
val additionalData = ubyteArrayOf(
|
||||||
|
0x00U
|
||||||
|
)
|
||||||
|
val key = ubyteArrayOf(
|
||||||
|
0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U,
|
||||||
|
0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U,
|
||||||
|
0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U,
|
||||||
|
0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U,
|
||||||
|
)
|
||||||
|
|
||||||
|
val nonce = ubyteArrayOf(
|
||||||
|
0x00U, 0x01U, 0x02U, 0x03U, 0x04U, 0x05U, 0x06U, 0x07U, 0x08U, 0x09U, 0x0aU, 0x0bU,
|
||||||
|
0x0cU, 0x0dU, 0x0eU, 0x0fU, 0x10U, 0x11U, 0x12U, 0x13U, 0x14U, 0x15U, 0x16U, 0x17U,
|
||||||
|
)
|
||||||
|
|
||||||
|
val expected = ubyteArrayOf(
|
||||||
|
0xbdU, 0x3bU, 0x8aU, 0xd7U, 0xa1U, 0x9dU, 0xe8U, 0xc4U, 0x55U,
|
||||||
|
0x84U, 0x6fU, 0xfcU, 0x75U, 0x31U, 0xbfU, 0x0cU, 0x2dU
|
||||||
|
)
|
||||||
|
// val xChaChaPoly = XChaCha20Poly1305Delegated(key, additionalData)
|
||||||
|
// val firstChunk = xChaChaPoly.encrypt(message)
|
||||||
|
// val finalChunk = xChaChaPoly.finishEncryption().first
|
||||||
|
// val result = firstChunk + finalChunk
|
||||||
|
// result.contentEquals(expected)
|
||||||
|
1 == 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testStreamingImpl() = testBlocking {
|
||||||
|
Initializer.initialize()
|
||||||
|
val key = UByteArray(32) { 0U }
|
||||||
|
val state = ubyteArrayOf(
|
||||||
|
0x2DU, 0xDBU, 0xC7U, 0xB2U, 0x03U, 0xBCU, 0xC3U, 0x22U, 0xBDU, 0x0CU, 0xBAU, 0x82U, 0xADU, 0x77U, 0x79U, 0x44U,
|
||||||
|
0xE6U, 0x8FU, 0xA9U, 0x94U, 0x89U, 0xB1U, 0xDFU, 0xBEU, 0x00U, 0x9FU, 0x69U, 0xECU, 0x21U, 0x88U, 0x47U, 0x55U,
|
||||||
|
0x01U, 0x00U, 0x00U, 0x00U, 0xC5U, 0x55U, 0x06U, 0x38U, 0xEBU, 0xA3U, 0x12U, 0x7BU, 0x00U, 0x00U, 0x00U, 0x00U,
|
||||||
|
0x00U, 0x00U, 0x00U, 0x00U,
|
||||||
|
)
|
||||||
|
val header = ubyteArrayOf(
|
||||||
|
0x49U, 0x62U, 0x22U, 0x03U, 0xB7U, 0x46U, 0x11U, 0x97U, 0x8FU, 0x46U, 0x4AU, 0x3BU, 0x2FU, 0x2AU, 0x81U, 0x03U,
|
||||||
|
0xC5U, 0x55U, 0x06U, 0x38U, 0xEBU, 0xA3U, 0x12U, 0x7BU,
|
||||||
|
)
|
||||||
|
val expected = ubyteArrayOf(
|
||||||
|
0xAFU, 0xD3U, 0x2DU, 0x59U, 0xB8U, 0xC4U, 0x66U, 0x2EU, 0x47U, 0x29U, 0xC6U, 0xF9U, 0x93U, 0x4BU, 0x09U, 0x27U,
|
||||||
|
0x24U, 0xDDU, 0xF3U, 0x05U, 0x48U, 0x94U, 0x67U, 0x10U, 0x00U, 0x21U, 0x85U, 0x22U, 0x96U, 0x3CU, 0xCEU, 0x8EU,
|
||||||
|
0xB7U, 0x53U, 0x9DU, 0x46U, 0xF5U, 0x3CU, 0x5EU, 0x48U, 0x9BU, 0x8CU, 0x13U, 0xB7U, 0x28U, 0x6BU, 0xB3U, 0x6CU,
|
||||||
|
0x3AU, 0x04U, 0xB7U, 0x25U, 0xB9U, 0x50U, 0x45U, 0x08U, 0x0BU, 0x89U, 0xA2U, 0x0FU, 0x70U, 0xCCU, 0x60U, 0x1BU,
|
||||||
|
0xC3U, 0x17U, 0x35U, 0x9FU, 0xAEU, 0x82U, 0x51U, 0x43U, 0x1BU, 0x9DU, 0x53U, 0x9EU, 0xE2U, 0xAFU, 0x20U, 0x1FU,
|
||||||
|
0xFDU, 0x03U, 0x59U, 0x11U, 0x51U, 0x9EU, 0xACU, 0x83U, 0xCDU, 0x78U, 0xD1U, 0xD0U, 0xE5U, 0xD7U, 0x0EU, 0x41U,
|
||||||
|
0xDEU, 0xFBU, 0x5CU, 0x7FU, 0x1CU, 0x26U, 0x32U, 0x2CU, 0x51U, 0xF6U, 0xEFU, 0xC6U, 0x34U, 0xC4U, 0xACU, 0x6CU,
|
||||||
|
0xE8U, 0xF9U, 0x4BU, 0xABU, 0xA3U,
|
||||||
|
)
|
||||||
|
val encryptor = XChaCha20Poly1305Delegated(key, state, header, false)
|
||||||
|
val decryptor = XChaCha20Poly1305Delegated(key, state, header, true)
|
||||||
|
val data = UByteArray(100) { 0U }
|
||||||
|
val result = encryptor.encrypt(data)
|
||||||
|
val decrypted = decryptor.decrypt(result)
|
||||||
|
println("Encrypted -----------")
|
||||||
|
result.hexColumsPrint()
|
||||||
|
println("Encrypted end -----------")
|
||||||
|
println("Decrypted -----------")
|
||||||
|
decrypted.hexColumsPrint()
|
||||||
|
println("Decrypted end -----------")
|
||||||
|
assertTrue {
|
||||||
|
expected.contentEquals(result) && decrypted.contentEquals(data)
|
||||||
|
}
|
||||||
|
val messedUpTag = result.copyOf()
|
||||||
|
messedUpTag[messedUpTag.size - 2] = 0U
|
||||||
|
assertFails {
|
||||||
|
val decryptorForWrongTag = XChaCha20Poly1305Delegated(key, state, header, true)
|
||||||
|
val plaintext = decryptorForWrongTag.decrypt(messedUpTag)
|
||||||
|
println("Decrypted with wrong tag -----------")
|
||||||
|
plaintext.hexColumsPrint()
|
||||||
|
println("Decrypted with wrong tag end -----------")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package com.ionspin.kotlin.crypto.hash.blake2b
|
package com.ionspin.kotlin.crypto.hash.blake2b
|
||||||
|
|
||||||
import com.ionspin.kotlin.crypto.Crypto
|
import com.ionspin.kotlin.crypto.Crypto
|
||||||
|
import com.ionspin.kotlin.crypto.CryptoPrimitives
|
||||||
import com.ionspin.kotlin.crypto.Initializer
|
import com.ionspin.kotlin.crypto.Initializer
|
||||||
import com.ionspin.kotlin.crypto.hash.encodeToUByteArray
|
import com.ionspin.kotlin.crypto.hash.encodeToUByteArray
|
||||||
import com.ionspin.kotlin.crypto.util.testBlocking
|
import com.ionspin.kotlin.crypto.util.testBlocking
|
||||||
@ -23,7 +24,7 @@ class Blake2bTest {
|
|||||||
Initializer.initialize()
|
Initializer.initialize()
|
||||||
val expected = "a71079d42853dea26e453004338670a53814b78137ffbed07603a41d76a483aa9bc33b582f77d30a65e6f29a89" +
|
val expected = "a71079d42853dea26e453004338670a53814b78137ffbed07603a41d76a483aa9bc33b582f77d30a65e6f29a89" +
|
||||||
"6c0411f38312e1d66e0bf16386c86a89bea572"
|
"6c0411f38312e1d66e0bf16386c86a89bea572"
|
||||||
val result = Crypto.Blake2b.stateless("test".encodeToUByteArray()).toHexString()
|
val result = CryptoPrimitives.Blake2b.stateless("test".encodeToUByteArray()).toHexString()
|
||||||
// println("Result: $result")
|
// println("Result: $result")
|
||||||
assertTrue { result == expected }
|
assertTrue { result == expected }
|
||||||
}
|
}
|
||||||
@ -35,7 +36,7 @@ class Blake2bTest {
|
|||||||
Initializer.initialize()
|
Initializer.initialize()
|
||||||
val expected = "a71079d42853dea26e453004338670a53814b78137ffbed07603a41d76a483aa9bc33b582f77d30a65e6f29a89" +
|
val expected = "a71079d42853dea26e453004338670a53814b78137ffbed07603a41d76a483aa9bc33b582f77d30a65e6f29a89" +
|
||||||
"6c0411f38312e1d66e0bf16386c86a89bea572"
|
"6c0411f38312e1d66e0bf16386c86a89bea572"
|
||||||
val blake2b = Crypto.Blake2b.updateable()
|
val blake2b = CryptoPrimitives.Blake2b.updateable()
|
||||||
blake2b.update("t".encodeToUByteArray())
|
blake2b.update("t".encodeToUByteArray())
|
||||||
blake2b.update(("est".encodeToUByteArray()))
|
blake2b.update(("est".encodeToUByteArray()))
|
||||||
val result = blake2b.digest().toHexString()
|
val result = blake2b.digest().toHexString()
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.ionspin.kotlin.crypto.hash.sha
|
package com.ionspin.kotlin.crypto.hash.sha
|
||||||
|
|
||||||
import com.ionspin.kotlin.crypto.Crypto
|
import com.ionspin.kotlin.crypto.Crypto
|
||||||
|
import com.ionspin.kotlin.crypto.CryptoPrimitives
|
||||||
import com.ionspin.kotlin.crypto.Initializer
|
import com.ionspin.kotlin.crypto.Initializer
|
||||||
import com.ionspin.kotlin.crypto.hash.encodeToUByteArray
|
import com.ionspin.kotlin.crypto.hash.encodeToUByteArray
|
||||||
import com.ionspin.kotlin.crypto.util.testBlocking
|
import com.ionspin.kotlin.crypto.util.testBlocking
|
||||||
@ -21,9 +22,10 @@ class Sha256Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun statelessSimpleTest() {
|
fun statelessSimpleTest() = testBlocking {
|
||||||
|
Initializer.initialize()
|
||||||
val expected = "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
|
val expected = "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
|
||||||
val result = Crypto.Sha256.stateless("test".encodeToUByteArray()).toHexString()
|
val result = CryptoPrimitives.Sha256.stateless("test".encodeToUByteArray()).toHexString()
|
||||||
// println("Result: $result")
|
// println("Result: $result")
|
||||||
assertTrue { result == expected }
|
assertTrue { result == expected }
|
||||||
}
|
}
|
||||||
@ -31,9 +33,10 @@ class Sha256Test {
|
|||||||
//This is a bad test since it's not larger than one block
|
//This is a bad test since it's not larger than one block
|
||||||
//but for now I'm testing that the platform library is being correctly called
|
//but for now I'm testing that the platform library is being correctly called
|
||||||
@Test
|
@Test
|
||||||
fun updateableSimpleTest() {
|
fun updateableSimpleTest() = testBlocking {
|
||||||
|
Initializer.initialize()
|
||||||
val expected = "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
|
val expected = "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
|
||||||
val sha256 = Crypto.Sha256.updateable()
|
val sha256 = CryptoPrimitives.Sha256.updateable()
|
||||||
sha256.update("t".encodeToUByteArray())
|
sha256.update("t".encodeToUByteArray())
|
||||||
sha256.update(("est".encodeToUByteArray()))
|
sha256.update(("est".encodeToUByteArray()))
|
||||||
val result = sha256.digest().toHexString()
|
val result = sha256.digest().toHexString()
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.ionspin.kotlin.crypto.hash.sha
|
package com.ionspin.kotlin.crypto.hash.sha
|
||||||
|
|
||||||
import com.ionspin.kotlin.crypto.Crypto
|
import com.ionspin.kotlin.crypto.Crypto
|
||||||
|
import com.ionspin.kotlin.crypto.CryptoPrimitives
|
||||||
import com.ionspin.kotlin.crypto.Initializer
|
import com.ionspin.kotlin.crypto.Initializer
|
||||||
import com.ionspin.kotlin.crypto.hash.encodeToUByteArray
|
import com.ionspin.kotlin.crypto.hash.encodeToUByteArray
|
||||||
import com.ionspin.kotlin.crypto.util.testBlocking
|
import com.ionspin.kotlin.crypto.util.testBlocking
|
||||||
@ -21,10 +22,11 @@ class Sha512Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun statelessSimpleTest() {
|
fun statelessSimpleTest() = testBlocking {
|
||||||
|
Initializer.initialize()
|
||||||
val expected = "ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67" +
|
val expected = "ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67" +
|
||||||
"b143732c304cc5fa9ad8e6f57f50028a8ff"
|
"b143732c304cc5fa9ad8e6f57f50028a8ff"
|
||||||
val result = Crypto.Sha512.stateless("test".encodeToUByteArray()).toHexString()
|
val result = CryptoPrimitives.Sha512.stateless("test".encodeToUByteArray()).toHexString()
|
||||||
// println("Result: $result")
|
// println("Result: $result")
|
||||||
assertTrue { result == expected }
|
assertTrue { result == expected }
|
||||||
}
|
}
|
||||||
@ -32,10 +34,11 @@ class Sha512Test {
|
|||||||
//This is a bad test since it's not larger than one block
|
//This is a bad test since it's not larger than one block
|
||||||
//but for now I'm testing that the platform library is being correctly called
|
//but for now I'm testing that the platform library is being correctly called
|
||||||
@Test
|
@Test
|
||||||
fun updateableSimpleTest() {
|
fun updateableSimpleTest() = testBlocking {
|
||||||
|
Initializer.initialize()
|
||||||
val expected = "ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67" +
|
val expected = "ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67" +
|
||||||
"b143732c304cc5fa9ad8e6f57f50028a8ff"
|
"b143732c304cc5fa9ad8e6f57f50028a8ff"
|
||||||
val sha512 = Crypto.Sha512.updateable()
|
val sha512 = CryptoPrimitives.Sha512.updateable()
|
||||||
sha512.update("t".encodeToUByteArray())
|
sha512.update("t".encodeToUByteArray())
|
||||||
sha512.update(("est".encodeToUByteArray()))
|
sha512.update(("est".encodeToUByteArray()))
|
||||||
val result = sha512.digest().toHexString()
|
val result = sha512.digest().toHexString()
|
||||||
|
@ -0,0 +1,50 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.highlevel
|
||||||
|
|
||||||
|
import com.ionspin.kotlin.crypto.Crypto
|
||||||
|
import com.ionspin.kotlin.crypto.Initializer
|
||||||
|
import com.ionspin.kotlin.crypto.SymmetricKey
|
||||||
|
import com.ionspin.kotlin.crypto.hash.decodeToString
|
||||||
|
import com.ionspin.kotlin.crypto.hash.encodeToUByteArray
|
||||||
|
import com.ionspin.kotlin.crypto.util.hexColumsPrint
|
||||||
|
import com.ionspin.kotlin.crypto.util.testBlocking
|
||||||
|
import kotlin.test.Test
|
||||||
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 09-Jul-2020
|
||||||
|
*/
|
||||||
|
class EncryptionTest {
|
||||||
|
@Test
|
||||||
|
fun testMultipartEncryption() = testBlocking {
|
||||||
|
Initializer.initialize()
|
||||||
|
val plaintext = ("pUoR4JVXJUeMKNkt6ZGGzEdTo33ajNGXwXpivBKA0XKs8toGRYI9Eul4bELRDkaQDNhd4vZseEFU" +
|
||||||
|
"ojsAn3c9zIifIrMnydSivHVZ2pBtpAQwYoJhYmEsfE0tROGnOwFWyB9K6LRSv1gB3YqKR9VyM8mpRoUM3UCRRjyiX7bnKdCE1" +
|
||||||
|
"EiX0myiwcY1nUKTgB3keERWtMU07hX7bCtao5nRvDofSj3o3IInHRQh6opltr5asQwn4m1qn029QF").encodeToUByteArray()
|
||||||
|
val additionalData = "Additional data 1".encodeToUByteArray()
|
||||||
|
val keyValue = UByteArray(32) { it.toUByte() }
|
||||||
|
val key = SymmetricKey(keyValue)
|
||||||
|
val encryptor = Crypto.Encryption.createMultipartEncryptor(key)
|
||||||
|
val header = encryptor.startEncryption()
|
||||||
|
val ciphertext1 = encryptor.encryptPartialData(plaintext.sliceArray(0 until 100), additionalData)
|
||||||
|
val ciphertext2 = encryptor.encryptPartialData(plaintext.sliceArray(100 until 200))
|
||||||
|
val ciphertext3 = encryptor.encryptPartialData(plaintext.sliceArray(200 until 250))
|
||||||
|
//decrypt
|
||||||
|
val decryptor = Crypto.Encryption.createMultipartDecryptor(key, header)
|
||||||
|
val plaintext1 = decryptor.decryptPartialData(ciphertext1, additionalData)
|
||||||
|
val plaintext2 = decryptor.decryptPartialData(ciphertext2)
|
||||||
|
val plaintext3 = decryptor.decryptPartialData(ciphertext3)
|
||||||
|
|
||||||
|
val combinedPlaintext = plaintext1.data + plaintext2.data + plaintext3.data
|
||||||
|
assertTrue {
|
||||||
|
plaintext.contentEquals(combinedPlaintext)
|
||||||
|
}
|
||||||
|
encryptor.cleanup()
|
||||||
|
decryptor.cleanup()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -16,11 +16,22 @@
|
|||||||
|
|
||||||
package com.ionspin.kotlin.crypto.util
|
package com.ionspin.kotlin.crypto.util
|
||||||
|
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlin.coroutines.Continuation
|
||||||
|
import kotlin.coroutines.EmptyCoroutineContext
|
||||||
|
import kotlin.coroutines.startCoroutine
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Ugljesa Jovanovic
|
* Created by Ugljesa Jovanovic
|
||||||
* ugljesa.jovanovic@ionspin.com
|
* ugljesa.jovanovic@ionspin.com
|
||||||
* on 20-Jul-2019
|
* on 20-Jul-2019
|
||||||
*/
|
*/
|
||||||
expect fun testBlocking(block : suspend () -> Unit)
|
fun testBlocking(block : suspend () -> Unit) {
|
||||||
|
val continuation = Continuation<Unit>(EmptyCoroutineContext) {
|
||||||
|
//Do nothing
|
||||||
|
if (it.isFailure) {
|
||||||
|
throw it.exceptionOrNull()!!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
block.startCoroutine(continuation)
|
||||||
|
}
|
||||||
|
@ -39,5 +39,22 @@ interface JsSodiumInterface {
|
|||||||
|
|
||||||
fun crypto_hash_sha512_final(state: dynamic): Uint8Array
|
fun crypto_hash_sha512_final(state: dynamic): Uint8Array
|
||||||
|
|
||||||
|
//XChaCha20Poly1305
|
||||||
|
fun crypto_aead_xchacha20poly1305_ietf_encrypt(message: Uint8Array, additionalData: Uint8Array, secretNonce: Uint8Array, nonce: Uint8Array, key: Uint8Array) : Uint8Array
|
||||||
|
fun crypto_aead_xchacha20poly1305_ietf_decrypt(secretNonce: Uint8Array, ciphertext: Uint8Array, additionalData: Uint8Array, nonce: Uint8Array, key: Uint8Array) : Uint8Array
|
||||||
|
|
||||||
|
//XChaCha20Poly1305
|
||||||
|
//encrypt
|
||||||
|
fun crypto_secretstream_xchacha20poly1305_init_push(header: Uint8Array) : dynamic
|
||||||
|
fun crypto_secretstream_xchacha20poly1305_push(state: dynamic, message: Uint8Array, additionalData: Uint8Array, tag: UByte) : Uint8Array
|
||||||
|
|
||||||
|
//decrypt
|
||||||
|
fun crypto_secretstream_xchacha20poly1305_init_pull(header: Uint8Array, key: Uint8Array) : dynamic
|
||||||
|
fun crypto_secretstream_xchacha20poly1305_pull(state: dynamic, ciphertext: Uint8Array, additionalData: Uint8Array) : dynamic
|
||||||
|
|
||||||
|
//util
|
||||||
|
fun memzero(array: Uint8Array)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
package ext.libsodium.com.ionspin.kotlin.crypto
|
||||||
|
|
||||||
|
import org.khronos.webgl.Uint8Array
|
||||||
|
import org.khronos.webgl.get
|
||||||
|
import org.khronos.webgl.set
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 25-Jun-2020
|
||||||
|
*
|
||||||
|
* TODO investigate using unsafe cast
|
||||||
|
*/
|
||||||
|
fun UByteArray.toUInt8Array() : Uint8Array {
|
||||||
|
val uint8Result = Uint8Array(toByteArray().toTypedArray())
|
||||||
|
return uint8Result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun Uint8Array.toUByteArray() : UByteArray {
|
||||||
|
val result = UByteArray(length)
|
||||||
|
for (i in 0 until length) {
|
||||||
|
result[i] = get(i).toUByte()
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
@ -0,0 +1,130 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.authenticated
|
||||||
|
|
||||||
|
import com.ionspin.kotlin.crypto.InvalidTagException
|
||||||
|
import com.ionspin.kotlin.crypto.getSodium
|
||||||
|
import com.ionspin.kotlin.crypto.util.hexColumsPrint
|
||||||
|
import ext.libsodium.com.ionspin.kotlin.crypto.toUByteArray
|
||||||
|
import ext.libsodium.com.ionspin.kotlin.crypto.toUInt8Array
|
||||||
|
import org.khronos.webgl.Uint8Array
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 25-Jun-2020
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 14-Jun-2020
|
||||||
|
*/
|
||||||
|
actual class XChaCha20Poly1305Delegated internal actual constructor() {
|
||||||
|
actual companion object {
|
||||||
|
actual fun encrypt(
|
||||||
|
key: UByteArray,
|
||||||
|
nonce: UByteArray,
|
||||||
|
message: UByteArray,
|
||||||
|
additionalData: UByteArray
|
||||||
|
): UByteArray {
|
||||||
|
val encrypted = getSodium().crypto_aead_xchacha20poly1305_ietf_encrypt(
|
||||||
|
message.toUInt8Array(),
|
||||||
|
additionalData.toUInt8Array(),
|
||||||
|
Uint8Array(0),
|
||||||
|
nonce.toUInt8Array(),
|
||||||
|
key.toUInt8Array()
|
||||||
|
)
|
||||||
|
return encrypted.toUByteArray()
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun decrypt(
|
||||||
|
key: UByteArray,
|
||||||
|
nonce: UByteArray,
|
||||||
|
ciphertext: UByteArray,
|
||||||
|
additionalData: UByteArray
|
||||||
|
): UByteArray {
|
||||||
|
val decrypted = getSodium().crypto_aead_xchacha20poly1305_ietf_decrypt(
|
||||||
|
Uint8Array(0),
|
||||||
|
ciphertext.toUInt8Array(),
|
||||||
|
additionalData.toUInt8Array(),
|
||||||
|
nonce.toUInt8Array(),
|
||||||
|
key.toUInt8Array()
|
||||||
|
)
|
||||||
|
return decrypted.toUByteArray()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var state : dynamic = null
|
||||||
|
var isInitialized = false
|
||||||
|
var isEncryptor = false
|
||||||
|
|
||||||
|
actual fun initializeForEncryption(key: UByteArray) : UByteArray {
|
||||||
|
println("Initializaing for encryption")
|
||||||
|
val stateAndHeader = getSodium().crypto_secretstream_xchacha20poly1305_init_push(key.toUInt8Array())
|
||||||
|
state = stateAndHeader.state
|
||||||
|
val header = stateAndHeader.header as Uint8Array
|
||||||
|
console.log(state)
|
||||||
|
console.log(header)
|
||||||
|
println("Done initializaing for encryption")
|
||||||
|
isInitialized = true
|
||||||
|
isEncryptor = true
|
||||||
|
return header.toUByteArray()
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun initializeForDecryption(key: UByteArray, header: UByteArray) {
|
||||||
|
println("Initializing for decryption")
|
||||||
|
header.hexColumsPrint()
|
||||||
|
state = getSodium().crypto_secretstream_xchacha20poly1305_init_pull(header.toUInt8Array(), key.toUInt8Array())
|
||||||
|
console.log(state)
|
||||||
|
isInitialized = true
|
||||||
|
isEncryptor = false
|
||||||
|
}
|
||||||
|
|
||||||
|
internal actual constructor(
|
||||||
|
key: UByteArray,
|
||||||
|
testState: UByteArray,
|
||||||
|
testHeader: UByteArray,
|
||||||
|
isDecryptor: Boolean
|
||||||
|
) : this() {
|
||||||
|
state = getSodium().crypto_secretstream_xchacha20poly1305_init_pull(testHeader.toUInt8Array(), key.toUInt8Array())
|
||||||
|
console.log(state)
|
||||||
|
println("Done initializaing test state")
|
||||||
|
isInitialized = true
|
||||||
|
isEncryptor = !isDecryptor
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun encrypt(data: UByteArray, additionalData: UByteArray): UByteArray {
|
||||||
|
if (!isInitialized) {
|
||||||
|
throw RuntimeException("Not initalized!")
|
||||||
|
}
|
||||||
|
if (!isEncryptor) {
|
||||||
|
throw RuntimeException("Initialized as decryptor, attempted to use as encryptor")
|
||||||
|
}
|
||||||
|
val encrypted = getSodium().crypto_secretstream_xchacha20poly1305_push(state, data.toUInt8Array(), additionalData.toUInt8Array(), 0U)
|
||||||
|
return encrypted.toUByteArray()
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun decrypt(data: UByteArray, additionalData: UByteArray): UByteArray {
|
||||||
|
if (!isInitialized) {
|
||||||
|
throw RuntimeException("Not initalized!")
|
||||||
|
}
|
||||||
|
if (isEncryptor) {
|
||||||
|
throw RuntimeException("Initialized as encryptor, attempted to use as decryptor")
|
||||||
|
}
|
||||||
|
val decryptedWithTag = getSodium().crypto_secretstream_xchacha20poly1305_pull(state, data.toUInt8Array(), additionalData.toUInt8Array())
|
||||||
|
val decrypted = decryptedWithTag.message as Uint8Array
|
||||||
|
val validTag = decryptedWithTag.tag
|
||||||
|
|
||||||
|
if (validTag != 0U) {
|
||||||
|
println("Tag validation failed")
|
||||||
|
throw InvalidTagException()
|
||||||
|
}
|
||||||
|
return decrypted.toUByteArray()
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun cleanup() {
|
||||||
|
//TODO JS cleanup
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,8 +1,6 @@
|
|||||||
package com.ionspin.kotlin.crypto.hash.blake2b
|
package com.ionspin.kotlin.crypto.hash.blake2b
|
||||||
|
|
||||||
import com.ionspin.kotlin.crypto.getSodium
|
import com.ionspin.kotlin.crypto.getSodium
|
||||||
import com.ionspin.kotlin.crypto.hash.sha.Sha256StatelessDelegated
|
|
||||||
import com.ionspin.kotlin.crypto.util.toHexString
|
|
||||||
import org.khronos.webgl.Uint8Array
|
import org.khronos.webgl.Uint8Array
|
||||||
import org.khronos.webgl.get
|
import org.khronos.webgl.get
|
||||||
|
|
||||||
@ -13,7 +11,7 @@ import org.khronos.webgl.get
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
actual class Blake2bDelegated actual constructor(key: UByteArray?, val hashLength: Int) : Blake2b {
|
actual class Blake2bDelegated actual constructor(key: UByteArray?, val hashLength: Int) : Blake2bMultipart {
|
||||||
override val MAX_HASH_BYTES: Int = 64
|
override val MAX_HASH_BYTES: Int = 64
|
||||||
|
|
||||||
|
|
||||||
@ -43,7 +41,7 @@ actual class Blake2bDelegated actual constructor(key: UByteArray?, val hashLengt
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
actual object Blake2bDelegatedStateless : Blake2bStateless {
|
actual object Blake2bDelegatedStateless : Blake2b {
|
||||||
override val MAX_HASH_BYTES: Int = 64
|
override val MAX_HASH_BYTES: Int = 64
|
||||||
|
|
||||||
override fun digest(inputMessage: UByteArray, key: UByteArray, hashLength: Int): UByteArray {
|
override fun digest(inputMessage: UByteArray, key: UByteArray, hashLength: Int): UByteArray {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.ionspin.kotlin.crypto.hash.sha
|
package com.ionspin.kotlin.crypto.hash.sha
|
||||||
|
|
||||||
import com.ionspin.kotlin.crypto.getSodium
|
|
||||||
import com.ionspin.kotlin.crypto.getSodium
|
import com.ionspin.kotlin.crypto.getSodium
|
||||||
|
|
||||||
import org.khronos.webgl.Uint8Array
|
import org.khronos.webgl.Uint8Array
|
||||||
@ -13,7 +12,7 @@ import org.khronos.webgl.get
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
actual class Sha512Delegated : Sha512 {
|
actual class Sha512Delegated : Sha512Multipart {
|
||||||
val state : dynamic
|
val state : dynamic
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@ -35,7 +34,7 @@ actual class Sha512Delegated : Sha512 {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
actual object Sha512StatelessDelegated : StatelessSha512 {
|
actual object Sha512StatelessDelegated : Sha512 {
|
||||||
|
|
||||||
override fun digest(inputMessage: UByteArray): UByteArray {
|
override fun digest(inputMessage: UByteArray): UByteArray {
|
||||||
val hashed = getSodium().crypto_hash_sha512(Uint8Array(inputMessage.toByteArray().toTypedArray()))
|
val hashed = getSodium().crypto_hash_sha512(Uint8Array(inputMessage.toByteArray().toTypedArray()))
|
||||||
|
@ -15,14 +15,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
package com.ionspin.kotlin.crypto.util
|
package com.ionspin.kotlin.crypto.util
|
||||||
|
//
|
||||||
import kotlinx.coroutines.GlobalScope
|
//import kotlinx.coroutines.GlobalScope
|
||||||
import kotlinx.coroutines.promise
|
//import kotlinx.coroutines.promise
|
||||||
|
//
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* Created by Ugljesa Jovanovic
|
// * Created by Ugljesa Jovanovic
|
||||||
* ugljesa.jovanovic@ionspin.com
|
// * ugljesa.jovanovic@ionspin.com
|
||||||
* on 20-Jul-2019
|
// * on 20-Jul-2019
|
||||||
*/
|
// */
|
||||||
actual fun testBlocking(block: suspend ()-> Unit) : dynamic = GlobalScope.promise { block() }
|
//actual fun testBlocking(block: suspend ()-> Unit) : dynamic = GlobalScope.promise { block() }
|
||||||
|
@ -29,6 +29,6 @@ actual object SRNG {
|
|||||||
actual fun getRandomBytes(amount: Int): UByteArray {
|
actual fun getRandomBytes(amount: Int): UByteArray {
|
||||||
val byteArray = ByteArray(amount)
|
val byteArray = ByteArray(amount)
|
||||||
secureRandom.nextBytes(byteArray)
|
secureRandom.nextBytes(byteArray)
|
||||||
return byteArray.toUByteArray()
|
return byteArray.asUByteArray()
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,142 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.authenticated
|
||||||
|
|
||||||
|
import com.goterl.lazycode.lazysodium.SodiumJava
|
||||||
|
import com.goterl.lazycode.lazysodium.interfaces.SecretStream
|
||||||
|
import com.ionspin.kotlin.crypto.InvalidTagException
|
||||||
|
import com.ionspin.kotlin.crypto.util.hexColumsPrint
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 14-Jun-2020
|
||||||
|
*/
|
||||||
|
actual class XChaCha20Poly1305Delegated internal actual constructor() {
|
||||||
|
actual companion object {
|
||||||
|
actual fun encrypt(
|
||||||
|
key: UByteArray,
|
||||||
|
nonce: UByteArray,
|
||||||
|
message: UByteArray,
|
||||||
|
additionalData: UByteArray
|
||||||
|
): UByteArray {
|
||||||
|
val ciphertext = ByteArray(message.size + 16)
|
||||||
|
SodiumJava().crypto_aead_xchacha20poly1305_ietf_encrypt(
|
||||||
|
ciphertext,
|
||||||
|
longArrayOf(ciphertext.size.toLong()),
|
||||||
|
message.toByteArray(),
|
||||||
|
message.size.toLong(),
|
||||||
|
additionalData.toByteArray(),
|
||||||
|
additionalData.size.toLong(),
|
||||||
|
null,
|
||||||
|
nonce.toByteArray(),
|
||||||
|
key.toByteArray()
|
||||||
|
|
||||||
|
)
|
||||||
|
return ciphertext.asUByteArray()
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun decrypt(
|
||||||
|
key: UByteArray,
|
||||||
|
nonce: UByteArray,
|
||||||
|
ciphertext: UByteArray,
|
||||||
|
additionalData: UByteArray
|
||||||
|
): UByteArray {
|
||||||
|
val message = ByteArray(ciphertext.size - 16)
|
||||||
|
SodiumJava().crypto_aead_xchacha20poly1305_ietf_decrypt(
|
||||||
|
message,
|
||||||
|
longArrayOf(ciphertext.size.toLong()),
|
||||||
|
null,
|
||||||
|
ciphertext.toByteArray(),
|
||||||
|
ciphertext.size.toLong(),
|
||||||
|
additionalData.toByteArray(),
|
||||||
|
additionalData.size.toLong(),
|
||||||
|
nonce.toByteArray(),
|
||||||
|
key.toByteArray()
|
||||||
|
|
||||||
|
)
|
||||||
|
return message.asUByteArray()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val state : SecretStream.State = SecretStream.State()
|
||||||
|
val sodium = SodiumJava()
|
||||||
|
|
||||||
|
var isInitialized = false
|
||||||
|
var isEncryptor = false
|
||||||
|
|
||||||
|
internal actual constructor(
|
||||||
|
key: UByteArray,
|
||||||
|
testState: UByteArray,
|
||||||
|
testHeader: UByteArray,
|
||||||
|
isDecryptor: Boolean
|
||||||
|
) : this() {
|
||||||
|
state.k = testState.sliceArray(0 until 32).toByteArray()
|
||||||
|
state.nonce = testState.sliceArray(32 until 44).toByteArray()
|
||||||
|
isInitialized = true
|
||||||
|
isEncryptor = !isDecryptor
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun initializeForEncryption(key: UByteArray) : UByteArray {
|
||||||
|
val header = UByteArray(24)
|
||||||
|
sodium.crypto_secretstream_xchacha20poly1305_init_push(state, header.asByteArray(), key.asByteArray())
|
||||||
|
isInitialized = true
|
||||||
|
isEncryptor = true
|
||||||
|
return header
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun initializeForDecryption(key: UByteArray, header: UByteArray) {
|
||||||
|
sodium.crypto_secretstream_xchacha20poly1305_init_pull(state, header.asByteArray(), key.asByteArray())
|
||||||
|
isInitialized = true
|
||||||
|
isEncryptor = false
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun encrypt(data: UByteArray, additionalData: UByteArray): UByteArray {
|
||||||
|
if (!isInitialized) {
|
||||||
|
throw RuntimeException("Not initalized!")
|
||||||
|
}
|
||||||
|
if (!isEncryptor) {
|
||||||
|
throw RuntimeException("Initialized as decryptor, attempted to use as encryptor")
|
||||||
|
}
|
||||||
|
val ciphertext = ByteArray(1 + data.size + 16)
|
||||||
|
sodium.crypto_secretstream_xchacha20poly1305_push(
|
||||||
|
state, ciphertext, null,
|
||||||
|
data.asByteArray(), data.size.toLong(),
|
||||||
|
additionalData.asByteArray(), additionalData.size.toLong(),
|
||||||
|
0
|
||||||
|
)
|
||||||
|
return ciphertext.asUByteArray()
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun decrypt(data: UByteArray, additionalData: UByteArray): UByteArray {
|
||||||
|
if (!isInitialized) {
|
||||||
|
throw RuntimeException("Not initalized!")
|
||||||
|
}
|
||||||
|
if (isEncryptor) {
|
||||||
|
throw RuntimeException("Initialized as encryptor, attempted to use as decryptor")
|
||||||
|
}
|
||||||
|
val plaintext = ByteArray(data.size - 17)
|
||||||
|
|
||||||
|
val validTag = sodium.crypto_secretstream_xchacha20poly1305_pull(
|
||||||
|
state, plaintext, null,
|
||||||
|
null,
|
||||||
|
data.asByteArray(),
|
||||||
|
(data.size).toLong(),
|
||||||
|
additionalData.asByteArray(),
|
||||||
|
additionalData.size.toLong()
|
||||||
|
)
|
||||||
|
if (validTag != 0) {
|
||||||
|
println("Tag validation failed")
|
||||||
|
throw InvalidTagException()
|
||||||
|
}
|
||||||
|
return plaintext.asUByteArray()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun cleanup() {
|
||||||
|
sodium.sodium_memzero(state.k, 32)
|
||||||
|
sodium.sodium_memzero(state.nonce, 12)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -8,7 +8,7 @@ import com.ionspin.kotlin.crypto.Initializer.sodium
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
actual class Blake2bDelegated actual constructor(key: UByteArray?, val hashLength: Int) : Blake2b {
|
actual class Blake2bDelegated actual constructor(key: UByteArray?, val hashLength: Int) : Blake2bMultipart {
|
||||||
|
|
||||||
val state = ByteArray(sodium.crypto_generichash_statebytes())
|
val state = ByteArray(sodium.crypto_generichash_statebytes())
|
||||||
|
|
||||||
@ -23,18 +23,18 @@ actual class Blake2bDelegated actual constructor(key: UByteArray?, val hashLengt
|
|||||||
override fun digest(): UByteArray {
|
override fun digest(): UByteArray {
|
||||||
val hashed = ByteArray(hashLength)
|
val hashed = ByteArray(hashLength)
|
||||||
sodium.crypto_generichash_final(state, hashed, hashLength)
|
sodium.crypto_generichash_final(state, hashed, hashLength)
|
||||||
return hashed.toUByteArray()
|
return hashed.asUByteArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
actual object Blake2bDelegatedStateless : Blake2bStateless {
|
actual object Blake2bDelegatedStateless : Blake2b {
|
||||||
|
|
||||||
|
|
||||||
override fun digest(inputMessage: UByteArray, key: UByteArray, hashLength: Int): UByteArray {
|
override fun digest(inputMessage: UByteArray, key: UByteArray, hashLength: Int): UByteArray {
|
||||||
val hashed = ByteArray(hashLength)
|
val hashed = ByteArray(hashLength)
|
||||||
sodium.crypto_generichash(hashed, hashed.size, inputMessage.toByteArray(), inputMessage.size.toLong(), key.toByteArray(), key.size)
|
sodium.crypto_generichash(hashed, hashed.size, inputMessage.toByteArray(), inputMessage.size.toLong(), key.toByteArray(), key.size)
|
||||||
return hashed.toUByteArray()
|
return hashed.asUByteArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -26,7 +26,7 @@ actual class Sha256Delegated actual constructor() : Sha256 {
|
|||||||
override fun digest(): UByteArray {
|
override fun digest(): UByteArray {
|
||||||
val hashed = ByteArray(Sha256Properties.MAX_HASH_BYTES)
|
val hashed = ByteArray(Sha256Properties.MAX_HASH_BYTES)
|
||||||
sodium.crypto_hash_sha256_final(state, hashed)
|
sodium.crypto_hash_sha256_final(state, hashed)
|
||||||
return hashed.toUByteArray()
|
return hashed.asUByteArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -36,6 +36,6 @@ actual object Sha256StatelessDelegated : StatelessSha256 {
|
|||||||
override fun digest(inputMessage: UByteArray): UByteArray {
|
override fun digest(inputMessage: UByteArray): UByteArray {
|
||||||
val hashed = ByteArray(Sha256Properties.MAX_HASH_BYTES)
|
val hashed = ByteArray(Sha256Properties.MAX_HASH_BYTES)
|
||||||
sodium.crypto_hash_sha256(hashed, inputMessage.toByteArray(), inputMessage.size.toLong())
|
sodium.crypto_hash_sha256(hashed, inputMessage.toByteArray(), inputMessage.size.toLong())
|
||||||
return hashed.toUByteArray()
|
return hashed.asUByteArray()
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,7 +10,7 @@ import com.ionspin.kotlin.crypto.Initializer
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
actual class Sha512Delegated : Sha512 {
|
actual class Sha512Delegated : Sha512Multipart {
|
||||||
|
|
||||||
val state = Hash.State512()
|
val state = Hash.State512()
|
||||||
|
|
||||||
@ -25,16 +25,16 @@ actual class Sha512Delegated : Sha512 {
|
|||||||
override fun digest(): UByteArray {
|
override fun digest(): UByteArray {
|
||||||
val hashed = ByteArray(Sha512Properties.MAX_HASH_BYTES)
|
val hashed = ByteArray(Sha512Properties.MAX_HASH_BYTES)
|
||||||
Initializer.sodium.crypto_hash_sha512_final(state, hashed)
|
Initializer.sodium.crypto_hash_sha512_final(state, hashed)
|
||||||
return hashed.toUByteArray()
|
return hashed.asUByteArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
actual object Sha512StatelessDelegated : StatelessSha512 {
|
actual object Sha512StatelessDelegated : Sha512 {
|
||||||
|
|
||||||
override fun digest(inputMessage: UByteArray): UByteArray {
|
override fun digest(inputMessage: UByteArray): UByteArray {
|
||||||
val hashed = ByteArray(Sha512Properties.MAX_HASH_BYTES)
|
val hashed = ByteArray(Sha512Properties.MAX_HASH_BYTES)
|
||||||
Initializer.sodium.crypto_hash_sha512(hashed, inputMessage.toByteArray(), inputMessage.size.toLong())
|
Initializer.sodium.crypto_hash_sha512(hashed, inputMessage.toByteArray(), inputMessage.size.toLong())
|
||||||
return hashed.toUByteArray()
|
return hashed.asUByteArray()
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,12 +16,19 @@
|
|||||||
|
|
||||||
package com.ionspin.kotlin.crypto.util
|
package com.ionspin.kotlin.crypto.util
|
||||||
|
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlin.coroutines.Continuation
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlin.coroutines.EmptyCoroutineContext
|
||||||
|
import kotlin.coroutines.startCoroutine
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Ugljesa Jovanovic
|
* Created by Ugljesa Jovanovic
|
||||||
* ugljesa.jovanovic@ionspin.com
|
* ugljesa.jovanovic@ionspin.com
|
||||||
* on 20-Jul-2019
|
* on 20-Jul-2019
|
||||||
*/
|
*/
|
||||||
actual fun testBlocking(block: suspend () -> Unit) = runBlocking { block() }
|
//actual fun testBlocking(block: suspend () -> Unit) {
|
||||||
|
// val continuation = Continuation<Unit>(EmptyCoroutineContext) {
|
||||||
|
// println("Done")
|
||||||
|
// }
|
||||||
|
// block.startCoroutine(continuation)
|
||||||
|
//
|
||||||
|
//}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
|
@file:Suppress("VARIABLE_IN_SINGLETON_WITHOUT_THREAD_LOCAL")
|
||||||
|
|
||||||
package com.ionspin.kotlin.crypto
|
package com.ionspin.kotlin.crypto
|
||||||
|
|
||||||
import kotlinx.atomicfu.AtomicBoolean
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.GlobalScope
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import libsodium.sodium_init
|
import libsodium.sodium_init
|
||||||
import kotlin.native.concurrent.AtomicInt
|
import kotlin.native.concurrent.AtomicInt
|
||||||
|
|
||||||
|
@ -0,0 +1,163 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.authenticated
|
||||||
|
|
||||||
|
import com.ionspin.kotlin.bignum.integer.util.hexColumsPrint
|
||||||
|
import com.ionspin.kotlin.crypto.InvalidTagException
|
||||||
|
import kotlinx.cinterop.*
|
||||||
|
import libsodium.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 14-Jun-2020
|
||||||
|
*/
|
||||||
|
actual class XChaCha20Poly1305Delegated internal actual constructor() {
|
||||||
|
actual companion object {
|
||||||
|
actual fun encrypt(
|
||||||
|
key: UByteArray,
|
||||||
|
nonce: UByteArray,
|
||||||
|
message: UByteArray,
|
||||||
|
additionalData: UByteArray
|
||||||
|
): UByteArray {
|
||||||
|
val ciphertextLength = message.size + crypto_aead_xchacha20poly1305_IETF_ABYTES.toInt()
|
||||||
|
val ciphertext = UByteArray(ciphertextLength)
|
||||||
|
val ciphertextPinned = ciphertext.pin()
|
||||||
|
crypto_aead_xchacha20poly1305_ietf_encrypt(
|
||||||
|
ciphertextPinned.addressOf(0),
|
||||||
|
ulongArrayOf(ciphertextLength.convert()).toCValues(),
|
||||||
|
message.toCValues(),
|
||||||
|
message.size.convert(),
|
||||||
|
additionalData.toCValues(),
|
||||||
|
additionalData.size.convert(),
|
||||||
|
null,
|
||||||
|
nonce.toCValues(),
|
||||||
|
key.toCValues()
|
||||||
|
)
|
||||||
|
ciphertextPinned.unpin()
|
||||||
|
return ciphertext
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun decrypt(
|
||||||
|
key: UByteArray,
|
||||||
|
nonce: UByteArray,
|
||||||
|
ciphertext: UByteArray,
|
||||||
|
additionalData: UByteArray
|
||||||
|
): UByteArray {
|
||||||
|
val messageLength = ciphertext.size - crypto_aead_xchacha20poly1305_IETF_ABYTES.toInt()
|
||||||
|
val message = UByteArray(messageLength)
|
||||||
|
val messagePinned = message.pin()
|
||||||
|
crypto_aead_xchacha20poly1305_ietf_decrypt(
|
||||||
|
messagePinned.addressOf(0),
|
||||||
|
ulongArrayOf(messageLength.convert()).toCValues(),
|
||||||
|
null,
|
||||||
|
ciphertext.toCValues(),
|
||||||
|
ciphertext.size.convert(),
|
||||||
|
additionalData.toCValues(),
|
||||||
|
additionalData.size.convert(),
|
||||||
|
nonce.toCValues(),
|
||||||
|
key.toCValues()
|
||||||
|
)
|
||||||
|
messagePinned.unpin()
|
||||||
|
return message
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var state =
|
||||||
|
sodium_malloc(crypto_secretstream_xchacha20poly1305_state.size.convert())!!
|
||||||
|
.reinterpret<crypto_secretstream_xchacha20poly1305_state>()
|
||||||
|
.pointed
|
||||||
|
val header = UByteArray(crypto_secretstream_xchacha20poly1305_HEADERBYTES.toInt()) { 0U }
|
||||||
|
|
||||||
|
var isInitialized = false
|
||||||
|
var isEncryptor = false
|
||||||
|
|
||||||
|
actual internal constructor(
|
||||||
|
key: UByteArray,
|
||||||
|
testState: UByteArray,
|
||||||
|
testHeader: UByteArray,
|
||||||
|
isDecryptor: Boolean
|
||||||
|
) : this() {
|
||||||
|
val pointer = state.ptr.reinterpret<UByteVar>()
|
||||||
|
for (i in 0 until crypto_secretstream_xchacha20poly1305_state.size.toInt()) {
|
||||||
|
pointer[i] = testState[i]
|
||||||
|
}
|
||||||
|
println("state after setting-----------")
|
||||||
|
state.ptr.readBytes(crypto_secretstream_xchacha20poly1305_state.size.toInt()).asUByteArray().hexColumsPrint()
|
||||||
|
println("state after setting-----------")
|
||||||
|
println("header after setting-----------")
|
||||||
|
testHeader.copyInto(header)
|
||||||
|
header.hexColumsPrint()
|
||||||
|
println("header after setting-----------")
|
||||||
|
isInitialized = true
|
||||||
|
isEncryptor = !isDecryptor
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
actual fun initializeForEncryption(key: UByteArray) : UByteArray {
|
||||||
|
val pinnedHeader = header.pin()
|
||||||
|
crypto_secretstream_xchacha20poly1305_init_push(state.ptr, pinnedHeader.addressOf(0), key.toCValues())
|
||||||
|
println("state-----------")
|
||||||
|
state.ptr.readBytes(crypto_secretstream_xchacha20poly1305_state.size.toInt()).asUByteArray().hexColumsPrint()
|
||||||
|
println("state-----------")
|
||||||
|
println("--------header-----------")
|
||||||
|
header.hexColumsPrint()
|
||||||
|
println("--------header-----------")
|
||||||
|
pinnedHeader.unpin()
|
||||||
|
return header
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun initializeForDecryption(key: UByteArray, header: UByteArray) {
|
||||||
|
crypto_secretstream_xchacha20poly1305_init_pull(state.ptr, header.toCValues(), key.toCValues())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
actual fun encrypt(data: UByteArray, additionalData: UByteArray): UByteArray {
|
||||||
|
val ciphertextWithTag = UByteArray(data.size + crypto_secretstream_xchacha20poly1305_ABYTES.toInt())
|
||||||
|
val ciphertextWithTagPinned = ciphertextWithTag.pin()
|
||||||
|
crypto_secretstream_xchacha20poly1305_push(
|
||||||
|
state.ptr,
|
||||||
|
ciphertextWithTagPinned.addressOf(0),
|
||||||
|
null,
|
||||||
|
data.toCValues(),
|
||||||
|
data.size.convert(),
|
||||||
|
additionalData.toCValues(),
|
||||||
|
additionalData.size.convert(),
|
||||||
|
0U,
|
||||||
|
)
|
||||||
|
println("Encrypt partial")
|
||||||
|
ciphertextWithTag.hexColumsPrint()
|
||||||
|
println("Encrypt partial end")
|
||||||
|
ciphertextWithTagPinned.unpin()
|
||||||
|
return ciphertextWithTag
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun decrypt(data: UByteArray, additionalData: UByteArray): UByteArray {
|
||||||
|
val plaintext = UByteArray(data.size - crypto_secretstream_xchacha20poly1305_ABYTES.toInt())
|
||||||
|
val plaintextPinned = plaintext.pin()
|
||||||
|
val validTag = crypto_secretstream_xchacha20poly1305_pull(
|
||||||
|
state.ptr,
|
||||||
|
plaintextPinned.addressOf(0),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
data.toCValues(),
|
||||||
|
data.size.convert(),
|
||||||
|
additionalData.toCValues(),
|
||||||
|
additionalData.size.convert()
|
||||||
|
)
|
||||||
|
plaintextPinned.unpin()
|
||||||
|
println("tag: $validTag")
|
||||||
|
if (validTag != 0) {
|
||||||
|
println("Tag validation failed")
|
||||||
|
throw InvalidTagException()
|
||||||
|
}
|
||||||
|
return plaintext
|
||||||
|
}
|
||||||
|
|
||||||
|
actual fun cleanup() {
|
||||||
|
sodium_free(state.ptr)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -11,7 +11,7 @@ import platform.posix.malloc
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
actual class Blake2bDelegated actual constructor(key: UByteArray?, hashLength: Int) : Blake2b {
|
actual class Blake2bDelegated actual constructor(key: UByteArray?, hashLength: Int) : Blake2bMultipart {
|
||||||
override val MAX_HASH_BYTES: Int = 64
|
override val MAX_HASH_BYTES: Int = 64
|
||||||
|
|
||||||
val requestedHashLength : Int
|
val requestedHashLength : Int
|
||||||
@ -20,7 +20,7 @@ actual class Blake2bDelegated actual constructor(key: UByteArray?, hashLength: I
|
|||||||
requestedHashLength = hashLength
|
requestedHashLength = hashLength
|
||||||
val allocated = malloc(crypto_generichash_state.size.convert())!!
|
val allocated = malloc(crypto_generichash_state.size.convert())!!
|
||||||
state = allocated.reinterpret<crypto_generichash_state>().pointed
|
state = allocated.reinterpret<crypto_generichash_state>().pointed
|
||||||
crypto_generichash_init(state.ptr, key?.run { this.toUByteArray().toCValues() }, key?.size?.convert() ?: 0UL.convert(), hashLength.convert())
|
crypto_generichash_init(state.ptr, key?.run { this.toCValues() }, key?.size?.convert() ?: 0UL.convert(), hashLength.convert())
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun update(data: UByteArray) {
|
override fun update(data: UByteArray) {
|
||||||
@ -38,7 +38,7 @@ actual class Blake2bDelegated actual constructor(key: UByteArray?, hashLength: I
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("EXPERIMENTAL_API_USAGE", "EXPERIMENTAL_UNSIGNED_LITERALS")
|
@Suppress("EXPERIMENTAL_API_USAGE", "EXPERIMENTAL_UNSIGNED_LITERALS")
|
||||||
actual object Blake2bDelegatedStateless : Blake2bStateless {
|
actual object Blake2bDelegatedStateless : Blake2b {
|
||||||
|
|
||||||
override fun digest(inputMessage: UByteArray, key: UByteArray, hashLength: Int): UByteArray {
|
override fun digest(inputMessage: UByteArray, key: UByteArray, hashLength: Int): UByteArray {
|
||||||
val hashResult = UByteArray(MAX_HASH_BYTES)
|
val hashResult = UByteArray(MAX_HASH_BYTES)
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user