Changeset View
Changeset View
Standalone View
Standalone View
src/qca_default.cpp
Show First 20 Lines • Show All 179 Lines • ▼ Show 20 Line(s) | |||||
180 | /* Define the state of the MD5 Algorithm. */ | 180 | /* Define the state of the MD5 Algorithm. */ | ||
181 | struct md5_state_t { | 181 | struct md5_state_t { | ||
182 | md5_word_t count[2]; // 2 /* message length in bits, lsw first */ | 182 | md5_word_t count[2]; // 2 /* message length in bits, lsw first */ | ||
183 | md5_word_t abcd[4]; // 4 /* digest buffer */ | 183 | md5_word_t abcd[4]; // 4 /* digest buffer */ | ||
184 | md5_byte_t buf[64]; // 64 /* accumulate block */ | 184 | md5_byte_t buf[64]; // 64 /* accumulate block */ | ||
185 | 185 | | |||
186 | md5_state_t() | 186 | md5_state_t() | ||
187 | { | 187 | { | ||
188 | memset(count, 0, 2 * sizeof(md5_word_t)); | 188 | memset(count, 0, sizeof(count)); | ||
189 | memset(abcd, 0, 4 * sizeof(md5_word_t)); | 189 | memset(abcd, 0, sizeof(abcd)); | ||
190 | memset(buf, 0, 64 * sizeof(md5_byte_t)); | 190 | memset(buf, 0, sizeof(buf)); | ||
191 | } | 191 | } | ||
192 | }; | 192 | }; | ||
193 | 193 | | |||
194 | /* Initialize the algorithm. */ | 194 | /* Initialize the algorithm. */ | ||
195 | void md5_init(md5_state_t *pms); | 195 | void md5_init(md5_state_t *pms); | ||
196 | 196 | | |||
197 | /* Append a string to the message. */ | 197 | /* Append a string to the message. */ | ||
198 | void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); | 198 | void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); | ||
▲ Show 20 Lines • Show All 372 Lines • ▼ Show 20 Line(s) | |||||
571 | struct SHA1_CONTEXT | 571 | struct SHA1_CONTEXT | ||
572 | { | 572 | { | ||
573 | quint32 state[5]; // 5 | 573 | quint32 state[5]; // 5 | ||
574 | quint32 count[2]; // 2 | 574 | quint32 count[2]; // 2 | ||
575 | unsigned char buffer[64]; // 64 | 575 | unsigned char buffer[64]; // 64 | ||
576 | 576 | | |||
577 | SHA1_CONTEXT() | 577 | SHA1_CONTEXT() | ||
578 | { | 578 | { | ||
579 | memset(state, 0, 5 * sizeof(quint32)); | 579 | memset(state, 0, sizeof(state)); | ||
580 | memset(count, 0, 2 * sizeof(quint32)); | 580 | memset(count, 0, sizeof(count)); | ||
581 | memset(buffer, 0, 64 * sizeof(unsigned char)); | 581 | memset(buffer, 0, sizeof(buffer)); | ||
582 | } | 582 | } | ||
583 | }; | 583 | }; | ||
584 | 584 | | |||
585 | typedef union { | 585 | typedef union { | ||
586 | unsigned char c[64]; | 586 | unsigned char c[64]; | ||
587 | quint32 l[16]; | 587 | quint32 l[16]; | ||
588 | } CHAR64LONG16; | 588 | } CHAR64LONG16; | ||
589 | 589 | | |||
▲ Show 20 Lines • Show All 718 Lines • Show Last 20 Lines |