Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: implement validation null safety to process data and _encrypting #254

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/padded_block_cipher/padded_block_cipher_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ class PaddedBlockCipherImpl implements PaddedBlockCipher {
}

@override
Uint8List process(Uint8List? data) {
var inputBlocks = (data!.length + blockSize - 1) ~/ blockSize;
Uint8List process(Uint8List data) {
var inputBlocks = (data.length + blockSize - 1) ~/ blockSize;

int outputBlocks;
if (_encrypting!) {
if (_encrypting ?? false) {
outputBlocks = (data.length + blockSize) ~/ blockSize;
} else {
if ((data.length % blockSize) != 0) {
Expand Down Expand Up @@ -83,7 +83,7 @@ class PaddedBlockCipherImpl implements PaddedBlockCipher {

@override
int doFinal(Uint8List inp, int inpOff, Uint8List out, int outOff) {
if (_encrypting!) {
if (_encrypting ?? false) {
var lastInputBlock = Uint8List(blockSize)..setAll(0, inp.sublist(inpOff));

var remainder = inp.length - inpOff;
Expand Down
Loading