# encoding: ascii
# api: powershell
# title: Convert-ToCHexString
# description: Converts an input string into its C ASCI Hex equivalent, useful for converting a string into an unsigned char array
# version: 0.1
# type: function
# author: CrazyDave
# license: CC0
# function: Convert-ToCHexString
# x-poshcode-id: 1155
# x-derived-from-id: 4069
# x-archived: 2017-04-08T23:41:30
# x-published: 2010-06-10T13:24:00
#
#
function Convert-ToCHexString
{
param ([String] $str)
$ans = ''
[System.Text.Encoding]::ASCII.GetBytes($str) | % { $ans += "0x{0:X2}, " -f $_ }
return $ans.Trim(' ',',')
}