Need a good hex editor for Linux [closed]

Bless is a high quality, full featured hex editor. It is written in mono/Gtk# and its primary platform is GNU/Linux. However it should be able to run without problems on every platform that mono and Gtk# run. Bless currently provides the following features: Efficient editing of large data files and block devices. Multilevel undo – … Read more

Convert a string representation of a hex dump to a byte array using Java?

Update (2021) – Java 17 now includes java.util.HexFormat (only took 25 years): HexFormat.of().parseHex(s) For older versions of Java: Here’s a solution that I think is better than any posted so far: /* s must be an even-length string. */ public static byte[] hexStringToByteArray(String s) { int len = s.length(); byte[] data = new byte[len / … Read more

Why are hexadecimal numbers prefixed with 0x?

Short story: The 0 tells the parser it’s dealing with a constant (and not an identifier/reserved word). Something is still needed to specify the number base: the x is an arbitrary choice. Long story: In the 60’s, the prevalent programming number systems were decimal and octal — mainframes had 12, 24 or 36 bits per … Read more

Convert integer to hexadecimal and back again

// Store integer 182 int intValue = 182; // Convert integer 182 as a hex in a string variable string hexValue = intValue.ToString(“X”); // Convert the hex string back to the number int intAgain = int.Parse(hexValue, System.Globalization.NumberStyles.HexNumber); from http://www.geekpedia.com/KB8_How-do-I-convert-from-decimal-to-hex-and-hex-to-decimal.html HINT (from the comments): Use .ToString(“X4”) to get exactly 4 digits with leading 0, or .ToString(“x4”) … Read more

RGB to hex and hex to RGB

Note: both versions of rgbToHex expect integer values for r, g and b, so you’ll need to do your own rounding if you have non-integer values. The following will do to the RGB to hex conversion and add any required zero padding: function componentToHex(c) { var hex = c.toString(16); return hex.length == 1 ? “0” … Read more

How to convert a byte array to a hex string in Java?

From the discussion here, and especially this answer, this is the function I currently use: private static final char[] HEX_ARRAY = “0123456789ABCDEF”.toCharArray(); public static String bytesToHex(byte[] bytes) { char[] hexChars = new char[bytes.length * 2]; for (int j = 0; j < bytes.length; j++) { int v = bytes[j] & 0xFF; hexChars[j * 2] = … Read more

Convert hex string to integer in Python

Without the 0x prefix, you need to specify the base explicitly, otherwise there’s no way to tell: x = int(“deadbeef”, 16) With the 0x prefix, Python can distinguish hex and decimal automatically: >>> print(int(“0xdeadbeef”, 0)) 3735928559 >>> print(int(“10”, 0)) 10 (You must specify 0 as the base in order to invoke this prefix-guessing behavior; if … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)