Skip to content

Commit 5f39dc9

Browse files
committed
v0.2.3
Upped the hashing algo used for generating checksums.
1 parent 2a60789 commit 5f39dc9

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

Changelog.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ Versioning guidelines for SemVer can be found at: https://semver.org/
77

88
=== Changes made since last versioned release ===
99

10+
(none)
11+
12+
=== Version/Release 0.2.3 ===
13+
PATCH RELEASE.
14+
1015
- [2018.12.19; Sub-minor code change; Maikuolan]: Split apart the YAML handler
1116
a little more (doesn't change anything functionally, but should help to
1217
slightly reduce complaints sometimes made by certain code quality checkers
@@ -16,6 +21,14 @@ Versioning guidelines for SemVer can be found at: https://semver.org/
1621
README to German, Russian, Korean, and Japanese. This totals 14 translations
1722
now available.
1823

24+
- [2019.01.25; Sub-minor code change; Maikuolan]: Upped the hashing algo used
25+
for generating checksums by default from MD5 to SHA256, seeing as the latter
26+
is already supported by phpMussel anyhow (thus having zero implementation
27+
cost).
28+
29+
Caleb M (Maikuolan),
30+
January 25, 2019.
31+
1932
=== Version/Release 0.2.2 ===
2033
PATCH RELEASE.
2134

sigtool.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* SigTool v0.2.3 (last modified: 2018.12.20).
3+
* SigTool v0.2.3 (last modified: 2019.01.25).
44
* Generates signatures for phpMussel using main.cvd and daily.cvd from ClamAV.
55
*
66
* Package location: GitHub <https://github.com/phpMussel/SigTool>.
@@ -19,7 +19,7 @@ class SigTool
1919
public $Ver = '0.2.3';
2020

2121
/** Last modified date. */
22-
public $Modified = '2018.12.20';
22+
public $Modified = '2019.01.25';
2323

2424
/** Script user agent. */
2525
public $UA = 'SigTool v%s (https://github.com/phpMussel/SigTool)';
@@ -138,7 +138,7 @@ public function read(string $In, &$Arr, int $Depth = 0)
138138
}
139139

140140
/**
141-
* Process one line of YAML. Parameters reference variables set by calling method.
141+
* Process a single line of YAML. Parameters reference variables set by calling method.
142142
*
143143
* @param string $ThisLine
144144
* @param string $ThisTab
@@ -302,7 +302,7 @@ public function fetch($URI, $Timeout = 600)
302302
public function shorthand(&$Data)
303303
{
304304
while (true) {
305-
$Check = md5($Data) . ':' . strlen($Data);
305+
$Check = hash('sha256', $Data) . ':' . strlen($Data);
306306
foreach ([
307307
["\x11", 'Win'],
308308
["\x12", 'W(?:in)?32'],
@@ -419,7 +419,7 @@ public function shorthand(&$Data)
419419
'',
420420
''
421421
], $Data);
422-
if (md5($Data) . ':' . strlen($Data) === $Check) {
422+
if (hash('sha256', $Data) . ':' . strlen($Data) === $Check) {
423423
break;
424424
}
425425
}
@@ -750,7 +750,7 @@ public function fixPath($Path)
750750
if (!empty($Set[5]) && !empty($Set[4]) && !empty($Meta[$Set[4]]['Files']['Checksum'][0]) && !empty($Meta[$Set[4]]['Version'])) {
751751
/** We use the format Y.z.B for signature file versioning. */
752752
$Meta[$Set[4]]['Version'] = date('Y.z.B', time());
753-
$Meta[$Set[4]]['Files']['Checksum'][0] = md5($FileData) . ':' . strlen($FileData);
753+
$Meta[$Set[4]]['Files']['Checksum'][0] = hash('sha256', $FileData) . ':' . strlen($FileData);
754754
}
755755

756756
echo $L10N['Done'];
@@ -1065,7 +1065,7 @@ function ($Matches) use ($Char, $Length) {
10651065
if (!empty($Meta[$FileSet]['Files']['Checksum'][0]) && !empty($Meta[$FileSet]['Version'])) {
10661066
/** We use the format Y.z.B for signature file versioning. */
10671067
$Meta[$FileSet]['Version'] = date('Y.z.B', time());
1068-
$Meta[$FileSet]['Files']['Checksum'][0] = md5($FileData) . ':' . strlen($FileData);
1068+
$Meta[$FileSet]['Files']['Checksum'][0] = hash('sha256', $FileData) . ':' . strlen($FileData);
10691069
}
10701070
file_put_contents($SigTool->fixPath(__DIR__ . '/' . $FileSet), $FileData);
10711071
$Handle = gzopen($SigTool->fixPath(__DIR__ . '/' . $FileSet . '.gz'), 'wb');

0 commit comments

Comments
 (0)