Skip to content

Commit

Permalink
fix: implement validation null safety to process data and _encrypting
Browse files Browse the repository at this point in the history
  • Loading branch information
SalatielMG committed Feb 10, 2025
1 parent c7009db commit fc62e17
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit fc62e17

Please sign in to comment.