; SHA1 [HKEY_CLASSES_ROOT\*\shell\getHash\shell\SHA1] "MUIVerb"="SHA1" [HKEY_CLASSES_ROOT\*\shell\getHash\shell\SHA1\command] @="powershell.exe -NoExit -NonInteractive Get-FileHash -LiteralPath '%1' -Algorithm SHA1 | Format-List"是什么意思
时间: 2023-07-09 21:54:59 浏览: 42
这是一个 Windows 注册表键值对,它添加了一个名为“SHA1”的上下文菜单项,可以在任何文件上下文菜单中使用。当用户单击该菜单项时,它会使用 PowerShell 命令 Get-FileHash 来计算文件的 SHA1 哈希值,并在 PowerShell 中显示结果。这个键值对的目的是使用户能够方便地计算文件的 SHA1 哈希值,而无需打开 PowerShell 或其他命令行界面。
相关问题
; SHA256 [HKEY_CLASSES_ROOT\*\shell\getHash\shell\SHA256] "MUIVerb"="SHA256" [HKEY_CLASSES_ROOT\*\shell\getHash\shell\SHA256\command] @="powershell.exe -NoExit -NonInteractive Get-FileHash -LiteralPath '%1' -Algorithm SHA256 | Format-List" ; SHA512 [HKEY_CLASSES_ROOT\*\shell\getHash\shell\SHA512] "MUIVerb"="SHA512" [HKEY_CLASSES_ROOT\*\shell\getHash\shell\SHA512\command] @="powershell.exe -NoExit -NonInteractive Get-FileHash -LiteralPath '%1' -Algorithm SHA512 | Format-List" ; MD5 [HKEY_CLASSES_ROOT\*\shell\getHash\shell\MD5] "MUIVerb"="MD5" [HKEY_CLASSES_ROOT\*\shell\getHash\shell\MD5\command] @="powershell.exe -NoExit -NonInteractive Get-FileHash -LiteralPath '%1' -Algorithm MD5 | Format-List" ; Get File Hash for exe file [HKEY_CLASSES_ROOT\exefile\shell\getHash] "MUIVerb"="Get Hash of file" "SubCommands"="" ; SHA1 [HKEY_CLASSES_ROOT\exefile\shell\getHash\shell\SHA1] "MUIVerb"="SHA1" [HKEY_CLASSES_ROOT\exefile\shell\getHash\shell\SHA1\command] @="powershell.exe -NoExit -NonInteractive Get-FileHash -LiteralPath '%1' -Algorithm SHA1 | Format-List" ; SHA256 [HKEY_CLASSES_ROOT\exefile\shell\getHash\shell\SHA256] "MUIVerb"="SHA256" [HKEY_CLASSES_ROOT\exefile\shell\getHash\shell\SHA256\command] @="powershell.exe -NoExit -NonInteractive Get-FileHash -LiteralPath '%1' -Algorithm SHA256 | Format-List" ; SHA512 [HKEY_CLASSES_ROOT\exefile\shell\getHash\shell\SHA512] "MUIVerb"="SHA512" [HKEY_CLASSES_ROOT\exefile\shell\getHash\shell\SHA512\command] @="powershell.exe -NoExit -NonInteractive Get-FileHash -LiteralPath '%1' -Algorithm SHA512 | Format-List" ; MD5 [HKEY_CLASSES_ROOT\exefile\shell\getHash\shell\MD5] "MUIVerb"="MD5" [HKEY_CLASSES_ROOT\exefile\shell\getHash\shell\MD5\command] @="powershell.exe -NoExit -NonInteractive Get-FileHash -LiteralPath '%1' -Algorithm MD5 | Format-List" 是什么意思
这是一组 Windows 注册表键值对,添加了多个上下文菜单项,可以在任何文件或可执行文件上下文菜单中使用。这些菜单项使用 PowerShell 命令 Get-FileHash 来计算文件的哈希值,并在 PowerShell 中显示结果。其中包括 SHA1、SHA256、SHA512 和 MD5 算法的哈希值。这些键值对的目的是使用户能够方便地计算文件或可执行文件的哈希值,以确保文件的完整性和安全性。键值对中的“MUIVerb”属性定义了菜单项的文本标签,“command”属性定义了执行计算哈希值的 PowerShell 命令。
文件分片计算sha256 js
以下是一个简单的 JavaScript 函数,用于计算文件的 SHA256 哈希值并分片处理:
```javascript
function calculateSHA256(file, chunkSize, onChunkCompleted, onCompleted) {
const fileSize = file.size;
let offset = 0;
const hasher = new Hashes.SHA256();
// 递归函数,处理每个文件分片
function processChunk() {
if (offset < fileSize) {
const chunkReader = new FileReader();
const chunkEnd = Math.min(offset + chunkSize, fileSize);
const chunk = file.slice(offset, chunkEnd);
chunkReader.onload = function(e) {
hasher.update(e.target.result);
offset += chunkSize;
onChunkCompleted(hasher.getHMAC());
processChunk();
};
chunkReader.readAsArrayBuffer(chunk);
} else {
onCompleted(hasher.getHash('hex'));
}
}
processChunk();
}
```
使用示例:
```javascript
// 选择一个文件
const fileInput = document.querySelector('input[type="file"]');
fileInput.addEventListener('change', function() {
const file = fileInput.files[0];
const chunkSize = 1024 * 1024; // 每个分片的大小为 1MB
// 处理每个文件分片
calculateSHA256(file, chunkSize, function(chunkHash) {
console.log('分片哈希值:', chunkHash);
}, function(fileHash) {
console.log('文件 SHA256 哈希值:', fileHash);
});
});
```
注意:此代码依赖于第三方库 Hashes.js,需要在 HTML 文件中引入该库。