![]() |
|
[C#] [C#] Getting the HEX - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C#] [C#] Getting the HEX (/showthread.php?tid=396660) |
[C#] Getting the HEX - codepoet - May 1, 2010 Used to convert a byte array to its hex equivalent. Code public static string ByteToHexString(byte[] p)originally written by: RuE If You Like this tutorial,
please check out my other tutorials by clicking ==> here * - julian - May 1, 2010 Or maybe this: Code public static string ByteToHexString(byte[] bytes)Code Public Shared Function ByteToHexString(ByVal bytes() As Byte) As StringLinq is kinda ugly and confusing though IMHO. Or this: Code public static string ByteToHexString(byte[] bytes)Code Public Function ByteToHexString(ByVal bytes() As Byte) As String* - codepoet - May 1, 2010 thanks for translating * - julian - May 1, 2010 Argh - Interlocked.Increment... Here's another, in VB.Net: Code Public Function ByteToHexString(ByVal bytes() As Byte, Optional ByVal uppercase As Boolean = False, Optional ByVal seperator As String = Nothing) As StringThis one lets you say if you want caps, and if you want some separator (argh, I spelled separator wrong) string to appear between the hex digits. For example: Code Dim rand As New Randomoutput: 6bb0727eae52 6BB0727EAE52 6b, b0, 72, 7e, ae, 52 6b-b0-72-7e-ae-52 * - codepoet - May 1, 2010 thanks for the new function |