本文整理汇总了C++中c2l函数的典型用法代码示例。如果您正苦于以下问题:C++ c2l函数的具体用法?C++ c2l怎么用?C++ c2l使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了c2l函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: DES_ede3_cfb_encrypt
void DES_ede3_cfb_encrypt(const unsigned char *in, unsigned char *out,
int numbits, long length, DES_key_schedule *ks1,
DES_key_schedule *ks2, DES_key_schedule *ks3,
DES_cblock *ivec, int enc)
{
DES_LONG d0, d1, v0, v1;
unsigned long l = length, n = ((unsigned int)numbits + 7) / 8;
int num = numbits, i;
DES_LONG ti[2];
unsigned char *iv;
unsigned char ovec[16];
if (num > 64)
return;
iv = &(*ivec)[0];
c2l(iv, v0);
c2l(iv, v1);
if (enc) {
while (l >= n) {
l -= n;
ti[0] = v0;
ti[1] = v1;
DES_encrypt3(ti, ks1, ks2, ks3);
c2ln(in, d0, d1, n);
in += n;
d0 ^= ti[0];
d1 ^= ti[1];
l2cn(d0, d1, out, n);
out += n;
/*
* 30-08-94 - eay - changed because l>>32 and l<<32 are bad under
* gcc :-(
*/
if (num == 32) {
v0 = v1;
v1 = d0;
} else if (num == 64) {
v0 = d0;
v1 = d1;
} else {
iv = &ovec[0];
l2c(v0, iv);
l2c(v1, iv);
l2c(d0, iv);
l2c(d1, iv);
/* shift ovec left most of the bits... */
memmove(ovec, ovec + num / 8, 8 + (num % 8 ? 1 : 0));
/* now the remaining bits */
if (num % 8 != 0)
for (i = 0; i < 8; ++i) {
ovec[i] <<= num % 8;
ovec[i] |= ovec[i + 1] >> (8 - num % 8);
}
iv = &ovec[0];
c2l(iv, v0);
c2l(iv, v1);
}
}
} else {
while (l >= n) {
开发者ID:Xiaodingdangguaiguai,项目名称:catboost,代码行数:60,代码来源:cfb64ede.c
示例2: DES_ede3_cfb64_encrypt
/* The input and output encrypted as though 64bit cfb mode is being used. The
* extra state information to record how much of the 64bit block we have used
* is contained in *num; */
void DES_ede3_cfb64_encrypt(const uint8_t *in, uint8_t *out,
long length, DES_key_schedule *ks1,
DES_key_schedule *ks2, DES_key_schedule *ks3,
DES_cblock *ivec, int *num, int enc) {
uint32_t v0, v1;
long l = length;
int n = *num;
uint32_t ti[2];
uint8_t *iv, c, cc;
iv = ivec->bytes;
if (enc) {
while (l--) {
if (n == 0) {
c2l(iv, v0);
c2l(iv, v1);
ti[0] = v0;
ti[1] = v1;
DES_encrypt3(ti, ks1, ks2, ks3);
v0 = ti[0];
v1 = ti[1];
iv = ivec->bytes;
l2c(v0, iv);
l2c(v1, iv);
iv = ivec->bytes;
}
c = *(in++) ^ iv[n];
*(out++) = c;
iv[n] = c;
n = (n + 1) & 0x07;
}
} else {
while (l--) {
if (n == 0) {
c2l(iv, v0);
c2l(iv, v1);
ti[0] = v0;
ti[1] = v1;
DES_encrypt3(ti, ks1, ks2, ks3);
v0 = ti[0];
v1 = ti[1];
iv = ivec->bytes;
l2c(v0, iv);
l2c(v1, iv);
iv = ivec->bytes;
}
cc = *(in++);
c = iv[n];
iv[n] = cc;
*(out++) = c ^ cc;
n = (n + 1) & 0x07;
}
}
v0 = v1 = ti[0] = ti[1] = c = cc = 0;
*num = n;
}
开发者ID:ThomasWo,项目名称:proto-quic,代码行数:63,代码来源:cfb64ede.c
示例3: des_ecb3_encrypt
void
des_ecb3_encrypt(des_cblock (*input), des_cblock (*output),
des_key_schedule ks1, des_key_schedule ks2, des_key_schedule ks3,
int encrypt)
{
register u_int32_t l0, l1;
register unsigned char *in, *out;
u_int32_t ll[2];
in = (unsigned char *) input;
out = (unsigned char *) output;
c2l(in, l0);
c2l(in, l1);
IP(l0, l1);
ll[0] = l0;
ll[1] = l1;
des_encrypt2(ll, ks1, encrypt);
des_encrypt2(ll, ks2, !encrypt);
des_encrypt2(ll, ks3, encrypt);
l0 = ll[0];
l1 = ll[1];
FP(l1, l0);
l2c(l0, out);
l2c(l1, out);
}
开发者ID:SylvestreG,项目名称:bitrig,代码行数:25,代码来源:ecb3_enc.c
示例4: des_cfb_encrypt
/* The input and output are loaded in multiples of 8 bits.
* What this means is that if you hame numbits=12 and length=2
* the first 12 bits will be retrieved from the first byte and half
* the second. The second 12 bits will come from the 3rd and half the 4th
* byte.
*/
void des_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits,
long length, des_key_schedule schedule, des_cblock *ivec, int enc)
{
register DES_LONG d0,d1,v0,v1,n=(numbits+7)/8;
register DES_LONG mask0,mask1;
register unsigned long l=length;
register int num=numbits;
DES_LONG ti[2];
unsigned char *iv;
if (num > 64) return;
if (num > 32)
{
mask0=0xffffffffL;
if (num == 64)
mask1=mask0;
else mask1=(1L<<(num-32))-1;
}
else
{
if (num == 32)
mask0=0xffffffffL;
else mask0=(1L<<num)-1;
mask1=0x00000000L;
}
iv = &(*ivec)[0];
c2l(iv,v0);
c2l(iv,v1);
if (enc)
{
while (l >= n)
{
l-=n;
ti[0]=v0;
ti[1]=v1;
des_encrypt((DES_LONG *)ti,schedule,DES_ENCRYPT);
c2ln(in,d0,d1,n);
in+=n;
d0=(d0^ti[0])&mask0;
d1=(d1^ti[1])&mask1;
l2cn(d0,d1,out,n);
out+=n;
/* 30-08-94 - eay - changed because l>>32 and
* l<<32 are bad under gcc :-( */
if (num == 32)
{ v0=v1; v1=d0; }
else if (num == 64)
{ v0=d0; v1=d1; }
else if (num > 32) /* && num != 64 */
{
v0=((v1>>(num-32))|(d0<<(64-num)))&0xffffffffL;
v1=((d0>>(num-32))|(d1<<(64-num)))&0xffffffffL;
}
else /* num < 32 */
{
v0=((v0>>num)|(v1<<(32-num)))&0xffffffffL;
v1=((v1>>num)|(d0<<(32-num)))&0xffffffffL;
}
}
开发者ID:ahenroid,项目名称:ptptl-0.2,代码行数:66,代码来源:cfb_enc.c
示例5: MD5_Update
void MD5_Update(MD5_CTX *c, register unsigned char *data, MD5_LONG len)
{
register ULONG *p;
int sw,sc;
ULONG l;
if (len == 0) return;
l=(c->Nl+(len<<3))&0xffffffffL;
/* 95-05-24 eay Fixed a bug with the overflow handling, thanks to
* Wei Dai <[email protected]> for pointing it out. */
if (l < c->Nl) /* overflow */
c->Nh++;
c->Nh+=(len>>29);
c->Nl=l;
if (c->num != 0) {
p=c->data;
sw=c->num>>2;
sc=c->num&0x03;
if ((c->num+len) >= MD5_CBLOCK) {
l= p[sw];
p_c2l(data,l,sc);
p[sw++]=l;
for (; sw<MD5_LBLOCK; sw++) {
c2l(data,l);
p[sw]=l;
}
len-=(MD5_CBLOCK-c->num);
md5_block(c,p);
c->num=0;
/* drop through and do the rest */
} else {
int ew,ec;
c->num+=(int)len;
if ((sc+len) < 4) { /* ugly, add char's to a word */
l= p[sw];
p_c2l_p(data,l,sc,len);
p[sw]=l;
} else {
ew=(c->num>>2);
ec=(c->num&0x03);
l= p[sw];
p_c2l(data,l,sc);
p[sw++]=l;
for (; sw < ew; sw++)
{ c2l(data,l); p[sw]=l; }
if (ec) {
c2l_p(data,l,ec);
p[sw]=l;
}
}
return;
}
}
开发者ID:Pointillistic,项目名称:rebol-lang,代码行数:58,代码来源:u-md5.c
示例6: DES_cfb64_encrypt
void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out,
long length, DES_key_schedule *schedule,
DES_cblock *ivec, int *num, int enc)
{
register DES_LONG v0, v1;
register long l = length;
register int n = *num;
DES_LONG ti[2];
unsigned char *iv, c, cc;
iv = &(*ivec)[0];
if (enc) {
while (l--) {
if (n == 0) {
c2l(iv, v0);
ti[0] = v0;
c2l(iv, v1);
ti[1] = v1;
DES_encrypt1(ti, schedule, DES_ENCRYPT);
iv = &(*ivec)[0];
v0 = ti[0];
l2c(v0, iv);
v0 = ti[1];
l2c(v0, iv);
iv = &(*ivec)[0];
}
c = *(in++) ^ iv[n];
*(out++) = c;
iv[n] = c;
n = (n + 1) & 0x07;
}
} else {
while (l--) {
if (n == 0) {
c2l(iv, v0);
ti[0] = v0;
c2l(iv, v1);
ti[1] = v1;
DES_encrypt1(ti, schedule, DES_ENCRYPT);
iv = &(*ivec)[0];
v0 = ti[0];
l2c(v0, iv);
v0 = ti[1];
l2c(v0, iv);
iv = &(*ivec)[0];
}
cc = *(in++);
c = iv[n];
iv[n] = cc;
*(out++) = c ^ cc;
n = (n + 1) & 0x07;
}
}
v0 = v1 = ti[0] = ti[1] = c = cc = 0;
*num = n;
}
开发者ID:1Project,项目名称:SafeBoardMessenger,代码行数:56,代码来源:cfb64enc.c
示例7: RC2_cfb64_encrypt
void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out,
long length, RC2_KEY *schedule, unsigned char *ivec,
int *num, int encrypt)
{
register unsigned long v0,v1,t;
register int n= *num;
register long l=length;
unsigned long ti[2];
unsigned char *iv,c,cc;
iv=(unsigned char *)ivec;
if (encrypt)
{
while (l--)
{
if (n == 0)
{
c2l(iv,v0); ti[0]=v0;
c2l(iv,v1); ti[1]=v1;
RC2_encrypt((unsigned long *)ti,schedule);
iv=(unsigned char *)ivec;
t=ti[0]; l2c(t,iv);
t=ti[1]; l2c(t,iv);
iv=(unsigned char *)ivec;
}
c= *(in++)^iv[n];
*(out++)=c;
iv[n]=c;
n=(n+1)&0x07;
}
}
else
{
while (l--)
{
if (n == 0)
{
c2l(iv,v0); ti[0]=v0;
c2l(iv,v1); ti[1]=v1;
RC2_encrypt((unsigned long *)ti,schedule);
iv=(unsigned char *)ivec;
t=ti[0]; l2c(t,iv);
t=ti[1]; l2c(t,iv);
iv=(unsigned char *)ivec;
}
cc= *(in++);
c=iv[n];
iv[n]=cc;
*(out++)=c^cc;
n=(n+1)&0x07;
}
}
v0=v1=ti[0]=ti[1]=t=c=cc=0;
*num=n;
}
开发者ID:LucidOne,项目名称:Rovio,代码行数:55,代码来源:rc2cfb64.c
示例8: DES_ede3_ofb64_encrypt
/* The input and output encrypted as though 64bit ofb mode is being
* used. The extra state information to record how much of the
* 64bit block we have used is contained in *num;
*/
void DES_ede3_ofb64_encrypt(register const unsigned char *in,
register unsigned char *out, long length,
DES_key_schedule *k1, DES_key_schedule *k2,
DES_key_schedule *k3, DES_cblock *ivec,
int *num)
{
register DES_LONG v0,v1;
register int n= *num;
register long l=length;
DES_cblock d;
register char *dp;
DES_LONG ti[2];
unsigned char *iv;
int save=0;
iv = &(*ivec)[0];
c2l(iv,v0);
c2l(iv,v1);
ti[0]=v0;
ti[1]=v1;
dp=(char *)d;
l2c(v0,dp);
l2c(v1,dp);
while (l--)
{
if (n == 0)
{
/* ti[0]=v0; */
/* ti[1]=v1; */
DES_encrypt3(ti,k1,k2,k3);
v0=ti[0];
v1=ti[1];
dp=(char *)d;
l2c(v0,dp);
l2c(v1,dp);
save++;
}
*(out++)= *(in++)^d[n];
n=(n+1)&0x07;
}
if (save)
{
/* v0=ti[0];
v1=ti[1];*/
iv = &(*ivec)[0];
l2c(v0,iv);
l2c(v1,iv);
}
v0=v1=ti[0]=ti[1]=0;
*num=n;
}
开发者ID:Whitehawkx,项目名称:external_openssl-fips_old,代码行数:56,代码来源:ofb64ede.c
示例9: RC5_32_set_key
void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
int rounds)
#endif
{
RC5_32_INT L[64],l,ll,A,B,*S,k;
int i,j,m,c,t,ii,jj;
if ( (rounds != RC5_16_ROUNDS) &&
(rounds != RC5_12_ROUNDS) &&
(rounds != RC5_8_ROUNDS))
rounds=RC5_16_ROUNDS;
key->rounds=rounds;
S= &(key->data[0]);
j=0;
for (i=0; i<=(len-8); i+=8)
{
c2l(data,l);
L[j++]=l;
c2l(data,l);
L[j++]=l;
}
ii=len-i;
if (ii)
{
k=len&0x07;
c2ln(data,l,ll,k);
L[j+0]=l;
L[j+1]=ll;
}
c=(len+3)/4;
t=(rounds+1)*2;
S[0]=RC5_32_P;
for (i=1; i<t; i++)
S[i]=(S[i-1]+RC5_32_Q)&RC5_32_MASK;
j=(t>c)?t:c;
j*=3;
ii=jj=0;
A=B=0;
for (i=0; i<j; i++)
{
k=(S[ii]+A+B)&RC5_32_MASK;
A=S[ii]=ROTATE_l32(k,3);
m=(int)(A+B);
k=(L[jj]+A+B)&RC5_32_MASK;
B=L[jj]=ROTATE_l32(k,m);
if (++ii >= t) ii=0;
if (++jj >= c) jj=0;
}
}
开发者ID:S0043640wipro,项目名称:RiCRiPInt,代码行数:52,代码来源:rc5_skey.c
示例10: RC2_ecb_encrypt
void RC2_ecb_encrypt(const unsigned char *in, unsigned char *out, RC2_KEY *ks,
int encrypt)
{
unsigned long l,d[2];
c2l(in,l); d[0]=l;
c2l(in,l); d[1]=l;
if (encrypt)
RC2_encrypt(d,ks);
else
RC2_decrypt(d,ks);
l=d[0]; l2c(l,out);
l=d[1]; l2c(l,out);
l=d[0]=d[1]=0;
}
开发者ID:LucidOne,项目名称:Rovio,代码行数:15,代码来源:rc2_ecb.c
示例11: DES_ecb_encrypt
void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output,
DES_key_schedule *ks, int enc)
{
register DES_LONG l;
DES_LONG ll[2];
const unsigned char *in = &(*input)[0];
unsigned char *out = &(*output)[0];
c2l(in,l); ll[0]=l;
c2l(in,l); ll[1]=l;
DES_encrypt1(ll,ks,enc);
l=ll[0]; l2c(l,out);
l=ll[1]; l2c(l,out);
l=ll[0]=ll[1]=0;
}
开发者ID:Valbonjv,项目名称:QuickSMS,代码行数:15,代码来源:ecb_enc.c
示例12: osDesDecrypt
void osDesDecrypt(DES_key_schedule *ks,
const_DES_cblock *input,
DES_cblock *output)
{
/* copied from openssl's DES_ecb_encrypt() */
register DES_LONG l;
DES_LONG ll[2];
const unsigned char *in = &(*input)[0];
unsigned char *out = &(*output)[0];
c2l(in,l); ll[0]=l;
c2l(in,l); ll[1]=l;
DES_encrypt1(ll,ks,0);
l=ll[0]; l2c(l,out);
l=ll[1]; l2c(l,out);
l=ll[0]=ll[1]=0;
}
开发者ID:010001111,项目名称:darling,代码行数:17,代码来源:opensslDES.c
示例13: rc5_key_setup
void rc5_key_setup(uint8_t *key, int dummy, rc5key_info *key_info) {
uint32_t *L, l, A, B, *S, k;
uint8_t ii, jj, m;
int8_t i;
uint8_t tmp[16];
S = key_info->vector;
c2l(key, l);
L = (uint32_t *) tmp;
L[0] = l;
key += 4;
c2l(key, l);
L[1] = l;
key += 4;
c2l(key, l);
L[2] = l;
key += 4;
c2l(key, l);
L[3] = l;
S[0] = RC5_32_P;
for (i = 1; i < RC5_KEYSPACES; i ++) {
S[i] = (S[i - 1] + RC5_32_Q);
}
ii = jj = 0;
A = B = 0;
S = key_info->vector;
for (i = 3 * ( RC5_KEYSPACES) - 1; i >= 0; i --) {
k = (*S + A + B) & RC5_32_MASK;
rotl32((k), (3));
A = *S = k;
S ++;
m = ((char)(A+B)) & 0x1f;
k = (*L + A + B) & RC5_32_MASK;
rotl32((k), (m));
B = *L = k;
if (++ii >= RC5_KEYSPACES) {
ii = 0;
S = key_info->vector;
}
jj = (jj + 4) & 0x0f;
L = (uint32_t *) (&tmp[jj]);
}
}
开发者ID:135u5,项目名称:dynamiclinker,代码行数:46,代码来源:rc5.c
示例14: DES_ofb64_encrypt
/* The input and output encrypted as though 64bit ofb mode is being
* used. The extra state information to record how much of the
* 64bit block we have used is contained in *num;
*/
void DES_ofb64_encrypt(register const unsigned char *in,
register unsigned char *out, long length,
DES_key_schedule *schedule, DES_cblock *ivec, int *num)
{
register DES_LONG v0,v1,t;
register int n= *num;
register long l=length;
DES_cblock d;
register unsigned char *dp;
DES_LONG ti[2];
unsigned char *iv;
int save=0;
iv = &(*ivec)[0];
c2l(iv,v0);
c2l(iv,v1);
ti[0]=v0;
ti[1]=v1;
dp=d;
l2c(v0,dp);
l2c(v1,dp);
while (l--)
{
if (n == 0)
{
DES_encrypt1(ti,schedule,DES_ENCRYPT);
dp=d;
t=ti[0]; l2c(t,dp);
t=ti[1]; l2c(t,dp);
save++;
}
*(out++)= *(in++)^d[n];
n=(n+1)&0x07;
}
if (save)
{
v0=ti[0];
v1=ti[1];
iv = &(*ivec)[0];
l2c(v0,iv);
l2c(v1,iv);
}
t=v0=v1=ti[0]=ti[1]=0;
*num=n;
}
开发者ID:ashwinraghav,项目名称:Parallel_Open_SSL,代码行数:49,代码来源:ofb64enc.c
示例15: DES_pcbc_encrypt
void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output,
long length, DES_key_schedule *schedule,
DES_cblock *ivec, int enc)
{
register DES_LONG sin0, sin1, xor0, xor1, tout0, tout1;
DES_LONG tin[2];
const unsigned char *in;
unsigned char *out, *iv;
in = input;
out = output;
iv = &(*ivec)[0];
if (enc) {
c2l(iv, xor0);
c2l(iv, xor1);
for (; length > 0; length -= 8) {
if (length >= 8) {
c2l(in, sin0);
c2l(in, sin1);
} else
c2ln(in, sin0, sin1, length);
tin[0] = sin0 ^ xor0;
tin[1] = sin1 ^ xor1;
DES_encrypt1((DES_LONG *)tin, schedule, DES_ENCRYPT);
tout0 = tin[0];
tout1 = tin[1];
xor0 = sin0 ^ tout0;
xor1 = sin1 ^ tout1;
l2c(tout0, out);
l2c(tout1, out);
}
} else {
c2l(iv, xor0);
c2l(iv, xor1);
for (; length > 0; length -= 8) {
c2l(in, sin0);
c2l(in, sin1);
tin[0] = sin0;
tin[1] = sin1;
DES_encrypt1((DES_LONG *)tin, schedule, DES_DECRYPT);
tout0 = tin[0] ^ xor0;
tout1 = tin[1] ^ xor1;
if (length >= 8) {
l2c(tout0, out);
l2c(tout1, out);
} else
l2cn(tout0, tout1, out, length);
xor0 = tout0 ^ sin0;
xor1 = tout1 ^ sin1;
}
}
tin[0] = tin[1] = 0;
sin0 = sin1 = xor0 = xor1 = tout0 = tout1 = 0;
}
开发者ID:Ana06,项目名称:openssl,代码行数:55,代码来源:pcbc_enc.c
示例16: RC5_32_ofb64_encrypt
/* The input and output encrypted as though 64bit ofb mode is being
* used. The extra state information to record how much of the
* 64bit block we have used is contained in *num;
*/
void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out,
long length, RC5_32_KEY *schedule,
unsigned char *ivec, int *num)
{
unsigned long v0,v1,t;
int n= *num;
long l=length;
unsigned char d[8];
char *dp;
unsigned long ti[2];
unsigned char *iv;
int save=0;
iv=(unsigned char *)ivec;
c2l(iv,v0);
c2l(iv,v1);
ti[0]=v0;
ti[1]=v1;
dp=(char *)d;
l2c(v0,dp);
l2c(v1,dp);
while (l--)
{
if (n == 0)
{
RC5_32_encrypt((unsigned long *)ti,schedule);
dp=(char *)d;
t=ti[0]; l2c(t,dp);
t=ti[1]; l2c(t,dp);
save++;
}
*(out++)= *(in++)^d[n];
n=(n+1)&0x07;
}
if (save)
{
v0=ti[0];
v1=ti[1];
iv=(unsigned char *)ivec;
l2c(v0,iv);
l2c(v1,iv);
}
t=v0=v1=ti[0]=ti[1]=0;
*num=n;
}
开发者ID:Basskrapfen,项目名称:openbsd,代码行数:49,代码来源:rc5ofb64.c
示例17: osDes3Decrypt
void osDes3Decrypt(DES3_Schedule *ks,
const_DES_cblock *input,
DES_cblock *output)
{
register DES_LONG l;
DES_LONG ll[2];
const unsigned char *in = &(*input)[0];
unsigned char *out = &(*output)[0];
c2l(in,l); ll[0]=l;
c2l(in,l); ll[1]=l;
DES_encrypt1(ll,&ks->ks[2],0);
DES_encrypt1(ll,&ks->ks[1],1);
DES_encrypt1(ll,&ks->ks[0],0);
l=ll[0]; l2c(l,out);
l=ll[1]; l2c(l,out);
l=ll[0]=ll[1]=0;
}
开发者ID:010001111,项目名称:darling,代码行数:18,代码来源:opensslDES.c
示例18: rtsmb_des_ecb_encrypt
void rtsmb_des_ecb_encrypt(const_rtsmb_des_cblock *input, rtsmb_des_cblock *output,
rtsmb_des_key_schedule ks,
int enc)
{
register RTSMB_DES_LONG l;
RTSMB_DES_LONG ll[2];
const unsigned char *in;
unsigned char *out;
in = &(*input)[0];
out = &(*output)[0];
c2l(in,l); ll[0]=l;
c2l(in,l); ll[1]=l;
rtsmb_des_encrypt(ll,ks,enc);
l=ll[0]; l2c(l,out);
l=ll[1]; l2c(l,out);
l=ll[0]=ll[1]=0;
}
开发者ID:layerfsd,项目名称:cifssmb,代码行数:19,代码来源:ecb_enc.c
示例19: DES_ecb3_encrypt
void DES_ecb3_encrypt(const unsigned char *in, unsigned char *out,
DES_key_schedule *ks1, DES_key_schedule *ks2,
DES_key_schedule *ks3,
int enc)
{
register DES_LONG l0,l1;
DES_LONG ll[2];
c2l(in,l0);
c2l(in,l1);
ll[0]=l0;
ll[1]=l1;
if (enc)
DES_encrypt3(ll,ks1,ks2,ks3);
else
DES_decrypt3(ll,ks1,ks2,ks3);
l0=ll[0];
l1=ll[1];
l2c(l0,out);
l2c(l1,out);
}
开发者ID:S0043640wipro,项目名称:RiCRiPInt,代码行数:21,代码来源:ecb3_enc.c
示例20: mdc2_body
static void mdc2_body(MDC2_CTX *c, const unsigned char *in, size_t len)
{
register DES_LONG tin0, tin1;
register DES_LONG ttin0, ttin1;
DES_LONG d[2], dd[2];
DES_key_schedule k;
unsigned char *p;
size_t i;
for (i = 0; i < len; i += 8) {
c2l(in, tin0);
d[0] = dd[0] = tin0;
c2l(in, tin1);
d[1] = dd[1] = tin1;
c->h[0] = (c->h[0] & 0x9f) | 0x40;
c->hh[0] = (c->hh[0] & 0x9f) | 0x20;
DES_set_odd_parity(&c->h);
DES_set_key_unchecked(&c->h, &k);
DES_encrypt1(d, &k, 1);
DES_set_odd_parity(&c->hh);
DES_set_key_unchecked(&c->hh, &k);
DES_encrypt1(dd, &k, 1);
ttin0 = tin0 ^ dd[0];
ttin1 = tin1 ^ dd[1];
tin0 ^= d[0];
tin1 ^= d[1];
p = c->h;
l2c(tin0, p);
l2c(ttin1, p);
p = c->hh;
l2c(ttin0, p);
l2c(tin1, p);
}
}
开发者ID:03050903,项目名称:godot,代码行数:38,代码来源:mdc2dgst.c
注:本文中的c2l函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论