-
Notifications
You must be signed in to change notification settings - Fork 0
/
VeriSum_Verify.bat
118 lines (90 loc) · 4.74 KB
/
VeriSum_Verify.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
@ECHO OFF
TITLE VeriSum - Verify
SETLOCAL ENABLEDELAYEDEXPANSION
MODE con:cols=125 lines=30
MODE 125,30
GOTO comment_end
-----------------------------------------------------------------------------------------------------
VeriSum > Verify
Verifies a generated hash txt file with the contents of the project folder.
Results will be printed in console and a log file will be stored in .logs
Supports: [ x ] Auto detecting digest txt
digest file should be placed in 'checksums' folder as 'ALG.txt'
Ex: checksums\SHA256.txt
Be sure to change the variable 'SET algo' in this file.
SHA256 is the default algorithm.
If you set the algorithm variable to SHA512, then your checksum
file should be
checksums\SHA512.txt
-----------------------------------------------------------------------------------------------------
:comment_end
ECHO.
:: -----------------------------------------------------------------------------------------------------
:: define: algorithm
:: sets the algorithm to use.
:: default = SHA256
::
:: If changing this, ensure you also change it in all files:
:: - VeriSum_GENERATE.BAT
:: - VeriSum_SIGN.BAT
:: - VeriSum_VERIFY.BAT
::
:: options: MD5
:: SHA1
:: SHA256
:: SHA384
:: SHA512
:: Streebog
:: Blake2s
:: Blake2b
:: Blake3
:: -----------------------------------------------------------------------------------------------------
SET algo=SHA256
:: -----------------------------------------------------------------------------------------------------
:: define: directories
:: -----------------------------------------------------------------------------------------------------
SET dir_home=%~dp0
SET dir_root=project
SET dir_lib=.lib
SET dir_logs=.logs
SET dir_output=checksums
:: -----------------------------------------------------------------------------------------------------
:: define: files
:: -----------------------------------------------------------------------------------------------------
SET file_src=%~1
SET file_sha_src=%algo%.txt
SET file_sha_tmp=%algo%.tmp
:: -----------------------------------------------------------------------------------------------------
:: define: libraries
:: DO NOT EDIT
:: -----------------------------------------------------------------------------------------------------
SET echo=%dir_lib%"\cecho.exe"
:: -----------------------------------------------------------------------------------------------------
:: config file
:: -----------------------------------------------------------------------------------------------------
for /F "tokens=*" %%I in (cfg\config.ini) do set %%I
:: -----------------------------------------------------------------------------------------------------
:: remove trailing slash
:: -----------------------------------------------------------------------------------------------------
IF %dir_home:~-1%==\ SET dir_home=%dir_home:~0,-1%
:: -----------------------------------------------------------------------------------------------------
:: header
:: -----------------------------------------------------------------------------------------------------
%echo% {gray}-----------------------------------------------------------------------------------------------------{\n}{\n}
%echo% {lime}
%echo% %algo% - Verify{\n\n}{silver}
%echo% Verifies a generated hash txt file with the contents of the project folder.{\n}
%echo% Results will be printed in console and a log file will be stored in {03}%dir_logs%{#}{\n\n}
%echo% Open this file in notepad if you want to change the {03}algorithm{#} you wish to use{\n}
%echo% {white}{\n}
%echo% {gray}-----------------------------------------------------------------------------------------------------{\n}{\n}{white}
:: -----------------------------------------------------------------------------------------------------
:: verify checksum
:: -----------------------------------------------------------------------------------------------------
call %dir_lib%\verisum.exe "%dir_home%\%dir_root%" %algo% -o "%dir_home%\%dir_logs%\%algo%_verify.txt" -verify "%dir_home%\%dir_output%\%algo%.txt" -progress -lowercase -rewrite -fast -clean -ignore *gitignore -ignore *.md -ignore *docs
%echo% {gray}{\n\n\n\n}
timeout /t 2 /nobreak >nul
TITLE VeriSum - Verify (Complete)
%echo% {CF} Press any key to close utility {white}{\n}
PAUSE >nul
Exit /B 0