I would like the ability to be able to set the initial block counter to something other than 0 as I'm working on an extractor for this project here and that sets the block counter to a random value like 0xde7a8b6883eeed8d where encrypting/decrypting dummy data isn't feasible.
Currently this is my workaround which works but is pretty hacky:
import ctypes
from Cryptodome.Cipher import Salsa20
bc = int.from_bytes(nonce[8:16],'little')
ctx = Salsa20.new(key,nonce[:8])
pctx = ctypes.cast(ctx._state.get(),ctypes.POINTER(ctypes.c_uint32))
pctx[8],pctx[9] = bc & 0xFFFFFFFF,(bc >> 32) & 0xFFFFFFFF
o = ctx.decrypt(i)
I would like the ability to be able to set the initial block counter to something other than 0 as I'm working on an extractor for this project here and that sets the block counter to a random value like
0xde7a8b6883eeed8dwhere encrypting/decrypting dummy data isn't feasible.Currently this is my workaround which works but is pretty hacky: