On Mon, Aug 19, 2013 at 6:54 AM, Alan Gutierrez <a...@prettyrobots.com> wrote:
> I'm implementing a collection of non-cryptographic hash algorithms for use in
> tables and data verity in pure-JavaScript with native counterparts.
>
>     https://github.com/bigeasy/hash
>
> The hashes I've implemented so far produce keys that are a multiple of 32-bit,
> where each 32-bits represents a register in hash algorithm, much like SHA1.
>
> I assume that when encoded to hex, big-endian is the correct endianness for 
> each
> register. From what I can see, sha1 encodes it's buffer with the same 
> endianness
> as it's hex string representation, so I assume that means that the buffer is
> encoded as big endian. Does anyone know for certain?

I haven't checked but I'm reasonably sure that OpenSSL uses big-endian
internally.  The generated x64 assembly contains a lot of byte swaps,
which is a pretty strong indicator.

Node.js doesn't care either way, however.  When it encodes the binary
result to hexadecimal, it does so on a byte-by-byte basis.

> Now that I'm developing native implementations on my Intel machine, the 
> outcome
> is always little endian. Should I convert my 32-bit words to big-endian before
> converting them to a `Buffer`?
>
> Also, while I'm at it, what big-endian hardware does Node.js run on at the
> moment? Did the port to MIPs ever happen? Anyone running Node.js on an ARM in
> big-endian mode? Any past dicussions in Node.js land of endianness and woe?

The MIPS port exists (and works) but it only runs in little-endian
mode.  Same for ARM, by the way.

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to