Hash 如何在Windows上使用Git Bash终端验证下载文件的sha256哈希?

Hash 如何在Windows上使用Git Bash终端验证下载文件的sha256哈希?,hash,terminal,git-bash,sha256,Hash,Terminal,Git Bash,Sha256,如何在Windows上使用Git Bash终端验证下载文件的sha256哈希?例如。在Git Bash终端中验证文件sha256哈希的最简单方法如下: # Go to the directory in which the downloaded file exists cd /path/to/directory/ # Validate sha256 hash of the file sha256sum name_of_the_file echo "the_original_sha25

如何在Windows上使用Git Bash终端验证下载文件的sha256哈希?例如。

在Git Bash终端中验证文件sha256哈希的最简单方法如下:

# Go to the directory in which the downloaded file exists
cd /path/to/directory/

# Validate sha256 hash of the file
sha256sum name_of_the_file
echo "the_original_sha256sum_of_the_file the_name_of_the_file" | sha256sum -c
sha256sum -c name_of_the_sha256sum_file
sha256sum -c phpMyAdmin-5.0.2-english.zip.sha256
这将在终端中打印文件的sha256散列,然后您可以将其与您下载文件的网站中存在的原始散列进行比较

例如,您可以从这里下载任何PHP版本:并像上面提到的那样验证其sha256哈希

另一种验证方法如下所示:

# Go to the directory in which the downloaded file exists
cd /path/to/directory/

# Validate sha256 hash of the file
sha256sum name_of_the_file
echo "the_original_sha256sum_of_the_file the_name_of_the_file" | sha256sum -c
sha256sum -c name_of_the_sha256sum_file
sha256sum -c phpMyAdmin-5.0.2-english.zip.sha256
例如:

echo "2a1468ab5dd540beb161d7b388ed2d80e2515ab112244b08ac201f5bf846d052 php-7.3.23-Win32-VC15-x64.zip" | sha256sum -c
如果文件的sha256散列有效,下一行(包含文件名,后跟单词OK)将在终端中打印:

php-7.3.23-Win32-VC15-x64.zip: OK
如果您有一个sha256sum文件,您可以像下面这样验证下载的文件:

# Go to the directory in which the downloaded file exists
cd /path/to/directory/

# Validate sha256 hash of the file
sha256sum name_of_the_file
echo "the_original_sha256sum_of_the_file the_name_of_the_file" | sha256sum -c
sha256sum -c name_of_the_sha256sum_file
sha256sum -c phpMyAdmin-5.0.2-english.zip.sha256
例如,如果您下载了这些文件的任何版本及其sha256文件,那么您可以按照上述方法验证该文件,如下所示:

# Go to the directory in which the downloaded file exists
cd /path/to/directory/

# Validate sha256 hash of the file
sha256sum name_of_the_file
echo "the_original_sha256sum_of_the_file the_name_of_the_file" | sha256sum -c
sha256sum -c name_of_the_sha256sum_file
sha256sum -c phpMyAdmin-5.0.2-english.zip.sha256
这将打印下一行,表示文件有效:

phpMyAdmin-5.0.2-english.zip: OK
请注意,您可以根据需要使用
sha1sum
而不是
sha256sum