-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathAaAaa
More file actions
48 lines (32 loc) · 1.01 KB
/
AaAaa
File metadata and controls
48 lines (32 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
## Quick and dirty little converter
## Converts Text to Ascii to Binary and replaces 1 with A and 0 with a
## and allows you to convert it back.
function ConvertTo-AaAaa {
param(
[string]$Text = "Example text :)"
)
begin {
$Output = $Null
}
process {
$Output = foreach($Item in $Text.ToCharArray()) {
$Ascii = [int][char]$Item
$Binary = [convert]::ToString($Ascii,2).PadLeft(8,'0')
$Binary -replace "1", "A" -replace "0", "a"
}
$Output -join ""
}
}
function ConvertFrom-AaAaa {
param(
[string]$Text = "aAaaaAaAaAAAAaaaaAAaaaaAaAAaAAaAaAAAaaaaaAAaAAaaaAAaaAaAaaAaaaaaaAaAaAaaaAAaaAaAaAAAAaaaaAAAaAaaaaAaaaaaaaAAAaAaaaAaAaaA"
)
begin {}
process {
$Output = foreach($Item in ($Text -split '(\w{8})' | ? {$_}) -creplace "A", "1" -creplace "a", "0") {
$Binary = [convert]::ToInt32("$Item",2)
[char]$Binary
}
$Output -join ""
}
}