Sha256.cpp   Sha256.cpp 
skipping to change at line 58 skipping to change at line 58
# include <stdint.h> # include <stdint.h>
# endif # endif
#endif #endif
#include <string.h> #include <string.h>
#include "Sha256.h" #include "Sha256.h"
#ifndef lint #ifndef lint
static const char rcsid[] = static const char rcsid[] =
"$Id: sha256.c 680 2003-07-25 21:57:49Z asaddi $"; "$Id: sha256.c 680 2003-07-25 21:57:49Z asaddi $";
#endif /* !lint */ #endif /* !lint */
#define ROTL(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) #define ROTL(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
#define ROTR(x, n) (((x) >> (n)) | ((x) << (32 - (n)))) #define ROTR(x, n) (((x) >> (n)) | ((x) << (32 - (n))))
#define Ch(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) #define Ch(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
#define Maj(x, y, z) (((x) & ((y) | (z))) | ((y) & (z))) #define Maj(x, y, z) (((x) & ((y) | (z))) | ((y) & (z)))
#define SIGMA0(x) (ROTR((x), 2) ^ ROTR((x), 13) ^ ROTR((x), 22)) #define SIGMA0(x) (ROTR((x), 2) ^ ROTR((x), 13) ^ ROTR((x), 22))
#define SIGMA1(x) (ROTR((x), 6) ^ ROTR((x), 11) ^ ROTR((x), 25)) #define SIGMA1(x) (ROTR((x), 6) ^ ROTR((x), 11) ^ ROTR((x), 25))
#define sigma0(x) (ROTR((x), 7) ^ ROTR((x), 18) ^ ((x) >> 3)) #define sigma0(x) (ROTR((x), 7) ^ ROTR((x), 18) ^ ((x) >> 3))
skipping to change at line 113 skipping to change at line 113
#ifndef RUNTIME_ENDIAN #ifndef RUNTIME_ENDIAN
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
#define BYTESWAP(x) (x) #define BYTESWAP(x) (x)
#define BYTESWAP64(x) (x) #define BYTESWAP64(x) (x)
#else /* WORDS_BIGENDIAN */ #else /* WORDS_BIGENDIAN */
#define BYTESWAP(x) ((ROTR((x), 8) & 0xff00ff00L) | \ #define BYTESWAP(x) ((ROTR((x), 8) & 0xff00ff00L) | \
(ROTL((x), 8) & 0x00ff00ffL)) (ROTL((x), 8) & 0x00ff00ffL))
#define BYTESWAP64(x) _byteswap64(x) #define BYTESWAP64(x) _byteswap64(x)
static inline uint64_t _byteswap64(uint64_t x) static inline uint64_t _byteswap64(uint64_t x)
{ {
uint32_t a = x >> 32; uint32_t a = x >> 32;
uint32_t b = (uint32_t) x; uint32_t b = (uint32_t) x;
return ((uint64_t) BYTESWAP(b) << 32) | (uint64_t) BYTESWAP(a); return ((uint64_t) BYTESWAP(b) << 32) | (uint64_t) BYTESWAP(a);
} }
#endif /* WORDS_BIGENDIAN */ #endif /* WORDS_BIGENDIAN */
#else /* !RUNTIME_ENDIAN */ #else /* !RUNTIME_ENDIAN */
#define BYTESWAP(x) _byteswap(sc->littleEndian, x) #define BYTESWAP(x) _byteswap(sc->littleEndian, x)
#define BYTESWAP64(x) _byteswap64(sc->littleEndian, x) #define BYTESWAP64(x) _byteswap64(sc->littleEndian, x)
#define _BYTESWAP(x) ((ROTR((x), 8) & 0xff00ff00L) | \ #define _BYTESWAP(x) ((ROTR((x), 8) & 0xff00ff00L) | \
(ROTL((x), 8) & 0x00ff00ffL)) (ROTL((x), 8) & 0x00ff00ffL))
#define _BYTESWAP64(x) __byteswap64(x) #define _BYTESWAP64(x) __byteswap64(x)
static inline uint64_t __byteswap64(uint64_t x) static inline uint64_t __byteswap64(uint64_t x)
{ {
uint32_t a = x >> 32; uint32_t a = x >> 32;
uint32_t b = (uint32_t) x; uint32_t b = (uint32_t) x;
return ((uint64_t) _BYTESWAP(b) << 32) | (uint64_t) _BYTESWAP(a); return ((uint64_t) _BYTESWAP(b) << 32) | (uint64_t) _BYTESWAP(a);
} }
static inline uint32_t _byteswap(int littleEndian, uint32_t x) static inline uint32_t _byteswap(int littleEndian, uint32_t x)
skipping to change at line 453 skipping to change at line 453
for (i = 0; i < SHA256_HASH_SIZE;) { for (i = 0; i < SHA256_HASH_SIZE;) {
printf ("%02x", hash[i++]); printf ("%02x", hash[i++]);
if (!(i % 4)) if (!(i % 4))
printf (" "); printf (" ");
} }
printf ("\n"); printf ("\n");
SHA256Init (&foo); SHA256Init (&foo);
SHA256Update (&foo, SHA256Update (&foo,
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
56); 56);
SHA256Final (&foo, hash); SHA256Final (&foo, hash);
for (i = 0; i < SHA256_HASH_SIZE;) { for (i = 0; i < SHA256_HASH_SIZE;) {
printf ("%02x", hash[i++]); printf ("%02x", hash[i++]);
if (!(i % 4)) if (!(i % 4))
printf (" "); printf (" ");
} }
printf ("\n"); printf ("\n");
SHA256Init (&foo); SHA256Init (&foo);
 End of changes. 4 change blocks. 
5 lines changed or deleted 5 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/