when i try to convert the transform part of sha1(encription transfrom part), there are some mistake, however the results are alreay quite close ! but still error
the simple code like :
read data into the array
co_uint32 w[16]
w[0] = 1633837824;
for(int i=1;i<15;i++){
w[i] = 0;
}
w[15] = 24;
then using expand like:
#define ROTL(n,X) ( ( ( X ) << n ) | ( ( X ) >> ( 32 - n ) ) )
#define expand(W,i) ( W[ i & 15 ] = ROTL( 1, ( W[ i & 15 ] ^ W[ (i - 14) & 15 ] ^ \
W[ (i - 8) & 15 ] ^ W[ (i - 3) & 15 ] ) ) )
expand(w,16);
expand(w,17);
expand(w,18);
expand(w,19);
expand(w,20);
expand(w,21);
expand(w,22);
expand(w,23);
expand(w,24);
expand(w,25);
expand(w,26);
expand(w,27);
expand(w,28);
expand(w,29);
expand(w,30);
expand(w,31);
using this way to expand orignally 16 data to a new set of 16 data
to expand the array
i try to make this part as HW, but i get different results , when i use VC studio and impuse C to compile and show the results
i use IF_SIM(printf("value is %x\n:", w[i])) to get the Impuse C and correct c code as hex number as below:
impulse C result : w[0] =c2c4c600 correct c code result: w[0] = c2c4c700
w[1] =0 w[1] = 0
w[2] = 30 w[2] = 30
w[3] = 85898c01 w[3] = 85898e01
w[4] = 0 w[4] = 0
w[5] = 60 w[5] = 60
w[6] = b131803 w[6] = b131c03
.....................................................................
Dose anyone knows the difference between **hw.c and the common c code
Started by nono, Nov 13 2008 09:26 PM
1 reply to this topic
#1
Posted 13 November 2008 - 09:26 PM
#2
Posted 16 November 2008 - 07:18 PM
QUOTE (nono @ Nov 14 2008, 01:26 PM) <{POST_SNAPBACK}>
when i try to convert the transform part of sha1(encription transfrom part), there are some mistake, however the results are alreay quite close ! but still error
the simple code like :
read data into the array
co_uint32 w[16]
w[0] = 1633837824;
for(int i=1;i<15;i++){
w[i] = 0;
}
w[15] = 24;
then using expand like:
#define ROTL(n,X) ( ( ( X ) << n ) | ( ( X ) >> ( 32 - n ) ) )
#define expand(W,i) ( W[ i & 15 ] = ROTL( 1, ( W[ i & 15 ] ^ W[ (i - 14) & 15 ] ^ \
W[ (i - 8) & 15 ] ^ W[ (i - 3) & 15 ] ) ) )
expand(w,16);
expand(w,17);
expand(w,18);
expand(w,19);
expand(w,20);
expand(w,21);
expand(w,22);
expand(w,23);
expand(w,24);
expand(w,25);
expand(w,26);
expand(w,27);
expand(w,28);
expand(w,29);
expand(w,30);
expand(w,31);
using this way to expand orignally 16 data to a new set of 16 data
to expand the array
i try to make this part as HW, but i get different results , when i use VC studio and impuse C to compile and show the results
i use IF_SIM(printf("value is %x\n:", w[i])) to get the Impuse C and correct c code as hex number as below:
impulse C result : w[0] =c2c4c600 correct c code result: w[0] = c2c4c700
w[1] =0 w[1] = 0
w[2] = 30 w[2] = 30
w[3] = 85898c01 w[3] = 85898e01
w[4] = 0 w[4] = 0
w[5] = 60 w[5] = 60
w[6] = b131803 w[6] = b131c03
.....................................................................
the simple code like :
read data into the array
co_uint32 w[16]
w[0] = 1633837824;
for(int i=1;i<15;i++){
w[i] = 0;
}
w[15] = 24;
then using expand like:
#define ROTL(n,X) ( ( ( X ) << n ) | ( ( X ) >> ( 32 - n ) ) )
#define expand(W,i) ( W[ i & 15 ] = ROTL( 1, ( W[ i & 15 ] ^ W[ (i - 14) & 15 ] ^ \
W[ (i - 8) & 15 ] ^ W[ (i - 3) & 15 ] ) ) )
expand(w,16);
expand(w,17);
expand(w,18);
expand(w,19);
expand(w,20);
expand(w,21);
expand(w,22);
expand(w,23);
expand(w,24);
expand(w,25);
expand(w,26);
expand(w,27);
expand(w,28);
expand(w,29);
expand(w,30);
expand(w,31);
using this way to expand orignally 16 data to a new set of 16 data
to expand the array
i try to make this part as HW, but i get different results , when i use VC studio and impuse C to compile and show the results
i use IF_SIM(printf("value is %x\n:", w[i])) to get the Impuse C and correct c code as hex number as below:
impulse C result : w[0] =c2c4c600 correct c code result: w[0] = c2c4c700
w[1] =0 w[1] = 0
w[2] = 30 w[2] = 30
w[3] = 85898c01 w[3] = 85898e01
w[4] = 0 w[4] = 0
w[5] = 60 w[5] = 60
w[6] = b131803 w[6] = b131c03
.....................................................................
sori
i made a silly mistake myself!! there is different input array! so absolute different output!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












