def gcm_inc32
qasim-bend-kit@0.1.0.2 · libs/AES256GCMCore.bend:454
import qasim-bend-kit@0.1.0.2/libs/AES256GCMCore.bend as AES256GCMCore
import Base
454def gcm_inc32(+counter: List<&2, U32>) -> List<&2, U32>:
455 hi = U32.shln(aes_byte_at(counter, 12n), 24n)
456 mid1 = U32.shln(aes_byte_at(counter, 13n), 16n)
457 mid2 = U32.shln(aes_byte_at(counter, 14n), 8n)
458 lo = aes_byte_at(counter, 15n)
459 +word = U32.add(U32.or(U32.or(hi, mid1), U32.or(mid2, lo)), 1)
460 List.append(&2, U32, List.take(&2, U32, counter, 12n),
461 [U32.and(255, U32.shrn(word, 24n)), U32.and(255, U32.shrn(word, 16n)),
462 U32.and(255, U32.shrn(word, 8n)), U32.and(255, word)])