Why can node's aes-256-gcm produce ciphertexts with lengths indivisible by 16?

Marius :

Despite AES-256-GCM using a block chiffre with a block size of 16 byte, why does the following nodejs code produce an output with a total length not divisible by 16?

const crypto = require('crypto')
let iv = Buffer.from('ed655ce15162cecc9a0fc47fbc5055e2', 'hex')
let key = Buffer.from('17c0c95f4499dc8cb2b11d8c68569729484579df9adeceb7898fd9508915e46f', 'hex')
let cipher = crypto.createCipheriv('aes-256-gcm', key, iv)
let outputA = cipher.update("some string", 'utf8')
let outputB = cipher.final()

console.log(outputA.length, outputB.length) //output: "11 0"
//outputA = <Buffer 26 5b 11 63 cf 26 44 81 d2 1d 77>
Woodstock :

Apparently GCM does not require padding, nor does it require plaintext to be a multiple of the block size.

More info here.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=397943&siteId=1