Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PowerShell hex to string conversion

Tags:

powershell

Need help to convert all hex characters contained in a text file to string or ASCII. Hex characters appear in a standard format of

user1 domain1 7374726f6e6770617373776f7264403130                                               
user2 domain2 7374726f6e6770617373776f7264403120

After conversion it should show as

user1 domain1 strongpassword@10

the text file contains the multiple passwords, all arranged in a row

like image 420
Nik Avatar asked Oct 11 '25 19:10

Nik


1 Answers

Like this:

$h =  7374726f6e6770617373776f7264403130

-join ($h -split '(..)' | ? { $_ } | % { [char][convert]::ToUInt32($_,16) })
like image 83
CB. Avatar answered Oct 14 '25 13:10

CB.