This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# define and encode test data | |
$TestString = 'This is a test. A short test for encoding and padding.' | |
$Encoded = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($TestString)) | |
# insert random '=' | |
$Length = $Encoded.Length | |
$RandomChar = 1..($Length - 3) | Get-Random | |
$Encoded = $Encoded.Insert($RandomChar,'=') | |
# strip out '=' |