WIP: Remove *_from_string functions as they're not yet part of a libsodium release

This commit is contained in:
Johannes Leupold committed 2024-08-14 12:11:20 +02:00
1 parent 9a4a776bbd
commit 6d5b2ba6e1
12 files changed
-277

No files matched your search

@@ -17,17 +17,10 @@ const val crypto_core_ed25519_NONREDUCEDSCALARBYTES = 64
const val crypto_scalarmult_ed25519_BYTES = 32U
const val crypto_scalarmult_ed25519_SCALARBYTES = 32U
enum class HashToCurveAlgorithm(val id: Int) {
SHA256(1),
SHA512(2),
}
expect abstract class Ed25519LowLevel() {
fun isValidPoint(encoded: UByteArray): Boolean
fun addPoints(p: UByteArray, q: UByteArray): UByteArray
fun subtractPoints(p: UByteArray, q: UByteArray): UByteArray
fun encodedPointFromString(ctx: String?, msg: UByteArray, hashAlg: HashToCurveAlgorithm): UByteArray
fun encodedPointFromStringRo(ctx: String?, msg: UByteArray, hashAlg: HashToCurveAlgorithm): UByteArray
fun encodedPointFromUniform(uniform: UByteArray): UByteArray
fun randomEncodedPoint(): UByteArray
fun randomEncodedScalar(): UByteArray
@@ -51,12 +44,6 @@ object Ed25519 : Ed25519LowLevel() {
fun subtract(p: Point, q: Point): Point =
Point(subtractPoints(p.encoded, q.encoded))
fun pointFromString(ctx: String?, msg: UByteArray, hashAlg: HashToCurveAlgorithm): Point =
Point(encodedPointFromString(ctx, msg, hashAlg))
fun pointFromStringRo(ctx: String?, msg: UByteArray, hashAlg: HashToCurveAlgorithm): Point =
Point(encodedPointFromStringRo(ctx, msg, hashAlg))
fun pointFromUniform(uniform: UByteArray): Point = Point(encodedPointFromUniform(uniform))
fun randomPoint(): Point = Point(randomEncodedPoint())
@@ -1,8 +1,6 @@
package com.ionspin.kotlin.crypto.ristretto255
import com.ionspin.kotlin.crypto.ed25519.HashToCurveAlgorithm
import com.ionspin.kotlin.crypto.util.LibsodiumUtil
import kotlin.UByteArray
/**
* Created by Johannes Leupold
@@ -23,8 +21,6 @@ expect abstract class Ristretto255LowLevel() {
fun addPoints(p: UByteArray, q: UByteArray): UByteArray
fun subtractPoints(p: UByteArray, q: UByteArray): UByteArray
fun encodedPointFromHash(hash: UByteArray): UByteArray
fun encodedPointFromString(ctx: String?, msg: UByteArray, hashAlg: HashToCurveAlgorithm): UByteArray
fun encodedPointFromStringRo(ctx: String?, msg: UByteArray, hashAlg: HashToCurveAlgorithm): UByteArray
fun randomEncodedPoint(): UByteArray
fun randomEncodedScalar(): UByteArray
fun invertScalar(scalar: UByteArray): UByteArray
@@ -47,12 +43,6 @@ object Ristretto255 : Ristretto255LowLevel() {
fun pointFromHash(hash: UByteArray): Point = Point(encodedPointFromHash(hash))
fun pointFromString(ctx: String?, msg: UByteArray, hashAlg: HashToCurveAlgorithm): Point =
Point(encodedPointFromString(ctx, msg, hashAlg))
fun pointFromStringRo(ctx: String?, msg: UByteArray, hashAlg: HashToCurveAlgorithm): Point =
Point(encodedPointFromStringRo(ctx, msg, hashAlg))
fun randomPoint(): Point = Point(randomEncodedPoint())
fun randomScalar(): Scalar = Scalar(randomEncodedScalar())