summaryrefslogtreecommitdiff
path: root/ext/sha1/sha1.c
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-05-16 22:14:01 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-05-16 22:14:01 +0000
commitca841613cd3a161c4d5744952d50b415b705cea5 (patch)
tree239838d1ef769be5fa391cd8dcafde7fbc6fe6e2 /ext/sha1/sha1.c
parent5348fd7d4afcc2ff5e3dba1bddc9fa50a3fb6ddd (diff)
* ext/sha1/extconf.rb, ext/sha1/sha1.c: use WORDS_BIGENDIAN to
detect the platform's endian. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/sha1/sha1.c')
-rw-r--r--ext/sha1/sha1.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/ext/sha1/sha1.c b/ext/sha1/sha1.c
index afcc297cb4..f6f9fa88f2 100644
--- a/ext/sha1/sha1.c
+++ b/ext/sha1/sha1.c
@@ -12,7 +12,6 @@ A million repetitions of "a"
34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
*/
-/* #define LITTLE_ENDIAN * This should be #define'd if true. */
/* #define SHA1HANDSOFF * Copies data before messing with it. */
#include "sha1.h"
@@ -21,11 +20,11 @@ A million repetitions of "a"
/* blk0() and blk() perform the initial expand. */
/* I got the idea of expanding during the round function from SSLeay */
-#ifdef LITTLE_ENDIAN
+#ifdef WORDS_BIGENDIAN
+#define blk0(i) block->l[i]
+#else /* LITTLE ENDIAN */
#define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
|(rol(block->l[i],8)&0x00FF00FF))
-#else
-#define blk0(i) block->l[i]
#endif
#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
^block->l[(i+2)&15]^block->l[i&15],1))