unwrap method
Implementation
Uint8List unwrap(Uint8List data) {
var n = data.length ~/ 8 - 1;
var a = Uint8List(16);
a.setAll(0, data.take(8));
var a64 = ByteData.view(a.buffer);
var b = Uint8List(16);
var r = Uint8List(n * 8);
r.setAll(0, data.skip(8));
for (var j = 5; j >= 0; j--) {
for (var i = n - 1; i >= 0; i--) {
var t = n * j + i + 1;
a64.setInt32(0, a64.getInt32(0) ^ (t << 32));
a64.setInt32(4, a64.getInt32(4) ^ (t & 0xffffffff));
a.setAll(8, r.skip(i * 8).take(8));
_underlyingCipher.processBlock(a, 0, b, 0);
a.setAll(0, b.take(8));
r.setAll(i * 8, b.skip(8));
}
}
for (var i = 0; i < 8; i++) {
if (_iv[i] != a[i]) {
throw 'Invalid ';
}
}
return r;
}