99
99
SquidMD5Update(&ctx1, (unsigned const char *) pw, strlen(pw));
100
100
SquidMD5Final(final, &ctx1);
101
101
for (pl = strlen(pw); pl > 0; pl -= 16)
102
SquidMD5Update(&ctx, (unsigned const char *) final, pl > 16 ? 16 : pl);
102
SquidMD5Update(&ctx, (unsigned const char *) final, pl > 16 ? 16 : pl);
104
104
/* Don't leave anything around in vm they could use. */
105
105
memset(final, 0, sizeof final);
107
107
/* Then something really weird... */
108
108
for (j = 0, i = strlen(pw); i; i >>= 1)
110
SquidMD5Update(&ctx, (unsigned const char *) final + j, 1);
112
SquidMD5Update(&ctx, (unsigned const char *) pw + j, 1);
110
SquidMD5Update(&ctx, (unsigned const char *) final + j, 1);
112
SquidMD5Update(&ctx, (unsigned const char *) pw + j, 1);
114
114
/* Now make the output string */
115
115
memset(passwd, 0, sizeof(passwd));
125
125
* need 30 seconds to build a 1000 entry dictionary...
127
127
for (i = 0; i < 1000; i++) {
130
SquidMD5Update(&ctx1, (unsigned const char *) pw, strlen(pw));
132
SquidMD5Update(&ctx1, (unsigned const char *) final, 16);
135
SquidMD5Update(&ctx1, (unsigned const char *) sp, sl);
138
SquidMD5Update(&ctx1, (unsigned const char *) pw, strlen(pw));
141
SquidMD5Update(&ctx1, (unsigned const char *) final, 16);
143
SquidMD5Update(&ctx1, (unsigned const char *) pw, strlen(pw));
144
SquidMD5Final(final, &ctx1);
130
SquidMD5Update(&ctx1, (unsigned const char *) pw, strlen(pw));
132
SquidMD5Update(&ctx1, (unsigned const char *) final, 16);
135
SquidMD5Update(&ctx1, (unsigned const char *) sp, sl);
138
SquidMD5Update(&ctx1, (unsigned const char *) pw, strlen(pw));
141
SquidMD5Update(&ctx1, (unsigned const char *) final, 16);
143
SquidMD5Update(&ctx1, (unsigned const char *) pw, strlen(pw));
144
SquidMD5Final(final, &ctx1);
147
147
p = passwd + strlen(passwd);
175
175
/* Created by Ramon de Carvalho <ramondecarvalho@yahoo.com.br>
176
176
Refined by Rodrigo Rubira Branco <rodrigo@kernelhacking.com>
178
char *md5sum(const char *s){
179
static unsigned char digest[16];
187
SquidMD5Update(&ctx,(const unsigned char *)s,strlen(s));
188
SquidMD5Final(digest,&ctx);
190
for(idx=0;idx<16;idx++)
191
sprintf(&sum[idx*2],"%02x",digest[idx]);
195
/* Don't leave anything around in vm they could use. */
196
memset(digest, 0, sizeof digest);
178
char *md5sum(const char *s)
180
static unsigned char digest[16];
188
SquidMD5Update(&ctx,(const unsigned char *)s,strlen(s));
189
SquidMD5Final(digest,&ctx);
191
for (idx=0; idx<16; idx++)
192
sprintf(&sum[idx*2],"%02x",digest[idx]);
196
/* Don't leave anything around in vm they could use. */
197
memset(digest, 0, sizeof digest);