mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-06-03 00:19:56 -04:00
Add .md5/.sha1/.sha256/.sha512 check file feature.
Hotkey m is for calculate checksum and print the result. If also exist a .md5/.sha1/.sha256/.sha512 file, then it will check the result with the value in the file. The .md5/.sha1/.sha256/.sha512 suffix is appended to the original file name not replace the original suffix. For example: /ISO/Ubuntu-20.04-amd64-desktop.iso /ISO/Ubuntu-20.04-amd64-desktop.iso.md5
This commit is contained in:
parent
836e1aa11e
commit
a93b0f6656
3 changed files with 118 additions and 26 deletions
|
@ -224,6 +224,8 @@ grub_cmd_hashsum (struct grub_extcmd_context *ctxt,
|
|||
int keep = state[3].set;
|
||||
int uncompress = state[4].set;
|
||||
unsigned unread = 0;
|
||||
int len = 0;
|
||||
char hashsum[256];
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE (aliases); i++)
|
||||
if (grub_strcmp (ctxt->extcmd->cmd->name, aliases[i].name) == 0)
|
||||
|
@ -282,8 +284,12 @@ grub_cmd_hashsum (struct grub_extcmd_context *ctxt,
|
|||
continue;
|
||||
}
|
||||
for (j = 0; j < hash->mdlen; j++)
|
||||
grub_printf ("%02x", ((grub_uint8_t *) result)[j]);
|
||||
{
|
||||
grub_printf ("%02x", ((grub_uint8_t *) result)[j]);
|
||||
len += grub_snprintf(hashsum + len, sizeof(hashsum) - len, "%02x", ((grub_uint8_t *) result)[j]);
|
||||
}
|
||||
grub_printf (" %s\n", args[i]);
|
||||
grub_env_set("VT_LAST_CHECK_SUM", hashsum);
|
||||
}
|
||||
|
||||
if (unread)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue