def xts.dsteal.go
bend-osdev-cipher-modes@0.1.0.0 · xts.bend:133
import bend-osdev-cipher-modes@0.1.0.0/xts.bend as Xts
import Base
import bend-osdev-bytes@0.1.0.0/bytes.bend as B
import bend-osdev-cipher-modes@0.1.0.0/cipher_modes.bend as M
133
134def xts.dsteal.go(~K: Data, ~dec: K -> M.CmBlock -> M.CmBlock, partial: Bool, +k: K, c: M.CmBlock, +tail: List<&2, U32>, +t: M.CmBlock) -> List<&2, U32>:
135 match partial:
136 case False{}:
137 M.cm.bytes_of(xts.bdec(~K, ~dec, k, c, t))
138 case True{}:
139 +pp = M.cm.bytes_of(xts.bdec(~K, ~dec, k, c, Xts.mul_alpha(t)))
140 M.cm.bytes_onto(xts.bdec(~K, ~dec, k, M.cm.block_of(B.append(tail, B.drop(B.len(tail), pp))), t), B.take(B.len(tail), pp))