Skip to content

Commit 49d55ce

Browse files
authored
Add XofAlgorithm interface (#29)
1 parent 1ac1dca commit 49d55ce

File tree

4 files changed

+30
-5
lines changed

4 files changed

+30
-5
lines changed

library/xof/api/xof.api

+6-3
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,20 @@ public abstract class org/kotlincrypto/core/Xof$Reader {
2222
public final fun use (Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
2323
}
2424

25+
public abstract interface class org/kotlincrypto/core/XofAlgorithm : org/kotlincrypto/core/Algorithm {
26+
}
27+
2528
public abstract class org/kotlincrypto/core/XofFactory {
2629
}
2730

2831
protected abstract class org/kotlincrypto/core/XofFactory$XofDelegate : org/kotlincrypto/core/Xof, org/kotlincrypto/core/Algorithm, org/kotlincrypto/core/Resettable, org/kotlincrypto/core/Updatable {
29-
protected fun <init> (Lorg/kotlincrypto/core/XofFactory;Lorg/kotlincrypto/core/Algorithm;)V
32+
protected fun <init> (Lorg/kotlincrypto/core/XofFactory;Lorg/kotlincrypto/core/XofAlgorithm;)V
3033
public fun algorithm ()Ljava/lang/String;
3134
public final fun equals (Ljava/lang/Object;)Z
32-
protected final fun getDelegate ()Lorg/kotlincrypto/core/Algorithm;
35+
protected final fun getDelegate ()Lorg/kotlincrypto/core/XofAlgorithm;
3336
public final fun hashCode ()I
3437
protected final fun newReader ()Lorg/kotlincrypto/core/Xof$Reader;
35-
protected abstract fun newReader (Lorg/kotlincrypto/core/Algorithm;)Lorg/kotlincrypto/core/Xof$Reader;
38+
protected abstract fun newReader (Lorg/kotlincrypto/core/XofAlgorithm;)Lorg/kotlincrypto/core/Xof$Reader;
3639
public fun reset ()V
3740
public fun update (B)V
3841
public fun update ([B)V

library/xof/src/commonMain/kotlin/org/kotlincrypto/core/Xof.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import kotlin.jvm.JvmStatic
5050
* @see [reader]
5151
* @see [Reader]
5252
* */
53-
public sealed class Xof<A: Algorithm>: Algorithm, Copyable<Xof<A>>, Resettable, Updatable {
53+
public sealed class Xof<A: XofAlgorithm>: Algorithm, Copyable<Xof<A>>, Resettable, Updatable {
5454

5555
/**
5656
* Takes a snapshot of the current [Xof]'s state and produces
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (c) 2023 Matthew Nelson
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
**/
16+
package org.kotlincrypto.core
17+
18+
/**
19+
* Denotes a class as a user of a specified cryptographic [algorithm]
20+
* which supports Extendable-Output Functions (XOFs).
21+
* */
22+
public interface XofAlgorithm: Algorithm

library/xof/src/commonMain/kotlin/org/kotlincrypto/core/XofFactory.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ package org.kotlincrypto.core
3838
*
3939
* @see [XofDelegate]
4040
* */
41-
public abstract class XofFactory<A: Algorithm>
41+
public abstract class XofFactory<A: XofAlgorithm>
4242
@InternalKotlinCryptoApi
4343
public constructor()
4444
{

0 commit comments

Comments
 (0)