SHA1 algorithm -- fully portable

Discussion in 'C Programming' started by Tomás Ó hÉilidhe, Mar 24, 2008.

  1. I've come across a few implementations of the algorithm but none of
    them have been fully-portable.

    Particularly, I'm looking for an algorithm that doesn't make
    assumptions on:
    1) Byte order (e.g. big-endian Vs little-endian).
    2) The size of any of the integer types.
    3) The presence or lack of padding in any of the integer types.

    If someone has a fully-portable implementation of the algorithm I'd be
    very appreciative if you could post it here, or give me a link, or
    perhaps mail it to me:
    tKoe AT lavKabit DOT cKom (remove the K's)

    Failing that, if someone could point me to a very-well written
    implementation of the algorithm that I can edit myself then I'd be
    appreciative.
     
    Tomás Ó hÉilidhe, Mar 24, 2008
    #1
    1. Advertising

  2. Tomás Ó hÉilidhe

    Guest

    On Mar 24, 9:43 am, Tomás Ó hÉilidhe <> wrote:
    > I've come across a few implementations of the algorithm but none of
    > them have been fully-portable.
    >
    > Particularly, I'm looking for an algorithm that doesn't make
    > assumptions on:
    > 1) Byte order (e.g. big-endian Vs little-endian).
    > 2) The size of any of the integer types.
    > 3) The presence or lack of padding in any of the integer types.
    >
    > If someone has a fully-portable implementation of the algorithm I'd be
    > very appreciative if you could post it here, or give me a link, or
    > perhaps mail it to me:
    > tKoe AT lavKabit DOT cKom (remove the K's)
    >
    > Failing that, if someone could point me to a very-well written
    > implementation of the algorithm that I can edit myself then I'd be
    > appreciative.


    http://rafb.net/p/vOSU0M89.html
    Should be portable, but I don't have a nine-bit-byte
    machine to test (nor did I test it much on what I have).
    It is not very-well written, but that wasn't a goal :)

    Regards,
    Yevgen
     
    , Mar 24, 2008
    #2
    1. Advertising

  3. Tomás Ó hÉilidhe

    user923005 Guest

    On Mar 24, 7:43 am, Tomás Ó hÉilidhe <> wrote:
    > I've come across a few implementations of the algorithm but none of
    > them have been fully-portable.
    >
    > Particularly, I'm looking for an algorithm that doesn't make
    > assumptions on:
    > 1) Byte order (e.g. big-endian Vs little-endian).
    > 2) The size of any of the integer types.
    > 3) The presence or lack of padding in any of the integer types.
    >
    > If someone has a fully-portable implementation of the algorithm I'd be
    > very appreciative if you could post it here, or give me a link, or
    > perhaps mail it to me:
    >     tKoe AT lavKabit DOT cKom  (remove the K's)
    >
    > Failing that, if someone could point me to a very-well written
    > implementation of the algorithm that I can edit myself then I'd be
    > appreciative.


    Did you try news:sci.crypt
    ?

    Follow-up added.
     
    user923005, Mar 24, 2008
    #3

  4. > http://rafb.net/p/vOSU0M89.html
    > Should be portable, but I don't have a nine-bit-byte
    > machine to test (nor did I test it much on what I have).
    > It is not very-well written, but that wasn't a goal :)
    >
    > Regards,
    > Yevgen



    Thanks Yevgen, but the link appears to be broken.
     
    Tomás Ó hÉilidhe, Mar 25, 2008
    #4
  5. Tomás Ó hÉilidhe

    Bill Reid Guest

    Tomás Ó hÉilidhe <> wrote in message
    news:...
    >
    > I've come across a few implementations of the algorithm but none of
    > them have been fully-portable.
    >
    > Particularly, I'm looking for an algorithm that doesn't make
    > assumptions on:
    > 1) Byte order (e.g. big-endian Vs little-endian).
    > 2) The size of any of the integer types.
    > 3) The presence or lack of padding in any of the integer types.


    No guarantees about the above, but have you seen the following
    (I noticed this when I was answering another question here about
    large-scale open source "C" projects:

    http://lxr.linux.no/linux/lib/sha1.c

    > If someone has a fully-portable implementation of the algorithm I'd be
    > very appreciative if you could post it here, or give me a link, or
    > perhaps mail it to me:
    > tKoe AT lavKabit DOT cKom (remove the K's)
    >
    > Failing that, if someone could point me to a very-well written
    > implementation of the algorithm that I can edit myself then I'd be
    > appreciative.


    Again, no guarantees about this...who know if it even works on
    Torvalds' Timex Sinclair...

    ---
    William Ernest Reid
     
    Bill Reid, Mar 27, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Martin Hvidberg (DMU)

    Q: sha1 algorithm .dll or source ?

    Martin Hvidberg (DMU), Aug 18, 2004, in forum: C Programming
    Replies:
    0
    Views:
    337
    Martin Hvidberg (DMU)
    Aug 18, 2004
  2. Martin Hvidberg (DMU)

    Q: sha1 algorithm .dll or source ?

    Martin Hvidberg (DMU), Aug 18, 2004, in forum: C Programming
    Replies:
    0
    Views:
    354
    Martin Hvidberg (DMU)
    Aug 18, 2004
  3. ed

    portable sha1 hmac sources

    ed, Apr 6, 2006, in forum: C Programming
    Replies:
    2
    Views:
    355
    William Ahern
    Apr 8, 2006
  4. LMZ
    Replies:
    5
    Views:
    565
    Martin v. Löwis
    Apr 6, 2008
  5. Adam Tauno Williams
    Replies:
    2
    Views:
    887
    Stefan Behnel
    Dec 30, 2010
Loading...

Share This Page