-2

I would like to check if the password that was entered by the user for .7z encrypted file is correct (even by boolean yes or no, without compressing).

can i do it and how ? if yes - what is the command line ?

assembler
  • 3,098
  • 12
  • 43
  • 84
Tom Cohen
  • 95
  • 1
  • 2
  • 9

1 Answers1

0

Not with javascript, but with UNIX shell:

7z t -p"$PASS" archive.7z > /dev/null 2>&1 && echo correct || echo wrong 

Assumes password is in PASS variable, you can substitute it directly of course.

Of course, instead of relying on echo'ed values you can just read the ret code of 7z. Zero for correct, nonzero for wrong.

alamar
  • 18,729
  • 4
  • 64
  • 97