在powershell中合并对象
我正在尝试使用powershell创建一个基本的xor文件加密。 我的想法是这样的在powershell中合并对象,powershell,Powershell,我正在尝试使用powershell创建一个基本的xor文件加密。 我的想法是这样的 [System.IO.File]::ReadAllBytes("test.txt") | foreach { [System.BitConverter]::ToInt32($_,0) -bxor [System.BitConverter]::ToInt32($password,0) } | Out-File "test.txt" 但我的问题是,字节一个接一个地抛出管道,这使得使用长度超过1个字符的密码毫无用处。
[System.IO.File]::ReadAllBytes("test.txt") | foreach { [System.BitConverter]::ToInt32($_,0) -bxor [System.BitConverter]::ToInt32($password,0) } | Out-File "test.txt"
但我的问题是,字节一个接一个地抛出管道,这使得使用长度超过1个字符的密码毫无用处。
因此,我正在寻找一种组合元素的方法,以便元素以密码长度一样大的组进入for循环。
有人知道怎么做吗?试过了
get-content -readcount
是否将-readcount
参数设置为密码长度