I’m trying to create a basic xor file encryption using the powershell.
My idea would be something like that
[System.IO.File]::ReadAllBytes("test.txt") | foreach { [System.BitConverter]::ToInt32($_,0) -bxor [System.BitConverter]::ToInt32($password,0) } | Out-File "test.txt"
But my problem is, that the bytes go threw the pipe one after an other, what makes using a password longer than 1 character useless.
So I’m searching for a way to combine the elements so that the elements enter the for loop in groups as big as the password is long.
Has anyone an idea how to do that?
Tried
with the
-readcountparameter set to the password length?