-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConvert-Base64.ps1
44 lines (39 loc) · 996 Bytes
/
Convert-Base64.ps1
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
function ConvertTo-Base64 {
<#
.SYNOPSIS
Function to convert Unicode text to a Base64 String
.DESCRIPTION
Function to convert Unicode text to a Base64 String
.PARAMETER Path
None
.EXAMPLE
ConvertTo-Base64
.NOTES
acidcrash376
github.com/acidcrash376
.LINK
#>
$text = Read-Host
$bytes = [System.Text.Encoding]::Unicode.GetBytes($text)
$encodedtext=[Convert]::ToBase64String($Bytes)
$encodedtext
}
function ConvertFrom-Base64 {
<#
.SYNOPSIS
Function to convert a Base64 string to Unicode text
.DESCRIPTION
Function to convert a Base64 string to Unicode text
.PARAMETER Path
None
.EXAMPLE
ConvertFrom-Base64
.NOTES
acidcrash376
github.com/acidcrash376
.LINK
#>
$Encodedtext = Read-Host
$decodedtext = [System.Text.Encoding]::Unicode.GetString(([System.Convert]::FromBase64String($encodedtext))
$decodedtext
}