Skip to content

Commit e6ca02c

Browse files
committed
Fix Q1 hash generation
The base64 method of the Digest modules do not add padding
1 parent d4287db commit e6ca02c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Build/Apk.pm

+1-1
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ sub calcapkchksum {
655655
$ctx->addfile($fd);
656656
}
657657
return $ctx if $type eq 'raw';
658-
return $type.$ctx->b64digest() if $type eq 'Q1' || $type eq 'Q2';
658+
return $type.$ctx->b64digest().($type eq 'Q1' ? '=' : '') if $type eq 'Q1' || $type eq 'Q2';
659659
return $type.$ctx->hexdigest() if $type eq 'X1' || $type eq 'X2';
660660
return $ctx->hexdigest();
661661
}

Build/Apkv3.pm

+1-1
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ sub trunc_apkchksum {
442442
sub calcapkchksum_adb {
443443
my ($type) = $_[1];
444444
die("unsupported apkchksum type $type\n") unless $type eq 'Q1' || $type eq 'Q2' || $type eq 'X1' || $type eq 'X2' || $type eq 'md5';
445-
return 'Q1'.Digest::SHA::sha1_base64($_[0]) if $type eq 'Q1';
445+
return 'Q1'.Digest::SHA::sha1_base64($_[0]).'=' if $type eq 'Q1';
446446
return 'Q2'.Digest::SHA::sha256_base64($_[0]) if $type eq 'Q2';
447447
return 'X1'.Digest::SHA::sha1_hex($_[0]) if $type eq 'X1';
448448
return 'X2'.Digest::SHA::sha256_hex($_[0]) if $type eq 'X2';

0 commit comments

Comments
 (0)