Convert Hexedeciamal Numbers to Text

Computers use different ways to represent the information they store. This script helps with converts Hexedecimal numbers (Hex) to Plain Text.

 

Script Hex2Text.ps1

<#
 .SYNOPSIS
 Convert HEX to Text.
 
 .DESCRIPTION
 This script will help you convert HEXEDECIMAL files to text.
 
 .PARAMETER HEX
 Please, Type the Hexedecimal, ok?
 
 .NOTES
 ===========================================================================
 Created on: 8/2/2015 9:27 PM
 Created by: Carlos Vargas
 Filename: Hex2Text.ps1
 ===========================================================================
 .EXAMPLE

 ===================Example 1==========================
 .Hex2Text.ps1 -Hex "546f64617920697320616e20617765736f6d6520646179"

 Today is an awesome day

 ===================Example 2==========================

 .Hex2Text.ps1 -Hex "54 6f 64 61 79 20 69 73 20 61 6e 20 61 77 65 73 6f 6d 65 20 64 61 79"

 Today is an awesome day

#>
param
(
 [Parameter(Mandatory = $true,
 HelpMessage = 'Please, Type the Hexedecimal, ok?')]
 [ValidateNotNullOrEmpty()]
 $HEX
)

Function Hex2Text ($HEX)
{
 $hexnospaces = DetectSpacesinHex($HEX)
 $HEXDATA = $hexnospaces
 $HEXDATA = $HEXDATA -split '(..)' | ? { $_ }
 $HEXDATA.split() | %{ Write-host ([char][int]$("0x{0}" -f $_)) -nonewline }
}

Function DetectSpacesinHex($Hex)
{
 
 $hexnospaces = $Hex.Replace(" ", "")
 $hexnospaces
 
}

Hex2Text($HEX)

 

Subscribe For Latest Updates

Sign up for best of digital marketing, livestream and technology opinions on what matters to you.

Invalid email address
We promise not to spam you. You can unsubscribe at any time.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: