Skip to content

Commit

Permalink
Prepare 0.2.4 release
Browse files Browse the repository at this point in the history
  • Loading branch information
05nelsonm committed Apr 16, 2023
1 parent 21c306c commit 01460d2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 17 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# CHANGELOG

## Version 0.2.4 (2023-04-16)
- Adds `Digest.updateDigest` protected open functions for implementors
to override when needing access to input before it is buffered [[#34]][34]
- Adds input argument check for nonJvm `Mac.update` when `offset` and `len`
parameters are specified [[#35]][35]
- Updates `Digest.digestLength` constructor argument check to now accept 0
as a valid length [[#36]][36]
- Previously, passing 0 would throw an `IllegalArgumentException`.

## Version 0.2.3 (2023-04-08)
- Fix `nonJvm` `Mac.doFinal` not calling `engine.reset()` [[#27]][27]
- Only implementation of `Mac` is `Hmac` via `MACs` repo, which is
Expand Down Expand Up @@ -28,3 +37,6 @@
[25]: https://github.com/KotlinCrypto/core/pull/25
[27]: https://github.com/KotlinCrypto/core/pull/27
[29]: https://github.com/KotlinCrypto/core/pull/29
[34]: https://github.com/KotlinCrypto/core/pull/34
[35]: https://github.com/KotlinCrypto/core/pull/35
[36]: https://github.com/KotlinCrypto/core/pull/36
34 changes: 18 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@

Low level core cryptographic components for Kotlin Multiplatform

NOTE: For Jvm, `Digest` extends `MessageDigest` and `Mac` extends `javax.crypto.Mac` for interoperability
NOTE: For Jvm, `Digest` extends `java.security.MessageDigest` and `Mac` extends `javax.crypto.Mac`
for interoperability.

Utilized by [KotlinCrypto/hash][url-hash] and [KotlinCrypto/MACs][url-macs]

Expand Down Expand Up @@ -127,22 +128,22 @@ fun main() {

`XOF`s (i.e. [Extendable-Output Functions][url-pub-xof]) were introduced with `SHA3`.

`XOF`s are very similar to `Digest` and `Mac`, except that instead of calling `digest()`
or `doFinal()` which returns a fixed size `ByteArray`, their output can be however long
you wish.
`XOF`s are very similar to `Digest` and `Mac` except that instead of calling `digest()`
or `doFinal()`, which returns a fixed size `ByteArray`, their output size can be variable
in length.

As such, [KotlinCrypto][url-kotlin-crypto] takes the approach of making them distinctly
separate from those types, while implementing the same interfaces (`Algorithm`, `Copyable`,
different from those types, while implementing the same interfaces (`Algorithm`, `Copyable`,
`Resettable`, `Updatable`).

The only difference is that `Xof`s are read.
Output for an `Xof` is done by reading, instead.

```kotlin
// Using SHAKE128 from hash repo as an example
import org.kotlincrypto.hash.sha3.SHAKE128

fun main() {
val xof = SHAKE128.xOf()
val xof: Xof<SHAKE128> = SHAKE128.xOf()
val bytes = Random.Default.nextBytes(615)

// Xof implements Algorithm
Expand Down Expand Up @@ -177,10 +178,10 @@ fun main() {
reader.read(out3)
reader.read(out4)
reader.close()

try {
// Has been closed and cannot be read from
// anymore.
// The Reader has been closed and will throw
// exception when trying to read from again.
reader.use { read(out4) }
} catch (e: IllegalStateException) {
e.printStackTrace()
Expand All @@ -190,11 +191,12 @@ fun main() {
// a snapshot of Xof, which was not updated
// between production of Readers.
assertContentEquals(out1 + out2, out3 + out4)

// Still able to update Xof b/c Reader uses a snapshot

// Still able to update Xof, independent of the production
// and usage of Readers.
xof.update(10.toByte())
xof.use { read(out3); read(out4) }

try {
assertContentEquals(out1 + out2, out3 + out4)
throw IllegalStateException()
Expand All @@ -216,7 +218,7 @@ The best way to keep `KotlinCrypto` dependencies up to date is by using the
```kotlin
// build.gradle.kts
dependencies {
val core = "0.2.3"
val core = "0.2.4"
implementation("org.kotlincrypto.core:digest:$core")
implementation("org.kotlincrypto.core:mac:$core")
implementation("org.kotlincrypto.core:xof:$core")
Expand All @@ -228,15 +230,15 @@ dependencies {
```groovy
// build.gradle
dependencies {
def core = "0.2.3"
def core = "0.2.4"
implementation "org.kotlincrypto.core:digest:$core"
implementation "org.kotlincrypto.core:mac:$core"
implementation "org.kotlincrypto.core:xof:$core"
}
```

<!-- TAG_VERSION -->
[badge-latest-release]: https://img.shields.io/badge/latest--release-0.2.3-blue.svg?style=flat
[badge-latest-release]: https://img.shields.io/badge/latest--release-0.2.4-blue.svg?style=flat
[badge-license]: https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat

<!-- TAG_DEPENDENCIES -->
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ POM_DEVELOPER_ID=KotlinCrypto
POM_DEVELOPER_NAME=Kotlin Crypto
POM_DEVELOPER_URL=https://github.com/KotlinCrypto/

VERSION_NAME=0.2.4-SNAPSHOT
VERSION_NAME=0.2.4
# 0.1.0-alpha01 = 00 01 00 11
# 0.1.0-beta01 = 00 01 00 21
# 0.1.0-rc01 = 00 01 00 31
Expand Down

0 comments on commit 01460d2

Please sign in to comment.