Skip to content

Commit

Permalink
fix ChaCha64
Browse files Browse the repository at this point in the history
  • Loading branch information
nakagami committed Jan 10, 2025
1 parent 3515c56 commit ba809fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions firebirdsql/chacha.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ def translate(self, plain):
counter_bytes = int_to_bytes(self.counter, 16 - len(self.nonce))
self.state[12] = bytes_to_uint(counter_bytes[:4])
if len(self.nonce) == 8:
self.state[13] = add_u32(self.state[13] & 0xffff0000, bytes_to_uint(counter_bytes[4:]))

# ChaCha64: 64 bit nonce, 64 bit counter
self.state[13] = bytes_to_uint(counter_bytes[4:])
self.block = self.chacha20_round_bytes()
self.block_pos = 0

Expand Down

0 comments on commit ba809fe

Please sign in to comment.