Upgrade netcat a lot. Make -e able to take the rest of the command line as
[oweals/busybox.git] / libbb / sha1.c
index f0d952f84a14299cd909d6297e715d21ecc059e3..ea4da24748bc2f06c41bbfe7c6d18e1d741bc16a 100644 (file)
@@ -1,3 +1,4 @@
+/* vi: set sw=4 ts=4: */
 /*
  *  Based on shasum from http://www.netsw.org/crypto/hash/
  *  Majorly hacked up to use Dr Brian Gladman's sha1 code
@@ -6,30 +7,8 @@
  *  Copyright (C) 2003 Glenn L. McGrath
  *  Copyright (C) 2003 Erik Andersen
  *  
- *  LICENSE TERMS
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
  *
- *  The free distribution and use of this software in both source and binary
- *  form is allowed (with or without changes) provided that:
- *
- *    1. distributions of this source code include the above copyright
- *       notice, this list of conditions and the following disclaimer;
- *
- *    2. distributions in binary form include the above copyright
- *       notice, this list of conditions and the following disclaimer
- *       in the documentation and/or other associated materials;
- *
- *    3. the copyright holder's name is not used to endorse products
- *       built using this software without specific written permission.
- *
- *  ALTERNATIVELY, provided that this notice is retained in full, this product
- *  may be distributed under the terms of the GNU General Public License (GPL),
- *  in which case the provisions of the GPL apply INSTEAD OF those given above.
- *
- *  DISCLAIMER
- *
- *  This software is provided 'as is' with no explicit or implied warranties
- *  in respect of its properties, including, but not limited to, correctness
- *  and/or fitness for purpose.
  *  ---------------------------------------------------------------------------
  *  Issue Date: 10/11/2002
  *
@@ -45,7 +24,7 @@
 #include <string.h>
 #include <unistd.h>
 
-#include "busybox.h"
+#include "libbb.h"
 
 # define SHA1_BLOCK_SIZE  64
 # define SHA1_DIGEST_SIZE 20
@@ -147,13 +126,13 @@ void sha1_hash(const void *data, size_t length, sha1_ctx_t *ctx)
 void *sha1_end(void *resbuf, sha1_ctx_t *ctx)
 {
        /* SHA1 Final padding and digest calculation  */
-       #if BB_BIG_ENDIAN
-               static uint32_t mask[4] = { 0x00000000, 0xff000000, 0xffff0000, 0xffffff00 };
-               static uint32_t bits[4] = { 0x80000000, 0x00800000, 0x00008000, 0x00000080 };
-       #else
-               static uint32_t mask[4] = { 0x00000000, 0x000000ff, 0x0000ffff, 0x00ffffff };
-               static uint32_t bits[4] = { 0x00000080, 0x00008000, 0x00800000, 0x80000000 };
-       #endif /* __BYTE_ORDER */
+#if BB_BIG_ENDIAN
+       static uint32_t mask[4] = { 0x00000000, 0xff000000, 0xffff0000, 0xffffff00 };
+       static uint32_t bits[4] = { 0x80000000, 0x00800000, 0x00008000, 0x00000080 };
+#else
+       static uint32_t mask[4] = { 0x00000000, 0x000000ff, 0x0000ffff, 0x00ffffff };
+       static uint32_t bits[4] = { 0x00000080, 0x00008000, 0x00800000, 0x80000000 };
+#endif
 
        uint8_t *hval = resbuf;
        uint32_t i, cnt = (uint32_t) (ctx->count[0] & SHA1_MASK);