We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a309727 commit 4ced19bCopy full SHA for 4ced19b
src/main/kotlin/cryptography/Nonce.kt
@@ -9,7 +9,7 @@ value class Nonce(val value: ULong) {
9
10
val bytes: ByteArray get() = SIZE.byteArray { (value shr (it * Byte.SIZE_BITS)).toByte() }
11
12
- fun increment(): Nonce? = if (value == ULong.MAX_VALUE) null else Nonce(value + 1uL)
+ fun increment(): Nonce? = if (value >= ULong.MAX_VALUE - 2uL) null else Nonce(value + 1uL)
13
14
companion object {
15
0 commit comments