A pure Kotlin/Multiplatform implementation of group operations on Curve25519.

Overview

curve25519-kotlin

Maven Central License Kotlin

A pure Kotlin/Multiplatform implementation of group operations on Curve25519.

Gradle Kotlin DSL:

dependencies {
    implementation("io.github.andreypfau:curve25519-kotlin:0.0.6")
}

Apache Maven:

<dependency>
    <groupId>io.github.andreypfau</groupId>
    <artifactId>curve25519-kotlin-jvm</artifactId>
    <version>0.0.6</version>
</dependency>

Examples:

Generate key-pair from random

val privateKey: Ed25519PrivateKey = Ed25519.generateKey(Random)
val publicKey: Ed25519PublicKey = privateKey.publicKey()

Generate key-pair from seed bytes

val seedBytes: ByteArray = ByteArray(32)
val privateKey: Ed25519PrivateKey = Ed25519.keyFromSeed(seedBytes)
val publicKey: Ed25519PublicKey = privateKey.publicKey() 

Signing messages & verify signatures

val message: ByteArray = "test message".encodeToByteArray()
val signature: ByteArray = privateKey.sign(message)

check(publicKey.verify(message, signature)) // Valid message returns true

val invalidMessage = "invalid message".encodeToByteArray()
check(!publicKey.verify(invalidMessage, signature)) // Invalid message returns false

Shared key calculation

val alicePrivate = Ed25519.generateKey(Random)
val alicePublic = alicePrivate.publicKey()

val bobPrivate = Ed25519.generateKey(Random)
val bobPublic = bobPrivate.publicKey()

val aliceShared = alicePrivate.sharedKey(bobPublic)
val bobShared = bobPrivate.sharedKey(alicePublic)

check(aliceShared.contentEquals(bobShared))
You might also like...
An app architecture for Kotlin/Native on Android/iOS. Use Kotlin Multiplatform Mobile.
An app architecture for Kotlin/Native on Android/iOS. Use Kotlin Multiplatform Mobile.

An app architecture for Kotlin/Native on Android/iOS. Use Kotlin Multiplatform Mobile. 项目架构主要分为原生系统层、Android/iOS业务SDK层、KMM SDK层、KMM业务逻辑SDK层、iOS sdkfra

📒 NotyKT is a complete 💎Kotlin-stack (Backend + Android) 📱 application built to demonstrate the use of Modern development tools with best practices implementation🦸.
📒 NotyKT is a complete 💎Kotlin-stack (Backend + Android) 📱 application built to demonstrate the use of Modern development tools with best practices implementation🦸.

NotyKT 🖊️ NotyKT is the complete Kotlin-stack note taking 🖊️ application 📱 built to demonstrate a use of Kotlin programming language in server-side

Netflix inspired OTT Home Screen, Contains implementation in Reactjs, Kotlin React Wrapper, Jetpack Compose Web

Netflix-Clone-React Practising React by building Netflix Clone Requirements TMDB api key : Add TMDB API key to AppApi.kt Learning Resourcce Build Netf

🏗️ Kotlin implementation of Point-Free's composable architecture

🧩 Komposable Architecture Kotlin implementation of Point-Free's The Composable Architecture 🚧 Project Status We've been using Komposable Architectur

Slime World Format implementation written in Kotlin with Zstd for bukkit.

Slime Korld Easily create many slime worlds with the Slime Korld. What is Slime Korld? Slime Korld is a bukkit library written in Kotlin to make minec

AndroidArchitecture - An Implementation of Google Recommended New Android Architecture with Kotlin
AndroidArchitecture - An Implementation of Google Recommended New Android Architecture with Kotlin

Android Architecture An Implementation of Google Recommended New Android Archite

Lambda-snake.kt - Snake Game Implementation for Web using Kotlin programming language compiled for Javascript
Lambda-snake.kt - Snake Game Implementation for Web using Kotlin programming language compiled for Javascript

Projeto da disciplina de Linguagem de Programação Funcional 2021.1 (jan/2022) 📄

A simple, classic Kotlin MVI implementation based on coroutines with Android support, clean DSL and easy to understand logic

A simple, classic Kotlin MVI implementation based on coroutines with Android support, clean DSL and easy to understand logic

A Bluetooth kotlin multiplatform "Cross-Platform" library for iOS and Android

Blue-Falcon A Bluetooth "Cross Platform" Kotlin Multiplatform library for iOS, Android, MacOS, Raspberry Pi and Javascript. Bluetooth in general has t

Releases(v0.0.6)
Owner
Andrey Pfau
Andrey Pfau
RoomJetpackCompose is an app written in Kotlin and shows a simple solution to perform CRUD operations in the Room database using Kotlin Flow in clean architecture.

RoomJetpackCompose is an app written in Kotlin and shows a simple solution to perform CRUD operations in the Room database using Kotlin Flow in clean architecture.

Alex 27 Jan 1, 2023
Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders

Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders.

Vehement 8 Nov 26, 2022
A pure-Kotlin library for bots to interface with Revolt

RevoltKt A pure-Kotlin library for bots to interface with Revolt Sample Usage import me.maya.revolt.defaultClientBuilder import me.maya.revolt.events.

Maya 8 May 20, 2022
Arc Layout is a view group with which you can add a arc-shaped container in your layout.

ArcLayout Arc Layout is a view group with which you can add a arc-shaped container in your layout. Two main variables are the direction and the curvat

Ali Rezaiyan 32 Aug 17, 2022
Template (pure) for KMM application with DI support

KMM di template Template (pure) for KMM application with DI support. Uses Multiplatform-DI for Dependency Injection Features Common architecture (VIP)

Anna Zharkova 8 Oct 18, 2022
Opinionated Redux-like implementation backed by Kotlin Coroutines and Kotlin Multiplatform Mobile

CoRed CoRed is Redux-like implementation that maintains the benefits of Redux's core idea without the boilerplate. No more action types, action creato

Kittinun Vantasin 28 Dec 10, 2022
Ethereum Web3 implementation for mobile (android & ios) Kotlin Multiplatform development

Mobile Kotlin web3 This is a Kotlin MultiPlatform library that ... Table of Contents Features Requirements Installation Usage Samples Set Up Locally C

IceRock Development 32 Aug 26, 2022
A kotlin multiplatform BLS12-381 implementation for chia key management

KBLS KBLS is a kotlin multiplatform BLS12-381 implementation built for creating cross platform chia applications. Tips are much appreciated and will d

ChiaChat 7 Nov 21, 2022
Real life Kotlin Multiplatform project with an iOS application developed in Swift with SwiftUI, an Android application developed in Kotlin with Jetpack Compose and a backed in Kotlin hosted on AppEngine.

Conferences4Hall Real life Kotlin Multiplatform project with an iOS application developed in Swift with SwiftUI, an Android application developed in K

Gérard Paligot 98 Dec 15, 2022
LifecycleMvp 1.2 0.0 Kotlin is MVP architecture implementation with Android Architecture Components and Kotlin language features

MinSDK 14+ Download Gradle Add to project level build.gradle allprojects { repositories { ... maven { url 'https://jitpack.io' }

Robert 20 Nov 9, 2021