我在flutter (尖城堡库)中使用Uint64List时出错了
var length = Uint8List.view((Uint64List(2)..[0] = iv.length * 8).buffer);
"Error: Unsupported operation: Uint64List not supported on the web.
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 266:49 throw_
dart-sdk/lib/_internal/js_dev_runtime/patch/typed_data_patch.dart 115:5 new
packages/pointycastle/block/modes/gcm.dart 81:36 [_computeInitialCounter]
packages/pointycastle/block/modes/gcm.dart 61:16 prepare
packages/pointycastle/src/impl/base_aead_block_cipher.dart 217:5 reset
packages/pointycastle/block/modes/gcm.dart 47:11 reset
packages/pointycastle/src/impl/base_aead_block_cipher.dart 117:5 init
packages/pointycastle/block/modes/gcm.dart 40:11 init
packages/crypto_keys/src/symmetric_operator.dart 71:16 encrypt
你知道怎么解决吗?Thx
发布于 2022-11-22 00:08:11
对于所有的实际值IV长度,您可以拟合32位int值。以下等效代码在Dartpad中运行良好,并给出了与VM中的上述代码相同的结果。
import 'dart:typed_data';
void main() {
final iv = Uint8List(12);
final length = Uint8List.view((Uint32List(4)..[0] = iv.length * 8).buffer);
print(length);
}
同样,这也是:
var len = Uint8List.view((Uint32List(4)
..[2] = aad!.length * 8
..[0] = _processedBytes * 8)
.buffer);
发布于 2022-11-23 14:22:55
请回答我的问题?
@override
int doFinal(Uint8List out, int outOff) {
var result = remainingInput.isNotEmpty
? processBlock(remainingInput, 0, out, outOff)
: 0;
var len = Uint8List.view((Uint64List(2)
..[1] = aad!.length * 8
..[0] = _processedBytes * 8)
.buffer);
len = Uint8List.fromList(len.reversed.toList());
_gHASHBlock(_x, len);
_xor(_x, _e0);
if (forEncryption) {
out.setAll(outOff + result, _x);
result += _x.length;
}
validateMac();
return result;
}
https://stackoverflow.com/questions/74523047
复制相似问题