replaced md5 by sha1 checksumming

This commit is contained in:
Tim Ruehsen 2014-03-24 09:48:01 +01:00
parent 0771255742
commit e379ba90cf
4 changed files with 10 additions and 9 deletions

View File

@ -68,9 +68,10 @@ time_t
// returns mtime of PSL source file
time_t
psl_inline_builtin_file_time(void);
// returns MD5 checksum of PSL source file
// returns MD5 checksum (hex-encoded, lowercase) of PSL source file
const char *
psl_inline_builtin_md5sum(void);
psl_inline_builtin_sha1sum(void);
PSL_END_DECLS

View File

@ -159,8 +159,8 @@ time_t psl_inline_builtin_file_time(void)
return _psl_file_time;
}
// returns MD5 checksum of PSL source file
const char *psl_inline_builtin_md5sum(void)
// returns MD5 checksum (hex-encoded, lowercase) of PSL source file
const char *psl_inline_builtin_sha1sum(void)
{
return _psl_md5_checksum;
return _psl_sha1_checksum;
}

View File

@ -114,7 +114,7 @@ int main(int argc, const char **argv)
_print_psl_entries(fpout, psl->suffixes, "suffixes");
_print_psl_entries(fpout, psl->suffix_exceptions, "suffix_exceptions");
snprintf(cmd, sizeof(cmd), "md5sum %s", argv[1]);
snprintf(cmd, sizeof(cmd), "sha1sum %s", argv[1]);
if ((pp = popen(cmd, "r"))) {
if (fscanf(pp, "%63[0-9a-zA-Z]", checksum) < 1)
*checksum = 0;
@ -125,7 +125,7 @@ int main(int argc, const char **argv)
st.st_mtime = 0;
fprintf(fpout, "static time_t _psl_file_time = %lu;\n", st.st_mtime);
fprintf(fpout, "static time_t _psl_compile_time = %lu;\n", time(NULL));
fprintf(fpout, "static char _psl_md5_checksum[] = \"%s\";\n", checksum);
fprintf(fpout, "static char _psl_sha1_checksum[] = \"%s\";\n", checksum);
if (fclose(fpout) != 0)
ret = 4;

View File

@ -89,8 +89,8 @@ static void test_psl(void)
printf("psl_builtin_file_time()=%ld\n", psl_inline_builtin_file_time());
psl_inline_builtin_file_time() == 0 ? failed++ : ok++;
printf("psl_builtin_md5sum()=%s\n", psl_inline_builtin_md5sum());
*psl_inline_builtin_md5sum() == 0 ? failed++ : ok++;
printf("psl_builtin_sha1sum()=%s\n", psl_inline_builtin_sha1sum());
*psl_inline_builtin_sha1sum() == 0 ? failed++ : ok++;
psl_inline_deinit();
}