Click here to Skip to main content
15,890,375 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Which database access tech to use? Pin
S Douglas2-Oct-05 23:53
professionalS Douglas2-Oct-05 23:53 
AnswerRe: Which database access tech to use? Pin
Nemanja Trifunovic2-Oct-05 9:56
Nemanja Trifunovic2-Oct-05 9:56 
GeneralRe: Which database access tech to use? Pin
Shao Voon Wong2-Oct-05 18:14
mvaShao Voon Wong2-Oct-05 18:14 
GeneralRe: Which database access tech to use? Pin
Shao Voon Wong2-Oct-05 18:17
mvaShao Voon Wong2-Oct-05 18:17 
AnswerRe: Which database access tech to use? Pin
Nemanja Trifunovic3-Oct-05 3:52
Nemanja Trifunovic3-Oct-05 3:52 
AnswerRe: Which database access tech to use? Pin
Anonymous2-Oct-05 21:01
Anonymous2-Oct-05 21:01 
Questionhave problem convert javascript to c Pin
ThinkingPrometheus2-Oct-05 3:08
ThinkingPrometheus2-Oct-05 3:08 
AnswerRe: the code to convert: Pin
ThinkingPrometheus2-Oct-05 3:10
ThinkingPrometheus2-Oct-05 3:10 
the javascript:
<br />
  <html><br />
<head><title></title><br />
<script type="text/javascript"><br />
<br />
function r(x,y){<br />
return Math.floor((x/y-Math.floor(x/y))*y+.1);<br />
}<br />
<br />
function m(c){<br />
var i,j,s=[13,8,13,12,16,5,3,10,15];<br />
for(i=0;i<9;i+=1){<br />
j=c[r(i+2,3)];<br />
c[r(i,3)]=(c[r(i,3)]-c[r(i+1,3)]-j)^(r(i,3)==1?j<<s[i]:j>>>s[i]);<br />
}<br />
}<br />
<br />
function getURL(url){<br />
url='info:'+url;<br />
var c=[0x9E3779B9,0x9E3779B9,0xE6359A60],i,j,k=0,l;<br />
for(l=url.length;l>=12;l-=12){<br />
for(i=0;i<16;i++){<br />
j=k+i;<br />
c[Math.floor(i/4)]+=url.charCodeAt(j)<<(r(j,4)*8);<br />
}<br />
m(c);<br />
k+=12;<br />
}<br />
c[2]+=url.length;<br />
for(i=l;i>0;i--)<br />
c[Math.floor((i-1)/4)]+=url.charCodeAt(k+i-1)<<(r(i-1,4)+(i>8?1:0))*8;<br />
m(c);<br />
return'6'+c[2];<br />
}<br />
<br />
</script><br />
</head><br />
<body><br />
<table><br />
<tr><br />
<td><br />
String:<br />
</td><br />
<td><br />
<input type="text" name="hmm"></input><br />
</td><br />
</tr><br />
<tr><br />
<td><br />
Checksum<br />
</td><br />
<td><br />
<input type="text" name="checksum" ></input><br />
</td><br />
</tr><br />
<table><br />
<input type="button" onClick="javascript:checksum.value=getURL(hmm.value);" value="Generate Checksum"><br />
</body><br />
</html><br />


the C code i already have:
<br />
#include <math.h><br />
#include <string.h><br />
#include <limits.h><br />
#include <stdio.h><br />
<br />
#define r(x,y) (long long int)(floor(((x)/(y)-floor((x)/(y)))*(y)+0.1))<br />
<br />
void m(long long int *c);<br />
void getUrl(char *tmp);<br />
void printc(long long int *c);<br />
<br />
void printc(long long int *c){<br />
 for(long long int i=0;i<3;i++)<br />
  printf("%lld ",c[i]);<br />
 printf("\n");<br />
}<br />
<br />
int main(int argc, char **argv)<br />
{<br />
 getUrl("http://fabmail.de/"); <br />
 fgetc(stdin);<br />
 return 0;<br />
}<br />
<br />
void m(long long int *c){<br />
 long long int i,j,s[]={13,8,13,12,16,5,3,10,15};<br />
 printc(c);<br />
 for(i=0;i<9;i++){<br />
  j=c[r(i+2,3.0)];<br />
  c[r(i,3.0)]=(c[r(i,3.0)]-c[r(i+1,3.0)]-j)^(r(i,3.0)==1?j<<s[i]:j>>s[i]);<br />
 }<br />
}<br />
<br />
void getUrl(char *tmp){<br />
 char url[2048]={0};<br />
 char ergebnis[1024]={0};<br />
 if(tmp==NULL || strlen(tmp)>2084-6){<br />
  return;<br />
 }<br />
 sprintf(url,"info:%s",tmp);<br />
 long long int c[]={0x9E3779B9,0x9E3779B9,0xE6359A60};<br />
 long long int i,j,k=0,l;<br />
 for(l=(long long int)strlen(url);l>=12;l-=12){<br />
  for(i=0;i<16;i++){<br />
   j=k+i;<br />
   c[(int)floor(i/4.0)]+=url[j]<<(r(j,4.0)*8);<br />
  }<br />
  m(c);<br />
  k+=12;<br />
 }<br />
 c[2]+=(long long int)strlen(url);<br />
 for(i=l;i>0;i--)<br />
  c[(int)floor((i-1)/4.0)]+=url[(k+i-1)]<<(r(i-1,4.0)+(i>8?1:0))*8;<br />
 m(c);<br />
 sprintf(ergebnis,"6%lld",c[2]);<br />
 printf("%s\n",ergebnis);<br />
}<br />


int the C code the problem is in the m(c); function
but i don't know what's wrong
-- modified at 9:10 Sunday 2nd October, 2005
QuestionHow to Start Pin
| Muhammad Waqas Butt |2-Oct-05 0:02
professional| Muhammad Waqas Butt |2-Oct-05 0:02 
Answerstart !? Pin
Ghasrfakhri2-Oct-05 2:13
Ghasrfakhri2-Oct-05 2:13 
GeneralRe: start !? Pin
Christian Graus2-Oct-05 2:49
protectorChristian Graus2-Oct-05 2:49 
GeneralRe: start !? Pin
Ghasrfakhri2-Oct-05 3:20
Ghasrfakhri2-Oct-05 3:20 
GeneralRe: start !? Pin
toxcct2-Oct-05 4:02
toxcct2-Oct-05 4:02 
GeneralRe: start !? Pin
Christian Graus3-Oct-05 20:19
protectorChristian Graus3-Oct-05 20:19 
QuestionRe: start !? Pin
David Crow3-Oct-05 3:04
David Crow3-Oct-05 3:04 
AnswerRe: start !? Pin
Ghasrfakhri3-Oct-05 5:28
Ghasrfakhri3-Oct-05 5:28 
AnswerRe: start !? Pin
Hamed Musavi3-Oct-05 17:00
Hamed Musavi3-Oct-05 17:00 
AnswerRe: How to Start Pin
Christian Graus2-Oct-05 2:51
protectorChristian Graus2-Oct-05 2:51 
AnswerRe: How to Start Pin
Hamed Musavi3-Oct-05 16:26
Hamed Musavi3-Oct-05 16:26 
QuestionAssignment of Type at Run-Time Pin
LiquidE_SA1-Oct-05 22:11
LiquidE_SA1-Oct-05 22:11 
AnswerRe: Assignment of Type at Run-Time Pin
Maximilien2-Oct-05 2:31
Maximilien2-Oct-05 2:31 
QuestionCString question Pin
benjnp1-Oct-05 21:54
benjnp1-Oct-05 21:54 
AnswerRe: CString question Pin
LiquidE_SA1-Oct-05 22:14
LiquidE_SA1-Oct-05 22:14 
AnswerRe: CString question Pin
AHawk1-Oct-05 22:50
AHawk1-Oct-05 22:50 
GeneralRe: CString question Pin
hamidreza_buddy1-Oct-05 23:17
hamidreza_buddy1-Oct-05 23:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.