Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Binary in "big endian" representation

Reply
Thread Tools

Binary in "big endian" representation

 
 
David B.
Guest
Posts: n/a
 
      04-20-2008
Hello,

I would like to convert an input (like a file, or a password) into
binary format. After reading my Ruby in a nutshell book, I belive I can
use this method:
unpack('C*')

But do the binary representation will respect the big endian convention?

Thank you.

David
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
David A. Black
Guest
Posts: n/a
 
      04-21-2008
Hi --

On Mon, 21 Apr 2008, David B. wrote:

> Hello,
>
> I would like to convert an input (like a file, or a password) into
> binary format. After reading my Ruby in a nutshell book, I belive I can
> use this method:
> unpack('C*')
>
> But do the binary representation will respect the big endian convention?


I can't quite picture what you want the result to be. unpack will give
you an array. Did you want to do something with that?

I'll add that pack and unpack have a bunch of endian-specific
arguments, and also there's the BitStruct package by Joel VanderWerf
(http://redshift.sourceforge.net/bit-struct/ I think is where it still
lives) which might help you out.


David

--
Rails training from David A. Black and Ruby Power and Light:
INTRO TO RAILS June 9-12 Berlin
ADVANCING WITH RAILS June 16-19 Berlin
INTRO TO RAILS June 24-27 London (Skills Matter)
See http://www.rubypal.com for details and updates!

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Binary data representation Charles T. C++ 11 02-05-2004 04:06 PM
print format for binary representation Rim Python 3 01-27-2004 08:31 PM
Re: Converting integer to binary representation Mark Dufour Python 5 12-18-2003 05:28 AM
Re: Converting integer to binary representation Harry George Python 1 12-16-2003 02:48 PM
Converting integer to binary representation Mark Dufour Python 0 12-16-2003 02:26 PM



Advertisments