powershell - 文件散列/校验和值是否不区分大小写?

标签 powershell hash

我的问题只是关于文件哈希而不是一般的哈希函数。我的假设是文件校验和/散列的值不区分大小写。我担心的是我找不到任何在线文档来确认这一点。我只有以下两点来支持我的说法。

  1. 此链接包含一些文件哈希值。它们都不包含任何大写字母。 https://www.virtualbox.org/download/hashes/6.1.2/SHA256SUMS

  2. 当我使用 Powershell Get-FileHash cmdlet 时,所有返回值均为大写。 https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/get-filehash?view=powershell-7

任何人都可以帮助我确认我的假设,并提供一些关于 Windows 和 Linux 操作系统中文件的文档吗?

最佳答案

散列和校验和通常出现在 hexadecimal 中符号。尽管通常使用大写字母 A-F 而不是小写字母 a-f,但这并没有什么区别。

至于引用,这个问题太基础了,很难找到可靠的引用。一个是 C 编程语言的 ISO/IEC 9899 标准:

A hexadecimal constant consists of the prefix 0x or 0X followed by a sequence of the decimal digits and the letters a (or A) through f (or F) with values 10 through 15 respectively.

在某些用例中,例如 CSS小写可能是首选,因为在其他小写字符中阅读起来更愉快。 .Net的Int32.ToString支持标准数字格式化程序。 x 为小写,X 为大写。

在 System.Convert 中,有 ToInt32这会将值从一个基数转换为 32 位整数。让我们看看十六进制数字 AA 在不同情况下如何转换为十进制。像这样,

[convert]::toint32("aa", 16)
170
[convert]::toint32("AA", 16)
170
[convert]::toint32("aA", 16)
170
[convert]::toint32("Aa", 16)
170

每个字母大小写组合代表相同的十进制值 170。不过不要在散列上尝试这样做,因为它们通常大于 32 位整数。

关于powershell - 文件散列/校验和值是否不区分大小写?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59871996/

相关文章:

用于从 blob 中删除/筛选具有额外分隔符的行的 Azure Powershell 脚本

c++ - 无法解析符号哈希

algorithm - 通过折叠然后除以素数来散列 key ?

c - 哈希表反向插入值 [C]

powershell - 为什么 $_ 不返回完整的对象

powershell - PowerShell 的测试路径超时

windows - PowerShell-如何计算对象?

powershell - 循环遍历 PSOBJECT 将值与字符串进行比较

c++ - caml_hash_varian返回的值在什么范围?

javascript - 如何使用无内存函数将 256 个唯一字符串映射到整数 (0..255)