Skip to content

Commit 8898c22

Browse files
committed
Allow custom nonce for testing
1 parent 8887198 commit 8898c22

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/branca.cr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ struct Branca
3838
time = Bytes.new(4)
3939
BigEndian.encode(timestamp, time)
4040

41-
nonce = Nonce.new.to_slice
41+
# Use custom nonce if set (only for testing).
42+
nonce = @nonce || Nonce.new.to_slice
4243
header = Slice(UInt8).new(1, VERSION) + time + nonce
4344

4445
ciphertext = Bytes.new(payload.size + Mac.size)

0 commit comments

Comments
 (0)