PHP implementing Ciphertext Stealing (CTS) with CBC
问题 I have been trying to implement Ciphertext Stealing(CTS) in PHP for CBC. Referring below two links How can I encrypt/decrypt data using AES CBC+CTS (ciphertext stealing) mode in PHP? and http://en.wikipedia.org/wiki/Ciphertext_stealing I am confused and stuck on the last and simplest step of XOR. I know this is silly but having tried all the combinations, i don't know what am i missing. Code follows. // 1. Decrypt the second to last ciphertext block, using zeros as IV. $second_to_last_cipher