Differences
This shows you the differences between the selected revisions of the page.
2023-12-27 | 2024-01-02 (current) | ||
making the code compatible with .net [core] and powershell [core] (martin) | run much faster in pwsh with non-generic queue (martin) | ||
Line 3: | Line 3: | ||
The following PowerShell script can be used to decrypt files [[file_encryption|encrypted by WinSCP]], when you do not have WinSCP available. | The following PowerShell script can be used to decrypt files [[file_encryption|encrypted by WinSCP]], when you do not have WinSCP available. | ||
- | //The script works both in legacy Windows PowerShell and modern PowerShell [Core], though it runs much slower in the latter.// | + | //The script works both in legacy Windows PowerShell and modern PowerShell [Core], though it runs slower in the latter.// |
//For C# version of the ''AesCtrTransform'' function, see [[https://stackoverflow.com/q/6374437/850848#51188472|Can I use AES in CTR mode in .NET?]]// | //For C# version of the ''AesCtrTransform'' function, see [[https://stackoverflow.com/q/6374437/850848#51188472|Can I use AES in CTR mode in .NET?]]// | ||
Line 26: | Line 26: | ||
$counter = $salt.Clone() | $counter = $salt.Clone() | ||
- | $xorMask = New-Object System.Collections.Generic.Queue[byte] | + | # Particularly in pwsh, it runs much faster with non-generic Queue |
+ | ····$xorMask = New-Object System.Collections.Queue | ||
$zeroIv = New-Object byte[] $blockSize | $zeroIv = New-Object byte[] $blockSize |