Exemplo n.º 1
0
int
main (void)
{
  u64 i = u64init (42, 4711);
  u64 j, k, l;

  j = u64hilo (42, 4711);

  if (u64lt (i, j) || u64lt (j, i))
    return 1;

  i = u64hilo (0, 42);
  j = u64hilo (0, 43);

  if (!u64lt (i, j))
    return 1;

  k = u64plus (i, j);
  l = u64hilo (0, 42 + 43);

  if (u64lt (k, l) || u64lt (l, k))
    return 1;

  return 0;
}
Exemplo n.º 2
0
void
sha384_init_ctx (struct sha512_ctx *ctx)
{
    ctx->state[0] = u64hilo (0xcbbb9d5d, 0xc1059ed8);
    ctx->state[1] = u64hilo (0x629a292a, 0x367cd507);
    ctx->state[2] = u64hilo (0x9159015a, 0x3070dd17);
    ctx->state[3] = u64hilo (0x152fecd8, 0xf70e5939);
    ctx->state[4] = u64hilo (0x67332667, 0xffc00b31);
    ctx->state[5] = u64hilo (0x8eb44a87, 0x68581511);
    ctx->state[6] = u64hilo (0xdb0c2e0d, 0x64f98fa7);
    ctx->state[7] = u64hilo (0x47b5481d, 0xbefa4fa4);

    ctx->total[0] = ctx->total[1] = u64lo (0);
    ctx->buflen = 0;
}
Exemplo n.º 3
0
/*
  Takes a pointer to a 512 bit block of data (eight 64 bit ints) and
  initializes it to the start constants of the SHA512 algorithm.  This
  must be called before using hash in the call to sha512_hash
*/
void
sha512_init_ctx (struct sha512_ctx *ctx)
{
    ctx->state[0] = u64hilo (0x6a09e667, 0xf3bcc908);
    ctx->state[1] = u64hilo (0xbb67ae85, 0x84caa73b);
    ctx->state[2] = u64hilo (0x3c6ef372, 0xfe94f82b);
    ctx->state[3] = u64hilo (0xa54ff53a, 0x5f1d36f1);
    ctx->state[4] = u64hilo (0x510e527f, 0xade682d1);
    ctx->state[5] = u64hilo (0x9b05688c, 0x2b3e6c1f);
    ctx->state[6] = u64hilo (0x1f83d9ab, 0xfb41bd6b);
    ctx->state[7] = u64hilo (0x5be0cd19, 0x137e2179);

    ctx->total[0] = ctx->total[1] = u64lo (0);
    ctx->buflen = 0;
}