10 ms·
Hexyl: A command-line hex viewer with colorized output
- faitswulff 3y agoSharkdp is also responsible for some fantastic tools like hyperfine for micro benchmarking, fd for finding files, bat which is a colorized cat replacement and many more such utilities. https://github.com/sharkdp https://github.com/sharkdp is a real treasure trove of user-friendly CLI tools.
- 29athrowaway 3y agoburntsushi and sharkdp are the goats.
- TacticalCoder 3y agoAnd both are members of HN!
- BlackLotus89 3y agoWas looking at hexdump alternatives a week ago and between huxdemp (hxd), xxd, hx, hd (not the alias for hexdump -C) and hexdump this was my favourite. hx wasn't usable when parsing data streams... And clashes with helix (hx) On systems where I can't install anything I would just use hexdump -C or xxd
- denysvitali 3y agoI've created an xxd clone called xd: https://github.com/denysvitali/hexutils https://github.com/denysvitali/hexutils It just uses the same visualization but highlights the ASCII chars
- jbaber 3y agoHexyl's lovely and I copied its style for a hex editor. I don't understand why there are so many terminal hex viewers that don't edit.
- jmholla 3y agoWhat's your hex editor?
- some_random 3y agoI love hexyl, but the colorized output does get in the way sometimes when I'm copying out bytes
- Pr0ject217 3y agoJust out of curiosity (as I haven't needed to use a hex viewer/editor in web dev) - what use-cases are you using this for?
- some_random 3y agoReverse engineering!
- Pr0ject217 3y agoThat sounds fun ;) Was there a first project you did that got you hooked?
- some_random 3y agoGame hacking for sure, and it's still a blast. Playing around with variables in cheat engine or messing with save files is a fantastic way to get started as long as you stick to single player games (multiplayer cheating is way harder and usually unethical). https://cheatengine.org/ https://cheatengine.org/
- da39a3ee 3y agoCan you explain more? Copying with a mouse selection, of by piping into something? You shouldn't get ANSI escapes either way.
- camel-cdr 3y agoDoes it handle files larger than memory? I've been using dhex for that purpose.
- stusmall 3y agoI really like this tool for quick, easy debugging on binary files. okteta used to be my go to, but it's rare I need editing. I'm usually just take a quick look at the contents.
- Conscat 3y agoHexyl is what I love to use for quickly looking at a file. For slightly more serious introspection I use Emacs' hexl-mode, which also has basic editing capabilities.
- denysvitali 3y agoIf you want a true Hex Editor (or better, Hex IDE), I strongly suggest you to take a look ad ImHex [1]. [1]: https://github.com/WerWolv/ImHex https://github.com/WerWolv/ImHex
- cxr 3y agoImHex indeed looks very featureful and has a pleasant layout, but it's hard not to recognize the perverseness of a the slogan "A Hex Editor" built for those "who value their retinas when working at 3 AM" being applied to an app centered around putting text on the screen but that insists on tiny font sizes and no anti-aliasing...
- panzi 3y agoIt looks amazing, but I couldn't get it to run. Binary was linked to a lib that's not on my system, and when compiled from source it just crashes with a bad cast.
- dang 3y agoRelated: Hexyl: A command-line hex viewer - https://news.ycombinator.com/item?id=18865264 https://news.ycombinator.com/item?id=18865264 - Jan 2019 (113 comments)
- WalterBright 3y agoHere's mine, from 1986 or so. I still use it all the time: #include <stdio.h> #define O1O printf #define OlO putchar #define O10 exit #define Ol0 strlen #define QLQ fopen #define OlQ fgetc #define O1Q abs #define QO0 for typedef char lOL; lOL*QI[] = {"Use:\012\011dump file\012","Unable to open file '\x25s'\012", "\012"," ",""}; main(I,Il) lOL*Il[]; { FILE *L; unsigned lO; int Q,OL[' '^'0'],llO = EOF, O=1,l=0,lll=O+O+O+l,OQ=056; lOL*llL="%2x "; (I != 1<<1&&(O1O(QI[0]),O10(1011-1010))), ((L = QLQ(Il[O],"r"))==0&&(O1O(QI[O],Il[O]),O10(O))); lO = I-(O<<l<<O); while (L-l,1) { QO0(Q = 0L;((Q &~(0x10-O))== l); OL[Q++] = OlQ(L)); if (OL[0]==llO) break; O1O("\0454x: ",lO); if (I == (1<<1)) { QO0(Q=Ol0(QI[O<<O<<1]);Q<Ol0(QI[0]); Q++)O1O((OL[Q]!=llO)?llL:QI[lll],OL[Q]);/*" O10(QI[1O])*/ O1O(QI[lll]);{} } QO0 (Q=0L;Q<1<<1<<1<<1<<1;Q+=Q<0100) { (OL[Q]!=llO)? /* 0010 10lOQ 000LQL */ ((D(OL[Q])==0&&(*(OL+O1Q(Q-l))=OQ)), OlO(OL[Q])): OlO(1<<(1<<1<<1)<<1); } O1O(QI[01^10^9]); lO+=Q+0+l;} } D(l) { return l>=' '&&l<='\~'; } I do like the colorized output of hexyl, though.
- cornstalks 3y agoWas this for an obfuscated C challenge?
- pmoriarty 3y agoHere's how Claude+[1] explained it: This program appears to be a hexadecimal dump utility. It does the following: - It takes a filename as a command line argument and opens that file for reading - It reads the file byte by byte until EOF - For each byte, it prints the hexadecimal value of the byte, in the format "%2x " (i.e. 2 hex digits, a space) - After every 16 bytes, it prints the ASCII representation of those bytes, replacing non-printable characters with "." - It also has some obfuscated logic with bitwise operations, likely attempting to confuse the reader. So if you ran it like this: ./program myfile.txt It would output something like: 54 65 78 74 20 66 69 6c 65 2e 0a 54 68 69 73 20 69 73 20 61 20 74 65 78 74 20 66 69 6c 65 2e 0a 54 68 65 20 71 75 69 63 6b 20 62 72 6f 77 6e 20 66 6f 78 0a 6a 75 6d 70 73 20 6f 76 65 72 20 20 74 68 65 20 6c 61 7a 79 20 64 6f 67 0a 2e 2e 2e Which is the hexadecimal dump of the ASCII contents of myfile.txt. The #defines are used to obfuscate the code and make it harder to read, replacing printf with O1O, putchar with OlO, etc. The D() function is used to check if a byte is a printable ASCII character. So in summary, this program opens a file, reads it byte by byte, prints the hex values, and prints the ASCII for printable characters, as a hexadecimal dump utility. [1] - https://poe.com/Claude%2B https://poe.com/Claude%2B
- chx 3y agoStrongly related: is there a hex viewer where I can set , preferably on-the-fly or with a command line switch record delimiters so it colors the records?
- naikrovek 3y agohow many different record separators do you have? ImHex may be useful to you if you only have a few. You can write a pattern file which parses the whole file and displays everything, if you want.
- chx 3y agoMy, that is very useful. I have been out of the bit land for a very, very long time -- the last of my assembly programs are old enough to drink -- but I am increasingly finding myself running hexdump again and it's not a great experience. I expected better in 2023 and here it is. I will explore but https://github.com/WerWolv/ImHex/blob/c2e023f567d4e838ea69e6e59f84fb1935a84cf4/tests/helpers/source/file.cpp#L46 https://github.com/WerWolv/ImHex/blob/c2e023f567d4e838ea69e6... this makes me super-duper hopeful. UTF-8 capable ex viewer, that'd be handy.
- CodeWriter23 3y agoWhen I was coming up, we didn’t have no dashed lines dividing the displays into 8-byte segments. And color? Everything was orange text on black. If you wanted green on black, you used a coworker’s terminal.
- deleted 3y ago[deleted]
- fuzztester 3y agoI've used the XVI32 hex editor for Windows in the past. Written in Delphi. Split pane. Useful app. Free.
- deleted 3y ago[deleted]
- fuzztester 3y agoGet it here: http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.h http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.h... Just looked at it again. Has a lot of good features and positive comments. Including, "even used by Microsoft".
- flomo 3y agofyi, your link is broken
- Pathogen-David 3y agoProper link here: http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.h... I also use XVI32. It's honestly probably not the best hex editor out there anymore, but I've been using it for well over a decade now and I'm used to its quirks.
- fuzztester 3y agoThanks for sharing the right link. Yes. I've not used it a lot myself, because my work then did not involve a lot of hex editing, just occassional. Good to know.
- fuzztester 3y agooccasional
- fuzztester 3y ago
- crabbone 3y agoWhy would you need a separate binary viewer / editor? This reminds me the absurd, but somehow common situation where Java programmers in my office used IntelliJ IDEA to write Java, but Notepad++ to view logs or edit INI files etc.
- anamexis 3y agoSeparate from what?
- crabbone 3y agoIf you are a programmer, you are already using an editor. Who besides programmers needs to see hex dump of a file?
- deleted 3y ago[deleted]
- Aaron2222 3y agoSysadmins? Programmers who don't have their editor open and just need to quickly look at the contents of a file?
- crabbone 3y agoThere aren't sysadmins today who aren't programmers. > Programmers who don't have their editor open Well... these aren't programmers. Maybe "aspiring programmers", as in someone who still have to learn how to use their computer. It's not anyone who would be considered a competent user.
- anamexis 3y agoWhat are you talking about? I use cat and less all the time when I'm working in the console. No need to switch tools when I want to take a quick look at the file.
- 3y ago
- AdieuToLogic 3y agoSee also: xxd[0] 0 - https://man.freebsd.org/cgi/man.cgi?query=xxd&apropos=0&sektion=0&manpath=FreeBSD+13.2-RELEASE+and+Ports&arch=default&format=html https://man.freebsd.org/cgi/man.cgi?query=xxd&apropos=0&sekt...
- VikingCoder 3y agoMakes me fondly remember XTree...
- panzi 3y agoCool idea with the color! But for my needs the hex viewer that I've wrote works best. I need those number displays at the bottom and an easy way to go to relative and absolute offsets. See the screenshot at the bottom: https://github.com/panzi/rust-hox https://github.com/panzi/rust-hox
- vram22 3y ago$ od -cx file or $ other_command_or_pipeline | od -cx is from early versions of Unix. Prints both character and hexadecimal representation of each byte in the input. $ man od