Hello, how can I display an image as hexcode? I want to have the same Hex-Code, that I get when I open the image in a Hex-Editor... Regards Adriana
on 2012-11-03 22:16
on 2012-11-03 22:54
On Sat, Nov 3, 2012 at 10:16 PM, Adriana Mikolaskova <lists@ruby-forum.com> wrote: > Hello, > > how can I display an image as hexcode? I want to have the same Hex-Code, > that I get when I open the image in a Hex-Editor... If you can read the file as strings, you can show each byte of the string as hex like this: 1.9.2p290 :005 > " abc".each_byte {|x| puts x.to_s(16)} 20 61 62 63 Jesus.
on 2012-11-03 23:21
Adriana Mikolaskova wrote in post #1082665: > Hello, > > how can I display an image as hexcode? I want to have the same Hex-Code, > that I get when I open the image in a Hex-Editor... bin = File.read("foo.jpg") hex = bin.unpack("H*").first puts hex
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.
