Skip to content

Commit f3cc60d

Browse files
authored
Add documentation to source files (#13)
1 parent 7ae707a commit f3cc60d

File tree

5 files changed

+31
-0
lines changed
  • library/hmac
    • hmac/src/commonMain/kotlin/org/kotlincrypto/macs
    • hmac-md5/src/commonMain/kotlin/org/kotlincrypto/macs
    • hmac-sha1/src/commonMain/kotlin/org/kotlincrypto/macs
    • hmac-sha2-256/src/commonMain/kotlin/org/kotlincrypto/macs
    • hmac-sha2-512/src/commonMain/kotlin/org/kotlincrypto/macs

5 files changed

+31
-0
lines changed

library/hmac/hmac-md5/src/commonMain/kotlin/org/kotlincrypto/macs/HmacMD5.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ import org.kotlincrypto.hash.Md5
2323

2424
public class HmacMD5: Hmac {
2525

26+
/**
27+
* Instantiates a new instance of [HmacMD5].
28+
*
29+
* @throws [IllegalArgumentException] if [key] is empty.
30+
* */
2631
@OptIn(InternalKotlinCryptoApi::class)
2732
@Throws(IllegalArgumentException::class)
2833
public constructor(key: ByteArray): super(key, "HmacMD5", Md5())

library/hmac/hmac-sha1/src/commonMain/kotlin/org/kotlincrypto/macs/HmacSHA1.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ import org.kotlincrypto.hash.Sha1
2323

2424
public class HmacSHA1: Hmac {
2525

26+
/**
27+
* Instantiates a new instance of [HmacSHA1].
28+
*
29+
* @throws [IllegalArgumentException] if [key] is empty.
30+
* */
2631
@OptIn(InternalKotlinCryptoApi::class)
2732
@Throws(IllegalArgumentException::class)
2833
public constructor(key: ByteArray): super(key, "HmacSHA1", Sha1())

library/hmac/hmac-sha2-256/src/commonMain/kotlin/org/kotlincrypto/macs/HmacSHA256.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ import org.kotlincrypto.hash.Sha256
2323

2424
public class HmacSHA256: Hmac {
2525

26+
/**
27+
* Instantiates a new instance of [HmacSHA256].
28+
*
29+
* @throws [IllegalArgumentException] if [key] is empty.
30+
* */
2631
@OptIn(InternalKotlinCryptoApi::class)
2732
@Throws(IllegalArgumentException::class)
2833
public constructor(key: ByteArray): super(key, "HmacSHA256", Sha256())

library/hmac/hmac-sha2-512/src/commonMain/kotlin/org/kotlincrypto/macs/HmacSHA512.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ import org.kotlincrypto.hash.Sha512
2323

2424
public class HmacSHA512: Hmac {
2525

26+
/**
27+
* Instantiates a new instance of [HmacSHA512].
28+
*
29+
* @throws [IllegalArgumentException] if [key] is empty.
30+
* */
2631
@OptIn(InternalKotlinCryptoApi::class)
2732
@Throws(IllegalArgumentException::class)
2833
public constructor(key: ByteArray): super(key, "HmacSHA512", Sha512())

library/hmac/hmac/src/commonMain/kotlin/org/kotlincrypto/macs/Hmac.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ import kotlin.jvm.JvmSynthetic
3232
* */
3333
public abstract class Hmac: Mac {
3434

35+
/**
36+
* Primary constructor for creating a new [Hmac] instance
37+
*
38+
* @throws [IllegalArgumentException] if [key] is empty.
39+
* */
3540
@InternalKotlinCryptoApi
3641
@Throws(IllegalArgumentException::class)
3742
protected constructor(
@@ -40,6 +45,12 @@ public abstract class Hmac: Mac {
4045
digest: Digest,
4146
): super(algorithm, Engine.instance(key, digest))
4247

48+
/**
49+
* Secondary constructor for implementing [copy].
50+
*
51+
* Implementors of [Hmac] should have a private secondary constructor
52+
* that is utilized by its [copy] implementation.
53+
* */
4354
@InternalKotlinCryptoApi
4455
protected constructor(
4556
algorithm: String,

0 commit comments

Comments
 (0)