[Python-checkins] cpython: Keccak: fromBytesToWord() and fromWordToBytes() are required on 64bit big

christian.heimes python-checkins at python.org
Sun Oct 14 00:59:37 CEST 2012


http://hg.python.org/cpython/rev/3465ef48d0f5
changeset:   79715:3465ef48d0f5
user:        Christian Heimes <christian at cheimes.de>
date:        Sun Oct 14 00:59:29 2012 +0200
summary:
  Keccak: fromBytesToWord() and fromWordToBytes() are required on 64bit big endian platforms

files:
  Modules/_sha3/keccak/KeccakF-1600-opt64.c |  10 ++++++----
  1 files changed, 6 insertions(+), 4 deletions(-)


diff --git a/Modules/_sha3/keccak/KeccakF-1600-opt64.c b/Modules/_sha3/keccak/KeccakF-1600-opt64.c
--- a/Modules/_sha3/keccak/KeccakF-1600-opt64.c
+++ b/Modules/_sha3/keccak/KeccakF-1600-opt64.c
@@ -324,7 +324,7 @@
     KeccakPermutationOnWords((UINT64*)state);
 }
 
-/*
+#if (PLATFORM_BYTE_ORDER == IS_BIG_ENDIAN)
 static void fromBytesToWord(UINT64 *word, const UINT8 *bytes)
 {
     unsigned int i;
@@ -333,7 +333,8 @@
     for(i=0; i<(64/8); i++)
         *word |= (UINT64)(bytes[i]) << (8*i);
 }
-*/
+#endif
+
 
 #ifdef ProvideFast576
 static void KeccakAbsorb576bits(unsigned char *state, const unsigned char *data)
@@ -445,7 +446,7 @@
 #endif
 }
 
-/*
+#if (PLATFORM_BYTE_ORDER == IS_BIG_ENDIAN)
 static void fromWordToBytes(UINT8 *bytes, const UINT64 word)
 {
     unsigned int i;
@@ -453,7 +454,8 @@
     for(i=0; i<(64/8); i++)
         bytes[i] = (word >> (8*i)) & 0xFF;
 }
-*/
+#endif
+
 
 #ifdef ProvideFast1024
 static void KeccakExtract1024bits(const unsigned char *state, unsigned char *data)

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list