Created
October 23, 2020 21:34
-
-
Save passthehashbrowns/e860a590681484c0125520c696892a55 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Text; | |
namespace convertfile | |
{ | |
public static class Program | |
{ | |
static void Main(string[] args) | |
{ | |
byte[] fileBytes = File.ReadAllBytes(args[0]); | |
string results = @"\x" + BitConverter.ToString(fileBytes); | |
results.Replace("-", string.Empty); | |
Console.WriteLine(results.Replace("-", @"\x")); | |
} | |
public static string ByteArrayToString(byte[] ba) | |
{ | |
StringBuilder hex = new StringBuilder(ba.Length * 2); | |
foreach (byte b in ba) | |
hex.AppendFormat("{0:x2}", b); | |
return hex.ToString(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment