From b2fc15762491fd5bb6fc8ec3109d2dd39fee12d2 Mon Sep 17 00:00:00 2001 From: philsmd Date: Sat, 19 Aug 2023 12:00:29 +0200 Subject: [PATCH] verify test fix for -m 31900 = MetaMask Mobile Wallet --- tools/test_modules/m31900.pm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tools/test_modules/m31900.pm b/tools/test_modules/m31900.pm index c3dbf5c91..ad192d552 100644 --- a/tools/test_modules/m31900.pm +++ b/tools/test_modules/m31900.pm @@ -44,7 +44,25 @@ sub module_generate_hash padding => "none" }); - my $pt = "[{\"type\":\"HD Key Tree\",\"data\":{\"mnemonic\":\"ocean hidden kidney famous rich season gloom husband spring convince attitude boy\",\"numberOfAccounts\":1,\"hdPath\":\"m/44'/60'/0'/0\"}}]"; + my $pt = ""; + + if (! defined ($ct)) + { + $pt = "[{\"type\":\"HD Key Tree\",\"data\":{\"mnemonic\":\"ocean hidden kidney famous rich season gloom husband spring convince attitude boy\",\"numberOfAccounts\":1,\"hdPath\":\"m/44'/60'/0'/0\"}}]"; + } + else + { + $pt = $cipher->decrypt (pack ("H*", $ct)); + + if ($pt =~ m/^[ -~]*$/) # is_valid_printable_32 () + { + # ok + } + else + { + $pt = ""; # fake + } + } my $ct1 = substr ($cipher->encrypt ($pt), 0, 16);