当前位置: 首页>>代码示例>>C++>>正文


C++ LOAD32L函数代码示例

本文整理汇总了C++中LOAD32L函数的典型用法代码示例。如果您正苦于以下问题:C++ LOAD32L函数的具体用法?C++ LOAD32L怎么用?C++ LOAD32L使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LOAD32L函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: noekeon_ecb_encrypt

void noekeon_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *key)
#endif
{
   unsigned long a,b,c,d,temp;
   int r;

   _ARGCHK(key != NULL);
   _ARGCHK(pt != NULL);
   _ARGCHK(ct != NULL);
   
   LOAD32L(a,&pt[0]); LOAD32L(b,&pt[4]);
   LOAD32L(c,&pt[8]); LOAD32L(d,&pt[12]);
   
#define ROUND(i) \
       a ^= RC[r+i]; \
       THETA(key->noekeon.K, a,b,c,d); \
       PI1(a,b,c,d); \
       GAMMA(a,b,c,d); \
       PI2(a,b,c,d);

   for (r = 0; r < 16; r += 2) {
       ROUND(0);
       ROUND(1);
   }

#undef ROUND

   a ^= RC[16];
   THETA(key->noekeon.K, a, b, c, d);
   
   STORE32L(a,&ct[0]); STORE32L(b,&ct[4]);
   STORE32L(c,&ct[8]); STORE32L(d,&ct[12]);
}
开发者ID:TheTypoMaster,项目名称:AH4222,代码行数:33,代码来源:noekeon.c

示例2: rc6_ecb_encrypt

int rc6_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey)
#endif
{
   ulong32 a,b,c,d,t,u, *K;
   int r;
   
   LTC_ARGCHK(skey != NULL);
   LTC_ARGCHK(pt   != NULL);
   LTC_ARGCHK(ct   != NULL);
   LOAD32L(a,&pt[0]);LOAD32L(b,&pt[4]);LOAD32L(c,&pt[8]);LOAD32L(d,&pt[12]);

   b += skey->rc6.K[0];
   d += skey->rc6.K[1];

#define RND(a,b,c,d) \
       t = (b * (b + b + 1)); t = ROLc(t, 5); \
       u = (d * (d + d + 1)); u = ROLc(u, 5); \
       a = ROL(a^t,u) + K[0];                \
       c = ROL(c^u,t) + K[1]; K += 2;   
    
   K = skey->rc6.K + 2;
   for (r = 0; r < 20; r += 4) {
       RND(a,b,c,d);
       RND(b,c,d,a);
       RND(c,d,a,b);
       RND(d,a,b,c);
   }
   
#undef RND

   a += skey->rc6.K[42];
   c += skey->rc6.K[43];
   STORE32L(a,&ct[0]);STORE32L(b,&ct[4]);STORE32L(c,&ct[8]);STORE32L(d,&ct[12]);
   return CRYPT_OK;
}
开发者ID:jamesyan84,项目名称:mt36k_android_4.0.4,代码行数:35,代码来源:rc6.c

示例3: rc6_ecb_decrypt

void rc6_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey)
#endif
{
   ulong32 a,b,c,d,t,u, *K;
   int r;

   LTC_ARGCHK(skey != NULL);
   LTC_ARGCHK(pt   != NULL);
   LTC_ARGCHK(ct   != NULL);
   
   LOAD32L(a,&ct[0]);LOAD32L(b,&ct[4]);LOAD32L(c,&ct[8]);LOAD32L(d,&ct[12]);
   a -= skey->rc6.K[42];
   c -= skey->rc6.K[43];
   
#define RND(a,b,c,d) \
       t = (b * (b + b + 1)); t = ROLc(t, 5); \
       u = (d * (d + d + 1)); u = ROLc(u, 5); \
       c = ROR(c - K[1], t) ^ u; \
       a = ROR(a - K[0], u) ^ t; K -= 2;
   
   K = skey->rc6.K + 40;
   
   for (r = 0; r < 20; r += 4) {
       RND(d,a,b,c);
       RND(c,d,a,b);
       RND(b,c,d,a);
       RND(a,b,c,d);
   }
   
#undef RND

   b -= skey->rc6.K[0];
   d -= skey->rc6.K[1];
   STORE32L(a,&pt[0]);STORE32L(b,&pt[4]);STORE32L(c,&pt[8]);STORE32L(d,&pt[12]);
}
开发者ID:tch-opensrc,项目名称:TC72XX_LxG1.7.1mp1_OpenSrc,代码行数:35,代码来源:rc6.c

示例4: rc5_ecb_encrypt

int rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey)
#endif
{
   ulong32 A, B, *K;
   int r;
   LTC_ARGCHK(skey != NULL);
   LTC_ARGCHK(pt   != NULL);
   LTC_ARGCHK(ct   != NULL);

   LOAD32L(A, &pt[0]);
   LOAD32L(B, &pt[4]);
   A += skey->rc5.K[0];
   B += skey->rc5.K[1];
   K  = skey->rc5.K + 2;
   
   if ((skey->rc5.rounds & 1) == 0) {
      for (r = 0; r < skey->rc5.rounds; r += 2) {
          A = ROL(A ^ B, B) + K[0];
          B = ROL(B ^ A, A) + K[1];
          A = ROL(A ^ B, B) + K[2];
          B = ROL(B ^ A, A) + K[3];
          K += 4;
      }
   } else {
      for (r = 0; r < skey->rc5.rounds; r++) {
          A = ROL(A ^ B, B) + K[0];
          B = ROL(B ^ A, A) + K[1];
          K += 2;
      }
   }
   STORE32L(A, &ct[0]);
   STORE32L(B, &ct[4]);

   return CRYPT_OK;
}
开发者ID:0omega,项目名称:platform_external_dropbear,代码行数:35,代码来源:rc5.c

示例5: noekeon_setup

int noekeon_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
{
   unsigned long temp;
   
   _ARGCHK(key != NULL);
   _ARGCHK(skey != NULL);
   
   if (keylen != 16) {
      return CRYPT_INVALID_KEYSIZE;
   }
   
   if (num_rounds != 16 && num_rounds != 0) {
      return CRYPT_INVALID_ROUNDS;
   }
   
   LOAD32L(skey->noekeon.K[0],&key[0]);
   LOAD32L(skey->noekeon.K[1],&key[4]);
   LOAD32L(skey->noekeon.K[2],&key[8]);
   LOAD32L(skey->noekeon.K[3],&key[12]);
   
   LOAD32L(skey->noekeon.dK[0],&key[0]);
   LOAD32L(skey->noekeon.dK[1],&key[4]);
   LOAD32L(skey->noekeon.dK[2],&key[8]);
   LOAD32L(skey->noekeon.dK[3],&key[12]);

   THETA(zero, skey->noekeon.dK[0], skey->noekeon.dK[1], skey->noekeon.dK[2], skey->noekeon.dK[3]);

   return CRYPT_OK;
}
开发者ID:TheTypoMaster,项目名称:AH4222,代码行数:29,代码来源:noekeon.c

示例6: IV

/**
  Set IV + counter data to the ChaCha state
  @param st      The ChaCha20 state
  @param iv      The IV data to add
  @param ivlen   The length of the IV (must be 12)
  @param counter 32bit (unsigned) initial counter value
  @return CRYPT_OK on success
 */
int chacha_ivctr32(chacha_state *st, const unsigned char *iv, unsigned long ivlen, ulong32 counter)
{
   LTC_ARGCHK(st != NULL);
   LTC_ARGCHK(iv != NULL);
   /* 96bit IV + 32bit counter */
   LTC_ARGCHK(ivlen == 12);

   st->input[12] = counter;
   LOAD32L(st->input[13], iv + 0);
   LOAD32L(st->input[14], iv + 4);
   LOAD32L(st->input[15], iv + 8);
   st->ksleft = 0;
   st->ivlen = ivlen;
   return CRYPT_OK;
}
开发者ID:FirebirdSQL,项目名称:firebird,代码行数:23,代码来源:chacha_ivctr32.c

示例7: XORWORD

static void XORWORD(ulong32 w, const unsigned char *in, unsigned char *out)
{
   ulong32 t;
   LOAD32L(t, in);
   t ^= w;
   STORE32L(t, out);
}
开发者ID:dyemanov,项目名称:firebird,代码行数:7,代码来源:sober128_stream.c

示例8: XORWORD

static void XORWORD(ulong32 w, unsigned char *b)
{
   ulong32 t;
   LOAD32L(t, b);
   t ^= w;
   STORE32L(t, b);
}
开发者ID:0omega,项目名称:platform_external_dropbear,代码行数:7,代码来源:sober128.c

示例9: rc5_ecb_encrypt

void rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *key)
#endif
{
   unsigned long A, B;
   int r;
   _ARGCHK(key != NULL);
   _ARGCHK(pt != NULL);
   _ARGCHK(ct != NULL);

   LOAD32L(A, &pt[0]);
   LOAD32L(B, &pt[4]);
   A += key->rc5.K[0];
   B += key->rc5.K[1];
   for (r = 0; r < key->rc5.rounds; r++) {
       A = ROL(A ^ B, B) + key->rc5.K[r+r+2];
       B = ROL(B ^ A, A) + key->rc5.K[r+r+3];
   }
   STORE32L(A, &ct[0]);
   STORE32L(B, &ct[4]);
}
开发者ID:TheTypoMaster,项目名称:AH4222,代码行数:20,代码来源:rc5.c

示例10: rc5_ecb_decrypt

void rc5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *key)
#endif
{
   unsigned long A, B;
   int r;
   _ARGCHK(key != NULL);
   _ARGCHK(pt != NULL);
   _ARGCHK(ct != NULL);

   LOAD32L(A, &ct[0]);
   LOAD32L(B, &ct[4]);
   for (r = key->rc5.rounds - 1; r >= 0; r--) {
       B = ROR(B - key->rc5.K[r+r+3], A) ^ A;
       A = ROR(A - key->rc5.K[r+r+2], B) ^ B;
   }
   A -= key->rc5.K[0];
   B -= key->rc5.K[1];
   STORE32L(A, &pt[0]);
   STORE32L(B, &pt[4]);
}
开发者ID:TheTypoMaster,项目名称:AH4222,代码行数:20,代码来源:rc5.c

示例11: rc6_ecb_encrypt

void rc6_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *key)
#endif
{
   unsigned long a,b,c,d,t,u;
   int r;
   
   _ARGCHK(key != NULL);
   _ARGCHK(pt != NULL);
   _ARGCHK(ct != NULL);
   LOAD32L(a,&pt[0]);LOAD32L(b,&pt[4]);LOAD32L(c,&pt[8]);LOAD32L(d,&pt[12]);
   b += key->rc6.K[0];
   d += key->rc6.K[1];
   for (r = 0; r < 20; r++) {
       t = (b * (b + b + 1)); t = ROL(t, 5);
       u = (d * (d + d + 1)); u = ROL(u, 5);
       a = ROL(a^t,u) + key->rc6.K[r+r+2];
       c = ROL(c^u,t) + key->rc6.K[r+r+3];
       t = a; a = b; b = c; c = d; d = t;
   }
   a += key->rc6.K[42];
   c += key->rc6.K[43];
   STORE32L(a,&ct[0]);STORE32L(b,&ct[4]);STORE32L(c,&ct[8]);STORE32L(d,&ct[12]);
}
开发者ID:TheTypoMaster,项目名称:AH4222,代码行数:23,代码来源:rc6.c

示例12: rc6_ecb_decrypt

void rc6_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *key)
#endif
{
   unsigned long a,b,c,d,t,u;
   int r;

   _ARGCHK(key != NULL);
   _ARGCHK(pt != NULL);
   _ARGCHK(ct != NULL);
   
   LOAD32L(a,&ct[0]);LOAD32L(b,&ct[4]);LOAD32L(c,&ct[8]);LOAD32L(d,&ct[12]);
   a -= key->rc6.K[42];
   c -= key->rc6.K[43];
   for (r = 19; r >= 0; r--) {
       t = d; d = c; c = b; b = a; a = t;
       t = (b * (b + b + 1)); t = ROL(t, 5);
       u = (d * (d + d + 1)); u = ROL(u, 5);
       c = ROR(c - key->rc6.K[r+r+3], t) ^ u;
       a = ROR(a - key->rc6.K[r+r+2], u) ^ t;
   }
   b -= key->rc6.K[0];
   d -= key->rc6.K[1];
   STORE32L(a,&pt[0]);STORE32L(b,&pt[4]);STORE32L(c,&pt[8]);STORE32L(d,&pt[12]);
}
开发者ID:TheTypoMaster,项目名称:AH4222,代码行数:24,代码来源:rc6.c

示例13: rc5_ecb_decrypt

int rc5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey)
#endif
{
   ulong32 A, B, *K;
   int r;
   LTC_ARGCHK(skey != NULL);
   LTC_ARGCHK(pt   != NULL);
   LTC_ARGCHK(ct   != NULL);

   LOAD32L(A, &ct[0]);
   LOAD32L(B, &ct[4]);
   K = skey->rc5.K + (skey->rc5.rounds << 1);
   
   if ((skey->rc5.rounds & 1) == 0) {
       K -= 2;
       for (r = skey->rc5.rounds - 1; r >= 0; r -= 2) {
          B = ROR(B - K[3], A) ^ A;
          A = ROR(A - K[2], B) ^ B;
          B = ROR(B - K[1], A) ^ A;
          A = ROR(A - K[0], B) ^ B;
          K -= 4;
        }
   } else {
      for (r = skey->rc5.rounds - 1; r >= 0; r--) {
          B = ROR(B - K[1], A) ^ A;
          A = ROR(A - K[0], B) ^ B;
          K -= 2;
      }
   }
   A -= skey->rc5.K[0];
   B -= skey->rc5.K[1];
   STORE32L(A, &pt[0]);
   STORE32L(B, &pt[4]);

   return CRYPT_OK;
}
开发者ID:0omega,项目名称:platform_external_dropbear,代码行数:36,代码来源:rc5.c

示例14: blake2s_init_param

/* init2 xors IV with input parameter block */
static int blake2s_init_param(hash_state *md, const unsigned char *P)
{
   unsigned long i;

   blake2s_init0(md);

   /* IV XOR ParamBlock */
   for (i = 0; i < 8; ++i) {
      ulong32 tmp;
      LOAD32L(tmp, P + i * 4);
      md->blake2s.h[i] ^= tmp;
   }

   md->blake2s.outlen = P[O_DIGEST_LENGTH];
   return CRYPT_OK;
}
开发者ID:libtom,项目名称:libtomcrypt,代码行数:17,代码来源:blake2s.c

示例15: blake2s_compress

static int blake2s_compress(hash_state *md, const unsigned char *buf)
#endif
{
   unsigned long i;
   ulong32 m[16];
   ulong32 v[16];

   for (i = 0; i < 16; ++i) {
      LOAD32L(m[i], buf + i * sizeof(m[i]));
   }

   for (i = 0; i < 8; ++i)
      v[i] = md->blake2s.h[i];

   v[8] = blake2s_IV[0];
   v[9] = blake2s_IV[1];
   v[10] = blake2s_IV[2];
   v[11] = blake2s_IV[3];
   v[12] = md->blake2s.t[0] ^ blake2s_IV[4];
   v[13] = md->blake2s.t[1] ^ blake2s_IV[5];
   v[14] = md->blake2s.f[0] ^ blake2s_IV[6];
   v[15] = md->blake2s.f[1] ^ blake2s_IV[7];

   ROUND(0);
   ROUND(1);
   ROUND(2);
   ROUND(3);
   ROUND(4);
   ROUND(5);
   ROUND(6);
   ROUND(7);
   ROUND(8);
   ROUND(9);

   for (i = 0; i < 8; ++i)
      md->blake2s.h[i] = md->blake2s.h[i] ^ v[i] ^ v[i + 8];

   return CRYPT_OK;
}
开发者ID:libtom,项目名称:libtomcrypt,代码行数:39,代码来源:blake2s.c


注:本文中的LOAD32L函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。