0000: 2f 2a 0a 2a 2a 20 53 51 4c 69 74 65 20 75 73 65 /*.** SQLite use
0010: 73 20 74 68 69 73 20 63 6f 64 65 20 66 6f 72 20 s this code for
0020: 74 65 73 74 69 6e 67 20 6f 6e 6c 79 2e 20 20 49 testing only. I
0030: 74 20 69 73 20 6e 6f 74 20 61 20 70 61 72 74 20 t is not a part
0040: 6f 66 0a 2a 2a 20 74 68 65 20 53 51 4c 69 74 65 of.** the SQLite
0050: 20 6c 69 62 72 61 72 79 2e 20 20 54 68 69 73 20 library. This
0060: 66 69 6c 65 20 69 6d 70 6c 65 6d 65 6e 74 73 20 file implements
0070: 74 77 6f 20 6e 65 77 20 54 43 4c 20 63 6f 6d 6d two new TCL comm
0080: 61 6e 64 73 0a 2a 2a 20 22 6d 64 35 22 20 61 6e ands.** "md5" an
0090: 64 20 22 6d 64 35 66 69 6c 65 22 20 74 68 61 74 d "md5file" that
00a0: 20 63 6f 6d 70 75 74 65 20 6d 64 35 20 63 68 65 compute md5 che
00b0: 63 6b 73 75 6d 73 20 6f 6e 20 61 72 62 69 74 72 cksums on arbitr
00c0: 61 72 79 20 74 65 78 74 0a 2a 2a 20 61 6e 64 20 ary text.** and
00d0: 6f 6e 20 63 6f 6d 70 6c 65 74 65 20 66 69 6c 65 on complete file
00e0: 73 2e 20 20 54 68 65 73 65 20 63 6f 6d 6d 61 6e s. These comman
00f0: 64 73 20 61 72 65 20 75 73 65 64 20 62 79 20 74 ds are used by t
0100: 68 65 20 22 74 65 73 74 66 69 78 74 75 72 65 22 he "testfixture"
0110: 0a 2a 2a 20 70 72 6f 67 72 61 6d 20 74 6f 20 68 .** program to h
0120: 65 6c 70 20 76 65 72 69 66 79 20 74 68 65 20 63 elp verify the c
0130: 6f 72 72 65 63 74 20 6f 70 65 72 61 74 69 6f 6e orrect operation
0140: 20 6f 66 20 74 68 65 20 53 51 4c 69 74 65 20 6c of the SQLite l
0150: 69 62 72 61 72 79 2e 0a 2a 2a 0a 2a 2a 20 54 68 ibrary..**.** Th
0160: 65 20 6f 72 69 67 69 6e 61 6c 20 75 73 65 20 6f e original use o
0170: 66 20 74 68 65 73 65 20 54 43 4c 20 63 6f 6d 6d f these TCL comm
0180: 61 6e 64 73 20 77 61 73 20 74 6f 20 74 65 73 74 ands was to test
0190: 20 74 68 65 20 52 4f 4c 4c 42 41 43 4b 0a 2a 2a the ROLLBACK.**
01a0: 20 66 65 61 74 75 72 65 20 6f 66 20 53 51 4c 69 feature of SQLi
01b0: 74 65 2e 20 20 46 69 72 73 74 20 63 6f 6d 70 75 te. First compu
01c0: 74 65 20 74 68 65 20 4d 44 35 2d 63 68 65 63 6b te the MD5-check
01d0: 73 75 6d 20 6f 66 20 74 68 65 20 64 61 74 61 62 sum of the datab
01e0: 61 73 65 2e 0a 2a 2a 20 54 68 65 6e 20 6d 61 6b ase..** Then mak
01f0: 65 20 73 6f 6d 65 20 63 68 61 6e 67 65 73 20 62 e some changes b
0200: 75 74 20 72 6f 6c 6c 62 61 63 6b 20 74 68 65 20 ut rollback the
0210: 63 68 61 6e 67 65 73 20 72 61 74 68 65 72 20 74 changes rather t
0220: 68 61 6e 20 63 6f 6d 6d 69 74 0a 2a 2a 20 74 68 han commit.** th
0230: 65 6d 2e 20 20 43 6f 6d 70 75 74 65 20 61 20 73 em. Compute a s
0240: 65 63 6f 6e 64 20 4d 44 35 2d 63 68 65 63 6b 73 econd MD5-checks
0250: 75 6d 20 6f 66 20 74 68 65 20 66 69 6c 65 20 61 um of the file a
0260: 6e 64 20 76 65 72 69 66 79 20 74 68 61 74 20 74 nd verify that t
0270: 68 65 0a 2a 2a 20 74 77 6f 20 63 68 65 63 6b 73 he.** two checks
0280: 75 6d 73 20 61 72 65 20 74 68 65 20 73 61 6d 65 ums are the same
0290: 2e 20 20 53 75 63 68 20 69 73 20 74 68 65 20 6f . Such is the o
02a0: 72 69 67 69 6e 61 6c 20 75 73 65 20 6f 66 20 74 riginal use of t
02b0: 68 69 73 20 63 6f 64 65 2e 0a 2a 2a 20 4e 65 77 his code..** New
02c0: 20 75 73 65 73 20 6d 61 79 20 68 61 76 65 20 62 uses may have b
02d0: 65 65 6e 20 61 64 64 65 64 20 73 69 6e 63 65 20 een added since
02e0: 74 68 69 73 20 63 6f 6d 6d 65 6e 74 20 77 61 73 this comment was
02f0: 20 77 72 69 74 74 65 6e 2e 0a 2a 2a 0a 2a 2a 20 written..**.**
0300: 24 49 64 3a 20 74 65 73 74 5f 6d 64 35 2e 63 2c $Id: test_md5.c,
0310: 76 20 31 2e 38 20 32 30 30 38 2f 30 35 2f 31 36 v 1.8 2008/05/16
0320: 20 30 34 3a 35 31 3a 35 35 20 64 61 6e 69 65 6c 04:51:55 daniel
0330: 6b 31 39 37 37 20 45 78 70 20 24 0a 2a 2f 0a 2f k1977 Exp $.*/./
0340: 2a 0a 20 2a 20 54 68 69 73 20 63 6f 64 65 20 69 *. * This code i
0350: 6d 70 6c 65 6d 65 6e 74 73 20 74 68 65 20 4d 44 mplements the MD
0360: 35 20 6d 65 73 73 61 67 65 2d 64 69 67 65 73 74 5 message-digest
0370: 20 61 6c 67 6f 72 69 74 68 6d 2e 0a 20 2a 20 54 algorithm.. * T
0380: 68 65 20 61 6c 67 6f 72 69 74 68 6d 20 69 73 20 he algorithm is
0390: 64 75 65 20 74 6f 20 52 6f 6e 20 52 69 76 65 73 due to Ron Rives
03a0: 74 2e 20 20 54 68 69 73 20 63 6f 64 65 20 77 61 t. This code wa
03b0: 73 0a 20 2a 20 77 72 69 74 74 65 6e 20 62 79 20 s. * written by
03c0: 43 6f 6c 69 6e 20 50 6c 75 6d 62 20 69 6e 20 31 Colin Plumb in 1
03d0: 39 39 33 2c 20 6e 6f 20 63 6f 70 79 72 69 67 68 993, no copyrigh
03e0: 74 20 69 73 20 63 6c 61 69 6d 65 64 2e 0a 20 2a t is claimed.. *
03f0: 20 54 68 69 73 20 63 6f 64 65 20 69 73 20 69 6e This code is in
0400: 20 74 68 65 20 70 75 62 6c 69 63 20 64 6f 6d 61 the public doma
0410: 69 6e 3b 20 64 6f 20 77 69 74 68 20 69 74 20 77 in; do with it w
0420: 68 61 74 20 79 6f 75 20 77 69 73 68 2e 0a 20 2a hat you wish.. *
0430: 0a 20 2a 20 45 71 75 69 76 61 6c 65 6e 74 20 63 . * Equivalent c
0440: 6f 64 65 20 69 73 20 61 76 61 69 6c 61 62 6c 65 ode is available
0450: 20 66 72 6f 6d 20 52 53 41 20 44 61 74 61 20 53 from RSA Data S
0460: 65 63 75 72 69 74 79 2c 20 49 6e 63 2e 0a 20 2a ecurity, Inc.. *
0470: 20 54 68 69 73 20 63 6f 64 65 20 68 61 73 20 62 This code has b
0480: 65 65 6e 20 74 65 73 74 65 64 20 61 67 61 69 6e een tested again
0490: 73 74 20 74 68 61 74 2c 20 61 6e 64 20 69 73 20 st that, and is
04a0: 65 71 75 69 76 61 6c 65 6e 74 2c 0a 20 2a 20 65 equivalent,. * e
04b0: 78 63 65 70 74 20 74 68 61 74 20 79 6f 75 20 64 xcept that you d
04c0: 6f 6e 27 74 20 6e 65 65 64 20 74 6f 20 69 6e 63 on't need to inc
04d0: 6c 75 64 65 20 74 77 6f 20 70 61 67 65 73 20 6f lude two pages o
04e0: 66 20 6c 65 67 61 6c 65 73 65 0a 20 2a 20 77 69 f legalese. * wi
04f0: 74 68 20 65 76 65 72 79 20 63 6f 70 79 2e 0a 20 th every copy..
0500: 2a 0a 20 2a 20 54 6f 20 63 6f 6d 70 75 74 65 20 *. * To compute
0510: 74 68 65 20 6d 65 73 73 61 67 65 20 64 69 67 65 the message dige
0520: 73 74 20 6f 66 20 61 20 63 68 75 6e 6b 20 6f 66 st of a chunk of
0530: 20 62 79 74 65 73 2c 20 64 65 63 6c 61 72 65 20 bytes, declare
0540: 61 6e 0a 20 2a 20 4d 44 35 43 6f 6e 74 65 78 74 an. * MD5Context
0550: 20 73 74 72 75 63 74 75 72 65 2c 20 70 61 73 73 structure, pass
0560: 20 69 74 20 74 6f 20 4d 44 35 49 6e 69 74 2c 20 it to MD5Init,
0570: 63 61 6c 6c 20 4d 44 35 55 70 64 61 74 65 20 61 call MD5Update a
0580: 73 0a 20 2a 20 6e 65 65 64 65 64 20 6f 6e 20 62 s. * needed on b
0590: 75 66 66 65 72 73 20 66 75 6c 6c 20 6f 66 20 62 uffers full of b
05a0: 79 74 65 73 2c 20 61 6e 64 20 74 68 65 6e 20 63 ytes, and then c
05b0: 61 6c 6c 20 4d 44 35 46 69 6e 61 6c 2c 20 77 68 all MD5Final, wh
05c0: 69 63 68 0a 20 2a 20 77 69 6c 6c 20 66 69 6c 6c ich. * will fill
05d0: 20 61 20 73 75 70 70 6c 69 65 64 20 31 36 2d 62 a supplied 16-b
05e0: 79 74 65 20 61 72 72 61 79 20 77 69 74 68 20 74 yte array with t
05f0: 68 65 20 64 69 67 65 73 74 2e 0a 20 2a 2f 0a 23 he digest.. */.#
0600: 69 6e 63 6c 75 64 65 20 3c 74 63 6c 2e 68 3e 0a include <tcl.h>.
0610: 23 69 6e 63 6c 75 64 65 20 3c 73 74 72 69 6e 67 #include <string
0620: 2e 68 3e 0a 23 69 6e 63 6c 75 64 65 20 22 73 71 .h>.#include "sq
0630: 6c 69 74 65 33 2e 68 22 0a 0a 2f 2a 0a 20 2a 20 lite3.h"../*. *
0640: 49 66 20 63 6f 6d 70 69 6c 65 64 20 6f 6e 20 61 If compiled on a
0650: 20 6d 61 63 68 69 6e 65 20 74 68 61 74 20 64 6f machine that do
0660: 65 73 6e 27 74 20 68 61 76 65 20 61 20 33 32 2d esn't have a 32-
0670: 62 69 74 20 69 6e 74 65 67 65 72 2c 0a 20 2a 20 bit integer,. *
0680: 79 6f 75 20 6a 75 73 74 20 73 65 74 20 22 75 69 you just set "ui
0690: 6e 74 33 32 22 20 74 6f 20 74 68 65 20 61 70 70 nt32" to the app
06a0: 72 6f 70 72 69 61 74 65 20 64 61 74 61 74 79 70 ropriate datatyp
06b0: 65 20 66 6f 72 20 61 6e 0a 20 2a 20 75 6e 73 69 e for an. * unsi
06c0: 67 6e 65 64 20 33 32 2d 62 69 74 20 69 6e 74 65 gned 32-bit inte
06d0: 67 65 72 2e 20 20 46 6f 72 20 65 78 61 6d 70 6c ger. For exampl
06e0: 65 3a 0a 20 2a 0a 20 2a 20 20 20 20 20 20 20 63 e:. *. * c
06f0: 63 20 2d 44 75 69 6e 74 33 32 3d 27 75 6e 73 69 c -Duint32='unsi
0700: 67 6e 65 64 20 6c 6f 6e 67 27 20 6d 64 35 2e 63 gned long' md5.c
0710: 0a 20 2a 0a 20 2a 2f 0a 23 69 66 6e 64 65 66 20 . *. */.#ifndef
0720: 75 69 6e 74 33 32 0a 23 20 20 64 65 66 69 6e 65 uint32.# define
0730: 20 75 69 6e 74 33 32 20 75 6e 73 69 67 6e 65 64 uint32 unsigned
0740: 20 69 6e 74 0a 23 65 6e 64 69 66 0a 0a 73 74 72 int.#endif..str
0750: 75 63 74 20 43 6f 6e 74 65 78 74 20 7b 0a 20 20 uct Context {.
0760: 69 6e 74 20 69 73 49 6e 69 74 3b 0a 20 20 75 69 int isInit;. ui
0770: 6e 74 33 32 20 62 75 66 5b 34 5d 3b 0a 20 20 75 nt32 buf[4];. u
0780: 69 6e 74 33 32 20 62 69 74 73 5b 32 5d 3b 0a 20 int32 bits[2];.
0790: 20 75 6e 73 69 67 6e 65 64 20 63 68 61 72 20 69 unsigned char i
07a0: 6e 5b 36 34 5d 3b 0a 7d 3b 0a 74 79 70 65 64 65 n[64];.};.typede
07b0: 66 20 73 74 72 75 63 74 20 43 6f 6e 74 65 78 74 f struct Context
07c0: 20 4d 44 35 43 6f 6e 74 65 78 74 3b 0a 0a 2f 2a MD5Context;../*
07d0: 0a 20 2a 20 4e 6f 74 65 3a 20 74 68 69 73 20 63 . * Note: this c
07e0: 6f 64 65 20 69 73 20 68 61 72 6d 6c 65 73 73 20 ode is harmless
07f0: 6f 6e 20 6c 69 74 74 6c 65 2d 65 6e 64 69 61 6e on little-endian
0800: 20 6d 61 63 68 69 6e 65 73 2e 0a 20 2a 2f 0a 73 machines.. */.s
0810: 74 61 74 69 63 20 76 6f 69 64 20 62 79 74 65 52 tatic void byteR
0820: 65 76 65 72 73 65 20 28 75 6e 73 69 67 6e 65 64 everse (unsigned
0830: 20 63 68 61 72 20 2a 62 75 66 2c 20 75 6e 73 69 char *buf, unsi
0840: 67 6e 65 64 20 6c 6f 6e 67 73 29 7b 0a 20 20 20 gned longs){.
0850: 20 20 20 20 20 75 69 6e 74 33 32 20 74 3b 0a 20 uint32 t;.
0860: 20 20 20 20 20 20 20 64 6f 20 7b 0a 20 20 20 20 do {.
0870: 20 20 20 20 20 20 20 20 20 20 20 20 74 20 3d 20 t =
0880: 28 75 69 6e 74 33 32 29 28 28 75 6e 73 69 67 6e (uint32)((unsign
0890: 65 64 29 62 75 66 5b 33 5d 3c 3c 38 20 7c 20 62 ed)buf[3]<<8 | b
08a0: 75 66 5b 32 5d 29 20 3c 3c 20 31 36 20 7c 0a 20 uf[2]) << 16 |.
08b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
08c0: 20 20 20 20 20 20 20 20 20 20 20 28 28 75 6e 73 ((uns
08d0: 69 67 6e 65 64 29 62 75 66 5b 31 5d 3c 3c 38 20 igned)buf[1]<<8
08e0: 7c 20 62 75 66 5b 30 5d 29 3b 0a 20 20 20 20 20 | buf[0]);.
08f0: 20 20 20 20 20 20 20 20 20 20 20 2a 28 75 69 6e *(uin
0900: 74 33 32 20 2a 29 62 75 66 20 3d 20 74 3b 0a 20 t32 *)buf = t;.
0910: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 b
0920: 75 66 20 2b 3d 20 34 3b 0a 20 20 20 20 20 20 20 uf += 4;.
0930: 20 7d 20 77 68 69 6c 65 20 28 2d 2d 6c 6f 6e 67 } while (--long
0940: 73 29 3b 0a 7d 0a 2f 2a 20 54 68 65 20 66 6f 75 s);.}./* The fou
0950: 72 20 63 6f 72 65 20 66 75 6e 63 74 69 6f 6e 73 r core functions
0960: 20 2d 20 46 31 20 69 73 20 6f 70 74 69 6d 69 7a - F1 is optimiz
0970: 65 64 20 73 6f 6d 65 77 68 61 74 20 2a 2f 0a 0a ed somewhat */..
0980: 2f 2a 20 23 64 65 66 69 6e 65 20 46 31 28 78 2c /* #define F1(x,
0990: 20 79 2c 20 7a 29 20 28 78 20 26 20 79 20 7c 20 y, z) (x & y |
09a0: 7e 78 20 26 20 7a 29 20 2a 2f 0a 23 64 65 66 69 ~x & z) */.#defi
09b0: 6e 65 20 46 31 28 78 2c 20 79 2c 20 7a 29 20 28 ne F1(x, y, z) (
09c0: 7a 20 5e 20 28 78 20 26 20 28 79 20 5e 20 7a 29 z ^ (x & (y ^ z)
09d0: 29 29 0a 23 64 65 66 69 6e 65 20 46 32 28 78 2c )).#define F2(x,
09e0: 20 79 2c 20 7a 29 20 46 31 28 7a 2c 20 78 2c 20 y, z) F1(z, x,
09f0: 79 29 0a 23 64 65 66 69 6e 65 20 46 33 28 78 2c y).#define F3(x,
0a00: 20 79 2c 20 7a 29 20 28 78 20 5e 20 79 20 5e 20 y, z) (x ^ y ^
0a10: 7a 29 0a 23 64 65 66 69 6e 65 20 46 34 28 78 2c z).#define F4(x,
0a20: 20 79 2c 20 7a 29 20 28 79 20 5e 20 28 78 20 7c y, z) (y ^ (x |
0a30: 20 7e 7a 29 29 0a 0a 2f 2a 20 54 68 69 73 20 69 ~z))../* This i
0a40: 73 20 74 68 65 20 63 65 6e 74 72 61 6c 20 73 74 s the central st
0a50: 65 70 20 69 6e 20 74 68 65 20 4d 44 35 20 61 6c ep in the MD5 al
0a60: 67 6f 72 69 74 68 6d 2e 20 2a 2f 0a 23 64 65 66 gorithm. */.#def
0a70: 69 6e 65 20 4d 44 35 53 54 45 50 28 66 2c 20 77 ine MD5STEP(f, w
0a80: 2c 20 78 2c 20 79 2c 20 7a 2c 20 64 61 74 61 2c , x, y, z, data,
0a90: 20 73 29 20 5c 0a 20 20 20 20 20 20 20 20 28 20 s) \. (
0aa0: 77 20 2b 3d 20 66 28 78 2c 20 79 2c 20 7a 29 20 w += f(x, y, z)
0ab0: 2b 20 64 61 74 61 2c 20 20 77 20 3d 20 77 3c 3c + data, w = w<<
0ac0: 73 20 7c 20 77 3e 3e 28 33 32 2d 73 29 2c 20 20 s | w>>(32-s),
0ad0: 77 20 2b 3d 20 78 20 29 0a 0a 2f 2a 0a 20 2a 20 w += x )../*. *
0ae0: 54 68 65 20 63 6f 72 65 20 6f 66 20 74 68 65 20 The core of the
0af0: 4d 44 35 20 61 6c 67 6f 72 69 74 68 6d 2c 20 74 MD5 algorithm, t
0b00: 68 69 73 20 61 6c 74 65 72 73 20 61 6e 20 65 78 his alters an ex
0b10: 69 73 74 69 6e 67 20 4d 44 35 20 68 61 73 68 20 isting MD5 hash
0b20: 74 6f 0a 20 2a 20 72 65 66 6c 65 63 74 20 74 68 to. * reflect th
0b30: 65 20 61 64 64 69 74 69 6f 6e 20 6f 66 20 31 36 e addition of 16
0b40: 20 6c 6f 6e 67 77 6f 72 64 73 20 6f 66 20 6e 65 longwords of ne
0b50: 77 20 64 61 74 61 2e 20 20 4d 44 35 55 70 64 61 w data. MD5Upda
0b60: 74 65 20 62 6c 6f 63 6b 73 0a 20 2a 20 74 68 65 te blocks. * the
0b70: 20 64 61 74 61 20 61 6e 64 20 63 6f 6e 76 65 72 data and conver
0b80: 74 73 20 62 79 74 65 73 20 69 6e 74 6f 20 6c 6f ts bytes into lo
0b90: 6e 67 77 6f 72 64 73 20 66 6f 72 20 74 68 69 73 ngwords for this
0ba0: 20 72 6f 75 74 69 6e 65 2e 0a 20 2a 2f 0a 73 74 routine.. */.st
0bb0: 61 74 69 63 20 76 6f 69 64 20 4d 44 35 54 72 61 atic void MD5Tra
0bc0: 6e 73 66 6f 72 6d 28 75 69 6e 74 33 32 20 62 75 nsform(uint32 bu
0bd0: 66 5b 34 5d 2c 20 63 6f 6e 73 74 20 75 69 6e 74 f[4], const uint
0be0: 33 32 20 69 6e 5b 31 36 5d 29 7b 0a 20 20 20 20 32 in[16]){.
0bf0: 20 20 20 20 72 65 67 69 73 74 65 72 20 75 69 6e register uin
0c00: 74 33 32 20 61 2c 20 62 2c 20 63 2c 20 64 3b 0a t32 a, b, c, d;.
0c10: 0a 20 20 20 20 20 20 20 20 61 20 3d 20 62 75 66 . a = buf
0c20: 5b 30 5d 3b 0a 20 20 20 20 20 20 20 20 62 20 3d [0];. b =
0c30: 20 62 75 66 5b 31 5d 3b 0a 20 20 20 20 20 20 20 buf[1];.
0c40: 20 63 20 3d 20 62 75 66 5b 32 5d 3b 0a 20 20 20 c = buf[2];.
0c50: 20 20 20 20 20 64 20 3d 20 62 75 66 5b 33 5d 3b d = buf[3];
0c60: 0a 0a 20 20 20 20 20 20 20 20 4d 44 35 53 54 45 .. MD5STE
0c70: 50 28 46 31 2c 20 61 2c 20 62 2c 20 63 2c 20 64 P(F1, a, b, c, d
0c80: 2c 20 69 6e 5b 20 30 5d 2b 30 78 64 37 36 61 61 , in[ 0]+0xd76aa
0c90: 34 37 38 2c 20 20 37 29 3b 0a 20 20 20 20 20 20 478, 7);.
0ca0: 20 20 4d 44 35 53 54 45 50 28 46 31 2c 20 64 2c MD5STEP(F1, d,
0cb0: 20 61 2c 20 62 2c 20 63 2c 20 69 6e 5b 20 31 5d a, b, c, in[ 1]
0cc0: 2b 30 78 65 38 63 37 62 37 35 36 2c 20 31 32 29 +0xe8c7b756, 12)
0cd0: 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 53 54 45 ;. MD5STE
0ce0: 50 28 46 31 2c 20 63 2c 20 64 2c 20 61 2c 20 62 P(F1, c, d, a, b
0cf0: 2c 20 69 6e 5b 20 32 5d 2b 30 78 32 34 32 30 37 , in[ 2]+0x24207
0d00: 30 64 62 2c 20 31 37 29 3b 0a 20 20 20 20 20 20 0db, 17);.
0d10: 20 20 4d 44 35 53 54 45 50 28 46 31 2c 20 62 2c MD5STEP(F1, b,
0d20: 20 63 2c 20 64 2c 20 61 2c 20 69 6e 5b 20 33 5d c, d, a, in[ 3]
0d30: 2b 30 78 63 31 62 64 63 65 65 65 2c 20 32 32 29 +0xc1bdceee, 22)
0d40: 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 53 54 45 ;. MD5STE
0d50: 50 28 46 31 2c 20 61 2c 20 62 2c 20 63 2c 20 64 P(F1, a, b, c, d
0d60: 2c 20 69 6e 5b 20 34 5d 2b 30 78 66 35 37 63 30 , in[ 4]+0xf57c0
0d70: 66 61 66 2c 20 20 37 29 3b 0a 20 20 20 20 20 20 faf, 7);.
0d80: 20 20 4d 44 35 53 54 45 50 28 46 31 2c 20 64 2c MD5STEP(F1, d,
0d90: 20 61 2c 20 62 2c 20 63 2c 20 69 6e 5b 20 35 5d a, b, c, in[ 5]
0da0: 2b 30 78 34 37 38 37 63 36 32 61 2c 20 31 32 29 +0x4787c62a, 12)
0db0: 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 53 54 45 ;. MD5STE
0dc0: 50 28 46 31 2c 20 63 2c 20 64 2c 20 61 2c 20 62 P(F1, c, d, a, b
0dd0: 2c 20 69 6e 5b 20 36 5d 2b 30 78 61 38 33 30 34 , in[ 6]+0xa8304
0de0: 36 31 33 2c 20 31 37 29 3b 0a 20 20 20 20 20 20 613, 17);.
0df0: 20 20 4d 44 35 53 54 45 50 28 46 31 2c 20 62 2c MD5STEP(F1, b,
0e00: 20 63 2c 20 64 2c 20 61 2c 20 69 6e 5b 20 37 5d c, d, a, in[ 7]
0e10: 2b 30 78 66 64 34 36 39 35 30 31 2c 20 32 32 29 +0xfd469501, 22)
0e20: 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 53 54 45 ;. MD5STE
0e30: 50 28 46 31 2c 20 61 2c 20 62 2c 20 63 2c 20 64 P(F1, a, b, c, d
0e40: 2c 20 69 6e 5b 20 38 5d 2b 30 78 36 39 38 30 39 , in[ 8]+0x69809
0e50: 38 64 38 2c 20 20 37 29 3b 0a 20 20 20 20 20 20 8d8, 7);.
0e60: 20 20 4d 44 35 53 54 45 50 28 46 31 2c 20 64 2c MD5STEP(F1, d,
0e70: 20 61 2c 20 62 2c 20 63 2c 20 69 6e 5b 20 39 5d a, b, c, in[ 9]
0e80: 2b 30 78 38 62 34 34 66 37 61 66 2c 20 31 32 29 +0x8b44f7af, 12)
0e90: 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 53 54 45 ;. MD5STE
0ea0: 50 28 46 31 2c 20 63 2c 20 64 2c 20 61 2c 20 62 P(F1, c, d, a, b
0eb0: 2c 20 69 6e 5b 31 30 5d 2b 30 78 66 66 66 66 35 , in[10]+0xffff5
0ec0: 62 62 31 2c 20 31 37 29 3b 0a 20 20 20 20 20 20 bb1, 17);.
0ed0: 20 20 4d 44 35 53 54 45 50 28 46 31 2c 20 62 2c MD5STEP(F1, b,
0ee0: 20 63 2c 20 64 2c 20 61 2c 20 69 6e 5b 31 31 5d c, d, a, in[11]
0ef0: 2b 30 78 38 39 35 63 64 37 62 65 2c 20 32 32 29 +0x895cd7be, 22)
0f00: 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 53 54 45 ;. MD5STE
0f10: 50 28 46 31 2c 20 61 2c 20 62 2c 20 63 2c 20 64 P(F1, a, b, c, d
0f20: 2c 20 69 6e 5b 31 32 5d 2b 30 78 36 62 39 30 31 , in[12]+0x6b901
0f30: 31 32 32 2c 20 20 37 29 3b 0a 20 20 20 20 20 20 122, 7);.
0f40: 20 20 4d 44 35 53 54 45 50 28 46 31 2c 20 64 2c MD5STEP(F1, d,
0f50: 20 61 2c 20 62 2c 20 63 2c 20 69 6e 5b 31 33 5d a, b, c, in[13]
0f60: 2b 30 78 66 64 39 38 37 31 39 33 2c 20 31 32 29 +0xfd987193, 12)
0f70: 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 53 54 45 ;. MD5STE
0f80: 50 28 46 31 2c 20 63 2c 20 64 2c 20 61 2c 20 62 P(F1, c, d, a, b
0f90: 2c 20 69 6e 5b 31 34 5d 2b 30 78 61 36 37 39 34 , in[14]+0xa6794
0fa0: 33 38 65 2c 20 31 37 29 3b 0a 20 20 20 20 20 20 38e, 17);.
0fb0: 20 20 4d 44 35 53 54 45 50 28 46 31 2c 20 62 2c MD5STEP(F1, b,
0fc0: 20 63 2c 20 64 2c 20 61 2c 20 69 6e 5b 31 35 5d c, d, a, in[15]
0fd0: 2b 30 78 34 39 62 34 30 38 32 31 2c 20 32 32 29 +0x49b40821, 22)
0fe0: 3b 0a 0a 20 20 20 20 20 20 20 20 4d 44 35 53 54 ;.. MD5ST
0ff0: 45 50 28 46 32 2c 20 61 2c 20 62 2c 20 63 2c 20 EP(F2, a, b, c,
1000: 64 2c 20 69 6e 5b 20 31 5d 2b 30 78 66 36 31 65 d, in[ 1]+0xf61e
1010: 32 35 36 32 2c 20 20 35 29 3b 0a 20 20 20 20 20 2562, 5);.
1020: 20 20 20 4d 44 35 53 54 45 50 28 46 32 2c 20 64 MD5STEP(F2, d
1030: 2c 20 61 2c 20 62 2c 20 63 2c 20 69 6e 5b 20 36 , a, b, c, in[ 6
1040: 5d 2b 30 78 63 30 34 30 62 33 34 30 2c 20 20 39 ]+0xc040b340, 9
1050: 29 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 53 54 );. MD5ST
1060: 45 50 28 46 32 2c 20 63 2c 20 64 2c 20 61 2c 20 EP(F2, c, d, a,
1070: 62 2c 20 69 6e 5b 31 31 5d 2b 30 78 32 36 35 65 b, in[11]+0x265e
1080: 35 61 35 31 2c 20 31 34 29 3b 0a 20 20 20 20 20 5a51, 14);.
1090: 20 20 20 4d 44 35 53 54 45 50 28 46 32 2c 20 62 MD5STEP(F2, b
10a0: 2c 20 63 2c 20 64 2c 20 61 2c 20 69 6e 5b 20 30 , c, d, a, in[ 0
10b0: 5d 2b 30 78 65 39 62 36 63 37 61 61 2c 20 32 30 ]+0xe9b6c7aa, 20
10c0: 29 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 53 54 );. MD5ST
10d0: 45 50 28 46 32 2c 20 61 2c 20 62 2c 20 63 2c 20 EP(F2, a, b, c,
10e0: 64 2c 20 69 6e 5b 20 35 5d 2b 30 78 64 36 32 66 d, in[ 5]+0xd62f
10f0: 31 30 35 64 2c 20 20 35 29 3b 0a 20 20 20 20 20 105d, 5);.
1100: 20 20 20 4d 44 35 53 54 45 50 28 46 32 2c 20 64 MD5STEP(F2, d
1110: 2c 20 61 2c 20 62 2c 20 63 2c 20 69 6e 5b 31 30 , a, b, c, in[10
1120: 5d 2b 30 78 30 32 34 34 31 34 35 33 2c 20 20 39 ]+0x02441453, 9
1130: 29 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 53 54 );. MD5ST
1140: 45 50 28 46 32 2c 20 63 2c 20 64 2c 20 61 2c 20 EP(F2, c, d, a,
1150: 62 2c 20 69 6e 5b 31 35 5d 2b 30 78 64 38 61 31 b, in[15]+0xd8a1
1160: 65 36 38 31 2c 20 31 34 29 3b 0a 20 20 20 20 20 e681, 14);.
1170: 20 20 20 4d 44 35 53 54 45 50 28 46 32 2c 20 62 MD5STEP(F2, b
1180: 2c 20 63 2c 20 64 2c 20 61 2c 20 69 6e 5b 20 34 , c, d, a, in[ 4
1190: 5d 2b 30 78 65 37 64 33 66 62 63 38 2c 20 32 30 ]+0xe7d3fbc8, 20
11a0: 29 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 53 54 );. MD5ST
11b0: 45 50 28 46 32 2c 20 61 2c 20 62 2c 20 63 2c 20 EP(F2, a, b, c,
11c0: 64 2c 20 69 6e 5b 20 39 5d 2b 30 78 32 31 65 31 d, in[ 9]+0x21e1
11d0: 63 64 65 36 2c 20 20 35 29 3b 0a 20 20 20 20 20 cde6, 5);.
11e0: 20 20 20 4d 44 35 53 54 45 50 28 46 32 2c 20 64 MD5STEP(F2, d
11f0: 2c 20 61 2c 20 62 2c 20 63 2c 20 69 6e 5b 31 34 , a, b, c, in[14
1200: 5d 2b 30 78 63 33 33 37 30 37 64 36 2c 20 20 39 ]+0xc33707d6, 9
1210: 29 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 53 54 );. MD5ST
1220: 45 50 28 46 32 2c 20 63 2c 20 64 2c 20 61 2c 20 EP(F2, c, d, a,
1230: 62 2c 20 69 6e 5b 20 33 5d 2b 30 78 66 34 64 35 b, in[ 3]+0xf4d5
1240: 30 64 38 37 2c 20 31 34 29 3b 0a 20 20 20 20 20 0d87, 14);.
1250: 20 20 20 4d 44 35 53 54 45 50 28 46 32 2c 20 62 MD5STEP(F2, b
1260: 2c 20 63 2c 20 64 2c 20 61 2c 20 69 6e 5b 20 38 , c, d, a, in[ 8
1270: 5d 2b 30 78 34 35 35 61 31 34 65 64 2c 20 32 30 ]+0x455a14ed, 20
1280: 29 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 53 54 );. MD5ST
1290: 45 50 28 46 32 2c 20 61 2c 20 62 2c 20 63 2c 20 EP(F2, a, b, c,
12a0: 64 2c 20 69 6e 5b 31 33 5d 2b 30 78 61 39 65 33 d, in[13]+0xa9e3
12b0: 65 39 30 35 2c 20 20 35 29 3b 0a 20 20 20 20 20 e905, 5);.
12c0: 20 20 20 4d 44 35 53 54 45 50 28 46 32 2c 20 64 MD5STEP(F2, d
12d0: 2c 20 61 2c 20 62 2c 20 63 2c 20 69 6e 5b 20 32 , a, b, c, in[ 2
12e0: 5d 2b 30 78 66 63 65 66 61 33 66 38 2c 20 20 39 ]+0xfcefa3f8, 9
12f0: 29 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 53 54 );. MD5ST
1300: 45 50 28 46 32 2c 20 63 2c 20 64 2c 20 61 2c 20 EP(F2, c, d, a,
1310: 62 2c 20 69 6e 5b 20 37 5d 2b 30 78 36 37 36 66 b, in[ 7]+0x676f
1320: 30 32 64 39 2c 20 31 34 29 3b 0a 20 20 20 20 20 02d9, 14);.
1330: 20 20 20 4d 44 35 53 54 45 50 28 46 32 2c 20 62 MD5STEP(F2, b
1340: 2c 20 63 2c 20 64 2c 20 61 2c 20 69 6e 5b 31 32 , c, d, a, in[12
1350: 5d 2b 30 78 38 64 32 61 34 63 38 61 2c 20 32 30 ]+0x8d2a4c8a, 20
1360: 29 3b 0a 0a 20 20 20 20 20 20 20 20 4d 44 35 53 );.. MD5S
1370: 54 45 50 28 46 33 2c 20 61 2c 20 62 2c 20 63 2c TEP(F3, a, b, c,
1380: 20 64 2c 20 69 6e 5b 20 35 5d 2b 30 78 66 66 66 d, in[ 5]+0xfff
1390: 61 33 39 34 32 2c 20 20 34 29 3b 0a 20 20 20 20 a3942, 4);.
13a0: 20 20 20 20 4d 44 35 53 54 45 50 28 46 33 2c 20 MD5STEP(F3,
13b0: 64 2c 20 61 2c 20 62 2c 20 63 2c 20 69 6e 5b 20 d, a, b, c, in[
13c0: 38 5d 2b 30 78 38 37 37 31 66 36 38 31 2c 20 31 8]+0x8771f681, 1
13d0: 31 29 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 53 1);. MD5S
13e0: 54 45 50 28 46 33 2c 20 63 2c 20 64 2c 20 61 2c TEP(F3, c, d, a,
13f0: 20 62 2c 20 69 6e 5b 31 31 5d 2b 30 78 36 64 39 b, in[11]+0x6d9
1400: 64 36 31 32 32 2c 20 31 36 29 3b 0a 20 20 20 20 d6122, 16);.
1410: 20 20 20 20 4d 44 35 53 54 45 50 28 46 33 2c 20 MD5STEP(F3,
1420: 62 2c 20 63 2c 20 64 2c 20 61 2c 20 69 6e 5b 31 b, c, d, a, in[1
1430: 34 5d 2b 30 78 66 64 65 35 33 38 30 63 2c 20 32 4]+0xfde5380c, 2
1440: 33 29 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 53 3);. MD5S
1450: 54 45 50 28 46 33 2c 20 61 2c 20 62 2c 20 63 2c TEP(F3, a, b, c,
1460: 20 64 2c 20 69 6e 5b 20 31 5d 2b 30 78 61 34 62 d, in[ 1]+0xa4b
1470: 65 65 61 34 34 2c 20 20 34 29 3b 0a 20 20 20 20 eea44, 4);.
1480: 20 20 20 20 4d 44 35 53 54 45 50 28 46 33 2c 20 MD5STEP(F3,
1490: 64 2c 20 61 2c 20 62 2c 20 63 2c 20 69 6e 5b 20 d, a, b, c, in[
14a0: 34 5d 2b 30 78 34 62 64 65 63 66 61 39 2c 20 31 4]+0x4bdecfa9, 1
14b0: 31 29 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 53 1);. MD5S
14c0: 54 45 50 28 46 33 2c 20 63 2c 20 64 2c 20 61 2c TEP(F3, c, d, a,
14d0: 20 62 2c 20 69 6e 5b 20 37 5d 2b 30 78 66 36 62 b, in[ 7]+0xf6b
14e0: 62 34 62 36 30 2c 20 31 36 29 3b 0a 20 20 20 20 b4b60, 16);.
14f0: 20 20 20 20 4d 44 35 53 54 45 50 28 46 33 2c 20 MD5STEP(F3,
1500: 62 2c 20 63 2c 20 64 2c 20 61 2c 20 69 6e 5b 31 b, c, d, a, in[1
1510: 30 5d 2b 30 78 62 65 62 66 62 63 37 30 2c 20 32 0]+0xbebfbc70, 2
1520: 33 29 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 53 3);. MD5S
1530: 54 45 50 28 46 33 2c 20 61 2c 20 62 2c 20 63 2c TEP(F3, a, b, c,
1540: 20 64 2c 20 69 6e 5b 31 33 5d 2b 30 78 32 38 39 d, in[13]+0x289
1550: 62 37 65 63 36 2c 20 20 34 29 3b 0a 20 20 20 20 b7ec6, 4);.
1560: 20 20 20 20 4d 44 35 53 54 45 50 28 46 33 2c 20 MD5STEP(F3,
1570: 64 2c 20 61 2c 20 62 2c 20 63 2c 20 69 6e 5b 20 d, a, b, c, in[
1580: 30 5d 2b 30 78 65 61 61 31 32 37 66 61 2c 20 31 0]+0xeaa127fa, 1
1590: 31 29 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 53 1);. MD5S
15a0: 54 45 50 28 46 33 2c 20 63 2c 20 64 2c 20 61 2c TEP(F3, c, d, a,
15b0: 20 62 2c 20 69 6e 5b 20 33 5d 2b 30 78 64 34 65 b, in[ 3]+0xd4e
15c0: 66 33 30 38 35 2c 20 31 36 29 3b 0a 20 20 20 20 f3085, 16);.
15d0: 20 20 20 20 4d 44 35 53 54 45 50 28 46 33 2c 20 MD5STEP(F3,
15e0: 62 2c 20 63 2c 20 64 2c 20 61 2c 20 69 6e 5b 20 b, c, d, a, in[
15f0: 36 5d 2b 30 78 30 34 38 38 31 64 30 35 2c 20 32 6]+0x04881d05, 2
1600: 33 29 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 53 3);. MD5S
1610: 54 45 50 28 46 33 2c 20 61 2c 20 62 2c 20 63 2c TEP(F3, a, b, c,
1620: 20 64 2c 20 69 6e 5b 20 39 5d 2b 30 78 64 39 64 d, in[ 9]+0xd9d
1630: 34 64 30 33 39 2c 20 20 34 29 3b 0a 20 20 20 20 4d039, 4);.
1640: 20 20 20 20 4d 44 35 53 54 45 50 28 46 33 2c 20 MD5STEP(F3,
1650: 64 2c 20 61 2c 20 62 2c 20 63 2c 20 69 6e 5b 31 d, a, b, c, in[1
1660: 32 5d 2b 30 78 65 36 64 62 39 39 65 35 2c 20 31 2]+0xe6db99e5, 1
1670: 31 29 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 53 1);. MD5S
1680: 54 45 50 28 46 33 2c 20 63 2c 20 64 2c 20 61 2c TEP(F3, c, d, a,
1690: 20 62 2c 20 69 6e 5b 31 35 5d 2b 30 78 31 66 61 b, in[15]+0x1fa
16a0: 32 37 63 66 38 2c 20 31 36 29 3b 0a 20 20 20 20 27cf8, 16);.
16b0: 20 20 20 20 4d 44 35 53 54 45 50 28 46 33 2c 20 MD5STEP(F3,
16c0: 62 2c 20 63 2c 20 64 2c 20 61 2c 20 69 6e 5b 20 b, c, d, a, in[
16d0: 32 5d 2b 30 78 63 34 61 63 35 36 36 35 2c 20 32 2]+0xc4ac5665, 2
16e0: 33 29 3b 0a 0a 20 20 20 20 20 20 20 20 4d 44 35 3);.. MD5
16f0: 53 54 45 50 28 46 34 2c 20 61 2c 20 62 2c 20 63 STEP(F4, a, b, c
1700: 2c 20 64 2c 20 69 6e 5b 20 30 5d 2b 30 78 66 34 , d, in[ 0]+0xf4
1710: 32 39 32 32 34 34 2c 20 20 36 29 3b 0a 20 20 20 292244, 6);.
1720: 20 20 20 20 20 4d 44 35 53 54 45 50 28 46 34 2c MD5STEP(F4,
1730: 20 64 2c 20 61 2c 20 62 2c 20 63 2c 20 69 6e 5b d, a, b, c, in[
1740: 20 37 5d 2b 30 78 34 33 32 61 66 66 39 37 2c 20 7]+0x432aff97,
1750: 31 30 29 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 10);. MD5
1760: 53 54 45 50 28 46 34 2c 20 63 2c 20 64 2c 20 61 STEP(F4, c, d, a
1770: 2c 20 62 2c 20 69 6e 5b 31 34 5d 2b 30 78 61 62 , b, in[14]+0xab
1780: 39 34 32 33 61 37 2c 20 31 35 29 3b 0a 20 20 20 9423a7, 15);.
1790: 20 20 20 20 20 4d 44 35 53 54 45 50 28 46 34 2c MD5STEP(F4,
17a0: 20 62 2c 20 63 2c 20 64 2c 20 61 2c 20 69 6e 5b b, c, d, a, in[
17b0: 20 35 5d 2b 30 78 66 63 39 33 61 30 33 39 2c 20 5]+0xfc93a039,
17c0: 32 31 29 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 21);. MD5
17d0: 53 54 45 50 28 46 34 2c 20 61 2c 20 62 2c 20 63 STEP(F4, a, b, c
17e0: 2c 20 64 2c 20 69 6e 5b 31 32 5d 2b 30 78 36 35 , d, in[12]+0x65
17f0: 35 62 35 39 63 33 2c 20 20 36 29 3b 0a 20 20 20 5b59c3, 6);.
1800: 20 20 20 20 20 4d 44 35 53 54 45 50 28 46 34 2c MD5STEP(F4,
1810: 20 64 2c 20 61 2c 20 62 2c 20 63 2c 20 69 6e 5b d, a, b, c, in[
1820: 20 33 5d 2b 30 78 38 66 30 63 63 63 39 32 2c 20 3]+0x8f0ccc92,
1830: 31 30 29 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 10);. MD5
1840: 53 54 45 50 28 46 34 2c 20 63 2c 20 64 2c 20 61 STEP(F4, c, d, a
1850: 2c 20 62 2c 20 69 6e 5b 31 30 5d 2b 30 78 66 66 , b, in[10]+0xff
1860: 65 66 66 34 37 64 2c 20 31 35 29 3b 0a 20 20 20 eff47d, 15);.
1870: 20 20 20 20 20 4d 44 35 53 54 45 50 28 46 34 2c MD5STEP(F4,
1880: 20 62 2c 20 63 2c 20 64 2c 20 61 2c 20 69 6e 5b b, c, d, a, in[
1890: 20 31 5d 2b 30 78 38 35 38 34 35 64 64 31 2c 20 1]+0x85845dd1,
18a0: 32 31 29 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 21);. MD5
18b0: 53 54 45 50 28 46 34 2c 20 61 2c 20 62 2c 20 63 STEP(F4, a, b, c
18c0: 2c 20 64 2c 20 69 6e 5b 20 38 5d 2b 30 78 36 66 , d, in[ 8]+0x6f
18d0: 61 38 37 65 34 66 2c 20 20 36 29 3b 0a 20 20 20 a87e4f, 6);.
18e0: 20 20 20 20 20 4d 44 35 53 54 45 50 28 46 34 2c MD5STEP(F4,
18f0: 20 64 2c 20 61 2c 20 62 2c 20 63 2c 20 69 6e 5b d, a, b, c, in[
1900: 31 35 5d 2b 30 78 66 65 32 63 65 36 65 30 2c 20 15]+0xfe2ce6e0,
1910: 31 30 29 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 10);. MD5
1920: 53 54 45 50 28 46 34 2c 20 63 2c 20 64 2c 20 61 STEP(F4, c, d, a
1930: 2c 20 62 2c 20 69 6e 5b 20 36 5d 2b 30 78 61 33 , b, in[ 6]+0xa3
1940: 30 31 34 33 31 34 2c 20 31 35 29 3b 0a 20 20 20 014314, 15);.
1950: 20 20 20 20 20 4d 44 35 53 54 45 50 28 46 34 2c MD5STEP(F4,
1960: 20 62 2c 20 63 2c 20 64 2c 20 61 2c 20 69 6e 5b b, c, d, a, in[
1970: 31 33 5d 2b 30 78 34 65 30 38 31 31 61 31 2c 20 13]+0x4e0811a1,
1980: 32 31 29 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 21);. MD5
1990: 53 54 45 50 28 46 34 2c 20 61 2c 20 62 2c 20 63 STEP(F4, a, b, c
19a0: 2c 20 64 2c 20 69 6e 5b 20 34 5d 2b 30 78 66 37 , d, in[ 4]+0xf7
19b0: 35 33 37 65 38 32 2c 20 20 36 29 3b 0a 20 20 20 537e82, 6);.
19c0: 20 20 20 20 20 4d 44 35 53 54 45 50 28 46 34 2c MD5STEP(F4,
19d0: 20 64 2c 20 61 2c 20 62 2c 20 63 2c 20 69 6e 5b d, a, b, c, in[
19e0: 31 31 5d 2b 30 78 62 64 33 61 66 32 33 35 2c 20 11]+0xbd3af235,
19f0: 31 30 29 3b 0a 20 20 20 20 20 20 20 20 4d 44 35 10);. MD5
1a00: 53 54 45 50 28 46 34 2c 20 63 2c 20 64 2c 20 61 STEP(F4, c, d, a
1a10: 2c 20 62 2c 20 69 6e 5b 20 32 5d 2b 30 78 32 61 , b, in[ 2]+0x2a
1a20: 64 37 64 32 62 62 2c 20 31 35 29 3b 0a 20 20 20 d7d2bb, 15);.
1a30: 20 20 20 20 20 4d 44 35 53 54 45 50 28 46 34 2c MD5STEP(F4,
1a40: 20 62 2c 20 63 2c 20 64 2c 20 61 2c 20 69 6e 5b b, c, d, a, in[
1a50: 20 39 5d 2b 30 78 65 62 38 36 64 33 39 31 2c 20 9]+0xeb86d391,
1a60: 32 31 29 3b 0a 0a 20 20 20 20 20 20 20 20 62 75 21);.. bu
1a70: 66 5b 30 5d 20 2b 3d 20 61 3b 0a 20 20 20 20 20 f[0] += a;.
1a80: 20 20 20 62 75 66 5b 31 5d 20 2b 3d 20 62 3b 0a buf[1] += b;.
1a90: 20 20 20 20 20 20 20 20 62 75 66 5b 32 5d 20 2b buf[2] +
1aa0: 3d 20 63 3b 0a 20 20 20 20 20 20 20 20 62 75 66 = c;. buf
1ab0: 5b 33 5d 20 2b 3d 20 64 3b 0a 7d 0a 0a 2f 2a 0a [3] += d;.}../*.
1ac0: 20 2a 20 53 74 61 72 74 20 4d 44 35 20 61 63 63 * Start MD5 acc
1ad0: 75 6d 75 6c 61 74 69 6f 6e 2e 20 20 53 65 74 20 umulation. Set
1ae0: 62 69 74 20 63 6f 75 6e 74 20 74 6f 20 30 20 61 bit count to 0 a
1af0: 6e 64 20 62 75 66 66 65 72 20 74 6f 20 6d 79 73 nd buffer to mys
1b00: 74 65 72 69 6f 75 73 0a 20 2a 20 69 6e 69 74 69 terious. * initi
1b10: 61 6c 69 7a 61 74 69 6f 6e 20 63 6f 6e 73 74 61 alization consta
1b20: 6e 74 73 2e 0a 20 2a 2f 0a 73 74 61 74 69 63 20 nts.. */.static
1b30: 76 6f 69 64 20 4d 44 35 49 6e 69 74 28 4d 44 35 void MD5Init(MD5
1b40: 43 6f 6e 74 65 78 74 20 2a 63 74 78 29 7b 0a 20 Context *ctx){.
1b50: 20 20 20 20 20 20 20 63 74 78 2d 3e 69 73 49 6e ctx->isIn
1b60: 69 74 20 3d 20 31 3b 0a 20 20 20 20 20 20 20 20 it = 1;.
1b70: 63 74 78 2d 3e 62 75 66 5b 30 5d 20 3d 20 30 78 ctx->buf[0] = 0x
1b80: 36 37 34 35 32 33 30 31 3b 0a 20 20 20 20 20 20 67452301;.
1b90: 20 20 63 74 78 2d 3e 62 75 66 5b 31 5d 20 3d 20 ctx->buf[1] =
1ba0: 30 78 65 66 63 64 61 62 38 39 3b 0a 20 20 20 20 0xefcdab89;.
1bb0: 20 20 20 20 63 74 78 2d 3e 62 75 66 5b 32 5d 20 ctx->buf[2]
1bc0: 3d 20 30 78 39 38 62 61 64 63 66 65 3b 0a 20 20 = 0x98badcfe;.
1bd0: 20 20 20 20 20 20 63 74 78 2d 3e 62 75 66 5b 33 ctx->buf[3
1be0: 5d 20 3d 20 30 78 31 30 33 32 35 34 37 36 3b 0a ] = 0x10325476;.
1bf0: 20 20 20 20 20 20 20 20 63 74 78 2d 3e 62 69 74 ctx->bit
1c00: 73 5b 30 5d 20 3d 20 30 3b 0a 20 20 20 20 20 20 s[0] = 0;.
1c10: 20 20 63 74 78 2d 3e 62 69 74 73 5b 31 5d 20 3d ctx->bits[1] =
1c20: 20 30 3b 0a 7d 0a 0a 2f 2a 0a 20 2a 20 55 70 64 0;.}../*. * Upd
1c30: 61 74 65 20 63 6f 6e 74 65 78 74 20 74 6f 20 72 ate context to r
1c40: 65 66 6c 65 63 74 20 74 68 65 20 63 6f 6e 63 61 eflect the conca
1c50: 74 65 6e 61 74 69 6f 6e 20 6f 66 20 61 6e 6f 74 tenation of anot
1c60: 68 65 72 20 62 75 66 66 65 72 20 66 75 6c 6c 0a her buffer full.
1c70: 20 2a 20 6f 66 20 62 79 74 65 73 2e 0a 20 2a 2f * of bytes.. */
1c80: 0a 73 74 61 74 69 63 20 0a 76 6f 69 64 20 4d 44 .static .void MD
1c90: 35 55 70 64 61 74 65 28 4d 44 35 43 6f 6e 74 65 5Update(MD5Conte
1ca0: 78 74 20 2a 70 43 74 78 2c 20 63 6f 6e 73 74 20 xt *pCtx, const
1cb0: 75 6e 73 69 67 6e 65 64 20 63 68 61 72 20 2a 62 unsigned char *b
1cc0: 75 66 2c 20 75 6e 73 69 67 6e 65 64 20 69 6e 74 uf, unsigned int
1cd0: 20 6c 65 6e 29 7b 0a 20 20 20 20 20 20 20 20 73 len){. s
1ce0: 74 72 75 63 74 20 43 6f 6e 74 65 78 74 20 2a 63 truct Context *c
1cf0: 74 78 20 3d 20 28 73 74 72 75 63 74 20 43 6f 6e tx = (struct Con
1d00: 74 65 78 74 20 2a 29 70 43 74 78 3b 0a 20 20 20 text *)pCtx;.
1d10: 20 20 20 20 20 75 69 6e 74 33 32 20 74 3b 0a 0a uint32 t;..
1d20: 20 20 20 20 20 20 20 20 2f 2a 20 55 70 64 61 74 /* Updat
1d30: 65 20 62 69 74 63 6f 75 6e 74 20 2a 2f 0a 0a 20 e bitcount */..
1d40: 20 20 20 20 20 20 20 74 20 3d 20 63 74 78 2d 3e t = ctx->
1d50: 62 69 74 73 5b 30 5d 3b 0a 20 20 20 20 20 20 20 bits[0];.
1d60: 20 69 66 20 28 28 63 74 78 2d 3e 62 69 74 73 5b if ((ctx->bits[
1d70: 30 5d 20 3d 20 74 20 2b 20 28 28 75 69 6e 74 33 0] = t + ((uint3
1d80: 32 29 6c 65 6e 20 3c 3c 20 33 29 29 20 3c 20 74 2)len << 3)) < t
1d90: 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 ).
1da0: 20 20 63 74 78 2d 3e 62 69 74 73 5b 31 5d 2b 2b ctx->bits[1]++
1db0: 3b 20 2f 2a 20 43 61 72 72 79 20 66 72 6f 6d 20 ; /* Carry from
1dc0: 6c 6f 77 20 74 6f 20 68 69 67 68 20 2a 2f 0a 20 low to high */.
1dd0: 20 20 20 20 20 20 20 63 74 78 2d 3e 62 69 74 73 ctx->bits
1de0: 5b 31 5d 20 2b 3d 20 6c 65 6e 20 3e 3e 20 32 39 [1] += len >> 29
1df0: 3b 0a 0a 20 20 20 20 20 20 20 20 74 20 3d 20 28 ;.. t = (
1e00: 74 20 3e 3e 20 33 29 20 26 20 30 78 33 66 3b 20 t >> 3) & 0x3f;
1e10: 20 20 20 2f 2a 20 42 79 74 65 73 20 61 6c 72 65 /* Bytes alre
1e20: 61 64 79 20 69 6e 20 73 68 73 49 6e 66 6f 2d 3e ady in shsInfo->
1e30: 64 61 74 61 20 2a 2f 0a 0a 20 20 20 20 20 20 20 data */..
1e40: 20 2f 2a 20 48 61 6e 64 6c 65 20 61 6e 79 20 6c /* Handle any l
1e50: 65 61 64 69 6e 67 20 6f 64 64 2d 73 69 7a 65 64 eading odd-sized
1e60: 20 63 68 75 6e 6b 73 20 2a 2f 0a 0a 20 20 20 20 chunks */..
1e70: 20 20 20 20 69 66 20 28 20 74 20 29 20 7b 0a 20 if ( t ) {.
1e80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 75 u
1e90: 6e 73 69 67 6e 65 64 20 63 68 61 72 20 2a 70 20 nsigned char *p
1ea0: 3d 20 28 75 6e 73 69 67 6e 65 64 20 63 68 61 72 = (unsigned char
1eb0: 20 2a 29 63 74 78 2d 3e 69 6e 20 2b 20 74 3b 0a *)ctx->in + t;.
1ec0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1ed0: 20 74 20 3d 20 36 34 2d 74 3b 0a 20 20 20 20 20 t = 64-t;.
1ee0: 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 6c if (l
1ef0: 65 6e 20 3c 20 74 29 20 7b 0a 20 20 20 20 20 20 en < t) {.
1f00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1f10: 20 20 6d 65 6d 63 70 79 28 70 2c 20 62 75 66 2c memcpy(p, buf,
1f20: 20 6c 65 6e 29 3b 0a 20 20 20 20 20 20 20 20 20 len);.
1f30: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 72 r
1f40: 65 74 75 72 6e 3b 0a 20 20 20 20 20 20 20 20 20 eturn;.
1f50: 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 }.
1f60: 20 20 20 20 20 20 20 20 20 6d 65 6d 63 70 79 28 memcpy(
1f70: 70 2c 20 62 75 66 2c 20 74 29 3b 0a 20 20 20 20 p, buf, t);.
1f80: 20 20 20 20 20 20 20 20 20 20 20 20 62 79 74 65 byte
1f90: 52 65 76 65 72 73 65 28 63 74 78 2d 3e 69 6e 2c Reverse(ctx->in,
1fa0: 20 31 36 29 3b 0a 20 20 20 20 20 20 20 20 20 20 16);.
1fb0: 20 20 20 20 20 20 4d 44 35 54 72 61 6e 73 66 6f MD5Transfo
1fc0: 72 6d 28 63 74 78 2d 3e 62 75 66 2c 20 28 75 69 rm(ctx->buf, (ui
1fd0: 6e 74 33 32 20 2a 29 63 74 78 2d 3e 69 6e 29 3b nt32 *)ctx->in);
1fe0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
1ff0: 20 62 75 66 20 2b 3d 20 74 3b 0a 20 20 20 20 20 buf += t;.
2000: 20 20 20 20 20 20 20 20 20 20 20 6c 65 6e 20 2d len -
2010: 3d 20 74 3b 0a 20 20 20 20 20 20 20 20 7d 0a 0a = t;. }..
2020: 20 20 20 20 20 20 20 20 2f 2a 20 50 72 6f 63 65 /* Proce
2030: 73 73 20 64 61 74 61 20 69 6e 20 36 34 2d 62 79 ss data in 64-by
2040: 74 65 20 63 68 75 6e 6b 73 20 2a 2f 0a 0a 20 20 te chunks */..
2050: 20 20 20 20 20 20 77 68 69 6c 65 20 28 6c 65 6e while (len
2060: 20 3e 3d 20 36 34 29 20 7b 0a 20 20 20 20 20 20 >= 64) {.
2070: 20 20 20 20 20 20 20 20 20 20 6d 65 6d 63 70 79 memcpy
2080: 28 63 74 78 2d 3e 69 6e 2c 20 62 75 66 2c 20 36 (ctx->in, buf, 6
2090: 34 29 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 4);.
20a0: 20 20 20 20 62 79 74 65 52 65 76 65 72 73 65 28 byteReverse(
20b0: 63 74 78 2d 3e 69 6e 2c 20 31 36 29 3b 0a 20 20 ctx->in, 16);.
20c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 4d 44 MD
20d0: 35 54 72 61 6e 73 66 6f 72 6d 28 63 74 78 2d 3e 5Transform(ctx->
20e0: 62 75 66 2c 20 28 75 69 6e 74 33 32 20 2a 29 63 buf, (uint32 *)c
20f0: 74 78 2d 3e 69 6e 29 3b 0a 20 20 20 20 20 20 20 tx->in);.
2100: 20 20 20 20 20 20 20 20 20 62 75 66 20 2b 3d 20 buf +=
2110: 36 34 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 64;.
2120: 20 20 20 20 6c 65 6e 20 2d 3d 20 36 34 3b 0a 20 len -= 64;.
2130: 20 20 20 20 20 20 20 7d 0a 0a 20 20 20 20 20 20 }..
2140: 20 20 2f 2a 20 48 61 6e 64 6c 65 20 61 6e 79 20 /* Handle any
2150: 72 65 6d 61 69 6e 69 6e 67 20 62 79 74 65 73 20 remaining bytes
2160: 6f 66 20 64 61 74 61 2e 20 2a 2f 0a 0a 20 20 20 of data. */..
2170: 20 20 20 20 20 6d 65 6d 63 70 79 28 63 74 78 2d memcpy(ctx-
2180: 3e 69 6e 2c 20 62 75 66 2c 20 6c 65 6e 29 3b 0a >in, buf, len);.
2190: 7d 0a 0a 2f 2a 0a 20 2a 20 46 69 6e 61 6c 20 77 }../*. * Final w
21a0: 72 61 70 75 70 20 2d 20 70 61 64 20 74 6f 20 36 rapup - pad to 6
21b0: 34 2d 62 79 74 65 20 62 6f 75 6e 64 61 72 79 20 4-byte boundary
21c0: 77 69 74 68 20 74 68 65 20 62 69 74 20 70 61 74 with the bit pat
21d0: 74 65 72 6e 20 0a 20 2a 20 31 20 30 2a 20 28 36 tern . * 1 0* (6
21e0: 34 2d 62 69 74 20 63 6f 75 6e 74 20 6f 66 20 62 4-bit count of b
21f0: 69 74 73 20 70 72 6f 63 65 73 73 65 64 2c 20 4d its processed, M
2200: 53 42 2d 66 69 72 73 74 29 0a 20 2a 2f 0a 73 74 SB-first). */.st
2210: 61 74 69 63 20 76 6f 69 64 20 4d 44 35 46 69 6e atic void MD5Fin
2220: 61 6c 28 75 6e 73 69 67 6e 65 64 20 63 68 61 72 al(unsigned char
2230: 20 64 69 67 65 73 74 5b 31 36 5d 2c 20 4d 44 35 digest[16], MD5
2240: 43 6f 6e 74 65 78 74 20 2a 70 43 74 78 29 7b 0a Context *pCtx){.
2250: 20 20 20 20 20 20 20 20 73 74 72 75 63 74 20 43 struct C
2260: 6f 6e 74 65 78 74 20 2a 63 74 78 20 3d 20 28 73 ontext *ctx = (s
2270: 74 72 75 63 74 20 43 6f 6e 74 65 78 74 20 2a 29 truct Context *)
2280: 70 43 74 78 3b 0a 20 20 20 20 20 20 20 20 75 6e pCtx;. un
2290: 73 69 67 6e 65 64 20 63 6f 75 6e 74 3b 0a 20 20 signed count;.
22a0: 20 20 20 20 20 20 75 6e 73 69 67 6e 65 64 20 63 unsigned c
22b0: 68 61 72 20 2a 70 3b 0a 0a 20 20 20 20 20 20 20 har *p;..
22c0: 20 2f 2a 20 43 6f 6d 70 75 74 65 20 6e 75 6d 62 /* Compute numb
22d0: 65 72 20 6f 66 20 62 79 74 65 73 20 6d 6f 64 20 er of bytes mod
22e0: 36 34 20 2a 2f 0a 20 20 20 20 20 20 20 20 63 6f 64 */. co
22f0: 75 6e 74 20 3d 20 28 63 74 78 2d 3e 62 69 74 73 unt = (ctx->bits
2300: 5b 30 5d 20 3e 3e 20 33 29 20 26 20 30 78 33 46 [0] >> 3) & 0x3F
2310: 3b 0a 0a 20 20 20 20 20 20 20 20 2f 2a 20 53 65 ;.. /* Se
2320: 74 20 74 68 65 20 66 69 72 73 74 20 63 68 61 72 t the first char
2330: 20 6f 66 20 70 61 64 64 69 6e 67 20 74 6f 20 30 of padding to 0
2340: 78 38 30 2e 20 20 54 68 69 73 20 69 73 20 73 61 x80. This is sa
2350: 66 65 20 73 69 6e 63 65 20 74 68 65 72 65 20 69 fe since there i
2360: 73 0a 20 20 20 20 20 20 20 20 20 20 20 61 6c 77 s. alw
2370: 61 79 73 20 61 74 20 6c 65 61 73 74 20 6f 6e 65 ays at least one
2380: 20 62 79 74 65 20 66 72 65 65 20 2a 2f 0a 20 20 byte free */.
2390: 20 20 20 20 20 20 70 20 3d 20 63 74 78 2d 3e 69 p = ctx->i
23a0: 6e 20 2b 20 63 6f 75 6e 74 3b 0a 20 20 20 20 20 n + count;.
23b0: 20 20 20 2a 70 2b 2b 20 3d 20 30 78 38 30 3b 0a *p++ = 0x80;.
23c0: 0a 20 20 20 20 20 20 20 20 2f 2a 20 42 79 74 65 . /* Byte
23d0: 73 20 6f 66 20 70 61 64 64 69 6e 67 20 6e 65 65 s of padding nee
23e0: 64 65 64 20 74 6f 20 6d 61 6b 65 20 36 34 20 62 ded to make 64 b
23f0: 79 74 65 73 20 2a 2f 0a 20 20 20 20 20 20 20 20 ytes */.
2400: 63 6f 75 6e 74 20 3d 20 36 34 20 2d 20 31 20 2d count = 64 - 1 -
2410: 20 63 6f 75 6e 74 3b 0a 0a 20 20 20 20 20 20 20 count;..
2420: 20 2f 2a 20 50 61 64 20 6f 75 74 20 74 6f 20 35 /* Pad out to 5
2430: 36 20 6d 6f 64 20 36 34 20 2a 2f 0a 20 20 20 20 6 mod 64 */.
2440: 20 20 20 20 69 66 20 28 63 6f 75 6e 74 20 3c 20 if (count <
2450: 38 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 8) {.
2460: 20 20 20 20 20 2f 2a 20 54 77 6f 20 6c 6f 74 73 /* Two lots
2470: 20 6f 66 20 70 61 64 64 69 6e 67 3a 20 20 50 61 of padding: Pa
2480: 64 20 74 68 65 20 66 69 72 73 74 20 62 6c 6f 63 d the first bloc
2490: 6b 20 74 6f 20 36 34 20 62 79 74 65 73 20 2a 2f k to 64 bytes */
24a0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
24b0: 20 6d 65 6d 73 65 74 28 70 2c 20 30 2c 20 63 6f memset(p, 0, co
24c0: 75 6e 74 29 3b 0a 20 20 20 20 20 20 20 20 20 20 unt);.
24d0: 20 20 20 20 20 20 62 79 74 65 52 65 76 65 72 73 byteRevers
24e0: 65 28 63 74 78 2d 3e 69 6e 2c 20 31 36 29 3b 0a e(ctx->in, 16);.
24f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2500: 4d 44 35 54 72 61 6e 73 66 6f 72 6d 28 63 74 78 MD5Transform(ctx
2510: 2d 3e 62 75 66 2c 20 28 75 69 6e 74 33 32 20 2a ->buf, (uint32 *
2520: 29 63 74 78 2d 3e 69 6e 29 3b 0a 0a 20 20 20 20 )ctx->in);..
2530: 20 20 20 20 20 20 20 20 20 20 20 20 2f 2a 20 4e /* N
2540: 6f 77 20 66 69 6c 6c 20 74 68 65 20 6e 65 78 74 ow fill the next
2550: 20 62 6c 6f 63 6b 20 77 69 74 68 20 35 36 20 62 block with 56 b
2560: 79 74 65 73 20 2a 2f 0a 20 20 20 20 20 20 20 20 ytes */.
2570: 20 20 20 20 20 20 20 20 6d 65 6d 73 65 74 28 63 memset(c
2580: 74 78 2d 3e 69 6e 2c 20 30 2c 20 35 36 29 3b 0a tx->in, 0, 56);.
2590: 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b } else {
25a0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
25b0: 20 2f 2a 20 50 61 64 20 62 6c 6f 63 6b 20 74 6f /* Pad block to
25c0: 20 35 36 20 62 79 74 65 73 20 2a 2f 0a 20 20 20 56 bytes */.
25d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 6d 65 6d mem
25e0: 73 65 74 28 70 2c 20 30 2c 20 63 6f 75 6e 74 2d set(p, 0, count-
25f0: 38 29 3b 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 8);. }.
2600: 20 20 20 20 20 20 62 79 74 65 52 65 76 65 72 73 byteRevers
2610: 65 28 63 74 78 2d 3e 69 6e 2c 20 31 34 29 3b 0a e(ctx->in, 14);.
2620: 0a 20 20 20 20 20 20 20 20 2f 2a 20 41 70 70 65 . /* Appe
2630: 6e 64 20 6c 65 6e 67 74 68 20 69 6e 20 62 69 74 nd length in bit
2640: 73 20 61 6e 64 20 74 72 61 6e 73 66 6f 72 6d 20 s and transform
2650: 2a 2f 0a 20 20 20 20 20 20 20 20 28 28 75 69 6e */. ((uin
2660: 74 33 32 20 2a 29 63 74 78 2d 3e 69 6e 29 5b 20 t32 *)ctx->in)[
2670: 31 34 20 5d 20 3d 20 63 74 78 2d 3e 62 69 74 73 14 ] = ctx->bits
2680: 5b 30 5d 3b 0a 20 20 20 20 20 20 20 20 28 28 75 [0];. ((u
2690: 69 6e 74 33 32 20 2a 29 63 74 78 2d 3e 69 6e 29 int32 *)ctx->in)
26a0: 5b 20 31 35 20 5d 20 3d 20 63 74 78 2d 3e 62 69 [ 15 ] = ctx->bi
26b0: 74 73 5b 31 5d 3b 0a 0a 20 20 20 20 20 20 20 20 ts[1];..
26c0: 4d 44 35 54 72 61 6e 73 66 6f 72 6d 28 63 74 78 MD5Transform(ctx
26d0: 2d 3e 62 75 66 2c 20 28 75 69 6e 74 33 32 20 2a ->buf, (uint32 *
26e0: 29 63 74 78 2d 3e 69 6e 29 3b 0a 20 20 20 20 20 )ctx->in);.
26f0: 20 20 20 62 79 74 65 52 65 76 65 72 73 65 28 28 byteReverse((
2700: 75 6e 73 69 67 6e 65 64 20 63 68 61 72 20 2a 29 unsigned char *)
2710: 63 74 78 2d 3e 62 75 66 2c 20 34 29 3b 0a 20 20 ctx->buf, 4);.
2720: 20 20 20 20 20 20 6d 65 6d 63 70 79 28 64 69 67 memcpy(dig
2730: 65 73 74 2c 20 63 74 78 2d 3e 62 75 66 2c 20 31 est, ctx->buf, 1
2740: 36 29 3b 0a 20 20 20 20 20 20 20 20 6d 65 6d 73 6);. mems
2750: 65 74 28 63 74 78 2c 20 30 2c 20 73 69 7a 65 6f et(ctx, 0, sizeo
2760: 66 28 63 74 78 29 29 3b 20 20 20 20 2f 2a 20 49 f(ctx)); /* I
2770: 6e 20 63 61 73 65 20 69 74 20 69 73 20 73 65 6e n case it is sen
2780: 73 69 74 69 76 65 20 2a 2f 0a 7d 0a 0a 2f 2a 0a sitive */.}../*.
2790: 2a 2a 20 43 6f 6e 76 65 72 74 20 61 20 64 69 67 ** Convert a dig
27a0: 65 73 74 20 69 6e 74 6f 20 62 61 73 65 2d 31 36 est into base-16
27b0: 2e 20 20 64 69 67 65 73 74 20 73 68 6f 75 6c 64 . digest should
27c0: 20 62 65 20 64 65 63 6c 61 72 65 64 20 61 73 0a be declared as.
27d0: 2a 2a 20 22 75 6e 73 69 67 6e 65 64 20 63 68 61 ** "unsigned cha
27e0: 72 20 64 69 67 65 73 74 5b 31 36 5d 22 20 69 6e r digest[16]" in
27f0: 20 74 68 65 20 63 61 6c 6c 69 6e 67 20 66 75 6e the calling fun
2800: 63 74 69 6f 6e 2e 20 20 54 68 65 20 4d 44 35 0a ction. The MD5.
2810: 2a 2a 20 64 69 67 65 73 74 20 69 73 20 73 74 6f ** digest is sto
2820: 72 65 64 20 69 6e 20 74 68 65 20 66 69 72 73 74 red in the first
2830: 20 31 36 20 62 79 74 65 73 2e 20 20 7a 42 75 66 16 bytes. zBuf
2840: 20 73 68 6f 75 6c 64 0a 2a 2a 20 62 65 20 22 63 should.** be "c
2850: 68 61 72 20 7a 42 75 66 5b 33 33 5d 22 2e 0a 2a har zBuf[33]"..*
2860: 2f 0a 73 74 61 74 69 63 20 76 6f 69 64 20 44 69 /.static void Di
2870: 67 65 73 74 54 6f 42 61 73 65 31 36 28 75 6e 73 gestToBase16(uns
2880: 69 67 6e 65 64 20 63 68 61 72 20 2a 64 69 67 65 igned char *dige
2890: 73 74 2c 20 63 68 61 72 20 2a 7a 42 75 66 29 7b st, char *zBuf){
28a0: 0a 20 20 73 74 61 74 69 63 20 63 68 61 72 20 63 . static char c
28b0: 6f 6e 73 74 20 7a 45 6e 63 6f 64 65 5b 5d 20 3d onst zEncode[] =
28c0: 20 22 30 31 32 33 34 35 36 37 38 39 61 62 63 64 "0123456789abcd
28d0: 65 66 22 3b 0a 20 20 69 6e 74 20 69 2c 20 6a 3b ef";. int i, j;
28e0: 0a 0a 20 20 66 6f 72 28 6a 3d 69 3d 30 3b 20 69 .. for(j=i=0; i
28f0: 3c 31 36 3b 20 69 2b 2b 29 7b 0a 20 20 20 20 69 <16; i++){. i
2900: 6e 74 20 61 20 3d 20 64 69 67 65 73 74 5b 69 5d nt a = digest[i]
2910: 3b 0a 20 20 20 20 7a 42 75 66 5b 6a 2b 2b 5d 20 ;. zBuf[j++]
2920: 3d 20 7a 45 6e 63 6f 64 65 5b 28 61 3e 3e 34 29 = zEncode[(a>>4)
2930: 26 30 78 66 5d 3b 0a 20 20 20 20 7a 42 75 66 5b &0xf];. zBuf[
2940: 6a 2b 2b 5d 20 3d 20 7a 45 6e 63 6f 64 65 5b 61 j++] = zEncode[a
2950: 20 26 20 30 78 66 5d 3b 0a 20 20 7d 0a 20 20 7a & 0xf];. }. z
2960: 42 75 66 5b 6a 5d 20 3d 20 30 3b 0a 7d 0a 0a 2f Buf[j] = 0;.}../
2970: 2a 0a 2a 2a 20 41 20 54 43 4c 20 63 6f 6d 6d 61 *.** A TCL comma
2980: 6e 64 20 66 6f 72 20 6d 64 35 2e 20 20 54 68 65 nd for md5. The
2990: 20 61 72 67 75 6d 65 6e 74 20 69 73 20 74 68 65 argument is the
29a0: 20 74 65 78 74 20 74 6f 20 62 65 20 68 61 73 68 text to be hash
29b0: 65 64 2e 20 20 54 68 65 0a 2a 2a 20 52 65 73 75 ed. The.** Resu
29c0: 6c 74 20 69 73 20 74 68 65 20 68 61 73 68 20 69 lt is the hash i
29d0: 6e 20 62 61 73 65 36 34 2e 20 20 0a 2a 2f 0a 73 n base64. .*/.s
29e0: 74 61 74 69 63 20 69 6e 74 20 6d 64 35 5f 63 6d tatic int md5_cm
29f0: 64 28 76 6f 69 64 2a 63 64 2c 20 54 63 6c 5f 49 d(void*cd, Tcl_I
2a00: 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 20 69 nterp *interp, i
2a10: 6e 74 20 61 72 67 63 2c 20 63 6f 6e 73 74 20 63 nt argc, const c
2a20: 68 61 72 20 2a 2a 61 72 67 76 29 7b 0a 20 20 4d har **argv){. M
2a30: 44 35 43 6f 6e 74 65 78 74 20 63 74 78 3b 0a 20 D5Context ctx;.
2a40: 20 75 6e 73 69 67 6e 65 64 20 63 68 61 72 20 64 unsigned char d
2a50: 69 67 65 73 74 5b 31 36 5d 3b 0a 0a 20 20 69 66 igest[16];.. if
2a60: 28 20 61 72 67 63 21 3d 32 20 29 7b 0a 20 20 20 ( argc!=2 ){.
2a70: 20 54 63 6c 5f 41 70 70 65 6e 64 52 65 73 75 6c Tcl_AppendResul
2a80: 74 28 69 6e 74 65 72 70 2c 22 77 72 6f 6e 67 20 t(interp,"wrong
2a90: 23 20 61 72 67 73 3a 20 73 68 6f 75 6c 64 20 62 # args: should b
2aa0: 65 20 5c 22 22 2c 20 61 72 67 76 5b 30 5d 2c 20 e \"", argv[0],
2ab0: 0a 20 20 20 20 20 20 20 20 22 20 54 45 58 54 5c . " TEXT\
2ac0: 22 22 2c 20 30 29 3b 0a 20 20 20 20 72 65 74 75 "", 0);. retu
2ad0: 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 20 20 rn TCL_ERROR;.
2ae0: 7d 0a 20 20 4d 44 35 49 6e 69 74 28 26 63 74 78 }. MD5Init(&ctx
2af0: 29 3b 0a 20 20 4d 44 35 55 70 64 61 74 65 28 26 );. MD5Update(&
2b00: 63 74 78 2c 20 28 75 6e 73 69 67 6e 65 64 20 63 ctx, (unsigned c
2b10: 68 61 72 2a 29 61 72 67 76 5b 31 5d 2c 20 28 75 har*)argv[1], (u
2b20: 6e 73 69 67 6e 65 64 29 73 74 72 6c 65 6e 28 61 nsigned)strlen(a
2b30: 72 67 76 5b 31 5d 29 29 3b 0a 20 20 4d 44 35 46 rgv[1]));. MD5F
2b40: 69 6e 61 6c 28 64 69 67 65 73 74 2c 20 26 63 74 inal(digest, &ct
2b50: 78 29 3b 0a 20 20 44 69 67 65 73 74 54 6f 42 61 x);. DigestToBa
2b60: 73 65 31 36 28 64 69 67 65 73 74 2c 20 69 6e 74 se16(digest, int
2b70: 65 72 70 2d 3e 72 65 73 75 6c 74 29 3b 0a 20 20 erp->result);.
2b80: 72 65 74 75 72 6e 20 54 43 4c 5f 4f 4b 3b 0a 7d return TCL_OK;.}
2b90: 0a 0a 2f 2a 0a 2a 2a 20 41 20 54 43 4c 20 63 6f ../*.** A TCL co
2ba0: 6d 6d 61 6e 64 20 74 6f 20 74 61 6b 65 20 74 68 mmand to take th
2bb0: 65 20 6d 64 35 20 68 61 73 68 20 6f 66 20 61 20 e md5 hash of a
2bc0: 66 69 6c 65 2e 20 20 54 68 65 20 61 72 67 75 6d file. The argum
2bd0: 65 6e 74 20 69 73 20 74 68 65 0a 2a 2a 20 6e 61 ent is the.** na
2be0: 6d 65 20 6f 66 20 74 68 65 20 66 69 6c 65 2e 0a me of the file..
2bf0: 2a 2f 0a 73 74 61 74 69 63 20 69 6e 74 20 6d 64 */.static int md
2c00: 35 66 69 6c 65 5f 63 6d 64 28 76 6f 69 64 2a 63 5file_cmd(void*c
2c10: 64 2c 20 54 63 6c 5f 49 6e 74 65 72 70 2a 69 6e d, Tcl_Interp*in
2c20: 74 65 72 70 2c 20 69 6e 74 20 61 72 67 63 2c 20 terp, int argc,
2c30: 63 6f 6e 73 74 20 63 68 61 72 20 2a 2a 61 72 67 const char **arg
2c40: 76 29 7b 0a 20 20 46 49 4c 45 20 2a 69 6e 3b 0a v){. FILE *in;.
2c50: 20 20 4d 44 35 43 6f 6e 74 65 78 74 20 63 74 78 MD5Context ctx
2c60: 3b 0a 20 20 75 6e 73 69 67 6e 65 64 20 63 68 61 ;. unsigned cha
2c70: 72 20 64 69 67 65 73 74 5b 31 36 5d 3b 0a 20 20 r digest[16];.
2c80: 63 68 61 72 20 7a 42 75 66 5b 31 30 32 34 30 5d char zBuf[10240]
2c90: 3b 0a 0a 20 20 69 66 28 20 61 72 67 63 21 3d 32 ;.. if( argc!=2
2ca0: 20 29 7b 0a 20 20 20 20 54 63 6c 5f 41 70 70 65 ){. Tcl_Appe
2cb0: 6e 64 52 65 73 75 6c 74 28 69 6e 74 65 72 70 2c ndResult(interp,
2cc0: 22 77 72 6f 6e 67 20 23 20 61 72 67 73 3a 20 73 "wrong # args: s
2cd0: 68 6f 75 6c 64 20 62 65 20 5c 22 22 2c 20 61 72 hould be \"", ar
2ce0: 67 76 5b 30 5d 2c 20 0a 20 20 20 20 20 20 20 20 gv[0], .
2cf0: 22 20 46 49 4c 45 4e 41 4d 45 5c 22 22 2c 20 30 " FILENAME\"", 0
2d00: 29 3b 0a 20 20 20 20 72 65 74 75 72 6e 20 54 43 );. return TC
2d10: 4c 5f 45 52 52 4f 52 3b 0a 20 20 7d 0a 20 20 69 L_ERROR;. }. i
2d20: 6e 20 3d 20 66 6f 70 65 6e 28 61 72 67 76 5b 31 n = fopen(argv[1
2d30: 5d 2c 22 72 62 22 29 3b 0a 20 20 69 66 28 20 69 ],"rb");. if( i
2d40: 6e 3d 3d 30 20 29 7b 0a 20 20 20 20 54 63 6c 5f n==0 ){. Tcl_
2d50: 41 70 70 65 6e 64 52 65 73 75 6c 74 28 69 6e 74 AppendResult(int
2d60: 65 72 70 2c 22 75 6e 61 62 6c 65 20 74 6f 20 6f erp,"unable to o
2d70: 70 65 6e 20 66 69 6c 65 20 5c 22 22 2c 20 61 72 pen file \"", ar
2d80: 67 76 5b 31 5d 2c 20 0a 20 20 20 20 20 20 20 20 gv[1], .
2d90: 20 22 5c 22 20 66 6f 72 20 72 65 61 64 69 6e 67 "\" for reading
2da0: 22 2c 20 30 29 3b 0a 20 20 20 20 72 65 74 75 72 ", 0);. retur
2db0: 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 20 20 7d n TCL_ERROR;. }
2dc0: 0a 20 20 4d 44 35 49 6e 69 74 28 26 63 74 78 29 . MD5Init(&ctx)
2dd0: 3b 0a 20 20 66 6f 72 28 3b 3b 29 7b 0a 20 20 20 ;. for(;;){.
2de0: 20 69 6e 74 20 6e 3b 0a 20 20 20 20 6e 20 3d 20 int n;. n =
2df0: 66 72 65 61 64 28 7a 42 75 66 2c 20 31 2c 20 73 fread(zBuf, 1, s
2e00: 69 7a 65 6f 66 28 7a 42 75 66 29 2c 20 69 6e 29 izeof(zBuf), in)
2e10: 3b 0a 20 20 20 20 69 66 28 20 6e 3c 3d 30 20 29 ;. if( n<=0 )
2e20: 20 62 72 65 61 6b 3b 0a 20 20 20 20 4d 44 35 55 break;. MD5U
2e30: 70 64 61 74 65 28 26 63 74 78 2c 20 28 75 6e 73 pdate(&ctx, (uns
2e40: 69 67 6e 65 64 20 63 68 61 72 2a 29 7a 42 75 66 igned char*)zBuf
2e50: 2c 20 28 75 6e 73 69 67 6e 65 64 29 6e 29 3b 0a , (unsigned)n);.
2e60: 20 20 7d 0a 20 20 66 63 6c 6f 73 65 28 69 6e 29 }. fclose(in)
2e70: 3b 0a 20 20 4d 44 35 46 69 6e 61 6c 28 64 69 67 ;. MD5Final(dig
2e80: 65 73 74 2c 20 26 63 74 78 29 3b 0a 20 20 44 69 est, &ctx);. Di
2e90: 67 65 73 74 54 6f 42 61 73 65 31 36 28 64 69 67 gestToBase16(dig
2ea0: 65 73 74 2c 20 69 6e 74 65 72 70 2d 3e 72 65 73 est, interp->res
2eb0: 75 6c 74 29 3b 0a 20 20 72 65 74 75 72 6e 20 54 ult);. return T
2ec0: 43 4c 5f 4f 4b 3b 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 CL_OK;.}../*.**
2ed0: 52 65 67 69 73 74 65 72 20 74 68 65 20 74 77 6f Register the two
2ee0: 20 54 43 4c 20 63 6f 6d 6d 61 6e 64 73 20 61 62 TCL commands ab
2ef0: 6f 76 65 20 77 69 74 68 20 74 68 65 20 54 43 4c ove with the TCL
2f00: 20 69 6e 74 65 72 70 72 65 74 65 72 2e 0a 2a 2f interpreter..*/
2f10: 0a 69 6e 74 20 4d 64 35 5f 49 6e 69 74 28 54 63 .int Md5_Init(Tc
2f20: 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 l_Interp *interp
2f30: 29 7b 0a 20 20 54 63 6c 5f 43 72 65 61 74 65 43 ){. Tcl_CreateC
2f40: 6f 6d 6d 61 6e 64 28 69 6e 74 65 72 70 2c 20 22 ommand(interp, "
2f50: 6d 64 35 22 2c 20 28 54 63 6c 5f 43 6d 64 50 72 md5", (Tcl_CmdPr
2f60: 6f 63 2a 29 6d 64 35 5f 63 6d 64 2c 20 30 2c 20 oc*)md5_cmd, 0,
2f70: 30 29 3b 0a 20 20 54 63 6c 5f 43 72 65 61 74 65 0);. Tcl_Create
2f80: 43 6f 6d 6d 61 6e 64 28 69 6e 74 65 72 70 2c 20 Command(interp,
2f90: 22 6d 64 35 66 69 6c 65 22 2c 20 28 54 63 6c 5f "md5file", (Tcl_
2fa0: 43 6d 64 50 72 6f 63 2a 29 6d 64 35 66 69 6c 65 CmdProc*)md5file
2fb0: 5f 63 6d 64 2c 20 30 2c 20 30 29 3b 0a 20 20 72 _cmd, 0, 0);. r
2fc0: 65 74 75 72 6e 20 54 43 4c 5f 4f 4b 3b 0a 7d 0a eturn TCL_OK;.}.
2fd0: 0a 2f 2a 0a 2a 2a 20 44 75 72 69 6e 67 20 74 65 ./*.** During te
2fe0: 73 74 69 6e 67 2c 20 74 68 65 20 73 70 65 63 69 sting, the speci
2ff0: 61 6c 20 6d 64 35 73 75 6d 28 29 20 61 67 67 72 al md5sum() aggr
3000: 65 67 61 74 65 20 66 75 6e 63 74 69 6f 6e 20 69 egate function i
3010: 73 20 61 76 61 69 6c 61 62 6c 65 2e 0a 2a 2a 20 s available..**
3020: 69 6e 73 69 64 65 20 53 51 4c 69 74 65 2e 20 20 inside SQLite.
3030: 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 72 6f The following ro
3040: 75 74 69 6e 65 73 20 69 6d 70 6c 65 6d 65 6e 74 utines implement
3050: 20 74 68 61 74 20 66 75 6e 63 74 69 6f 6e 2e 0a that function..
3060: 2a 2f 0a 73 74 61 74 69 63 20 76 6f 69 64 20 6d */.static void m
3070: 64 35 73 74 65 70 28 73 71 6c 69 74 65 33 5f 63 d5step(sqlite3_c
3080: 6f 6e 74 65 78 74 20 2a 63 6f 6e 74 65 78 74 2c ontext *context,
3090: 20 69 6e 74 20 61 72 67 63 2c 20 73 71 6c 69 74 int argc, sqlit
30a0: 65 33 5f 76 61 6c 75 65 20 2a 2a 61 72 67 76 29 e3_value **argv)
30b0: 7b 0a 20 20 4d 44 35 43 6f 6e 74 65 78 74 20 2a {. MD5Context *
30c0: 70 3b 0a 20 20 69 6e 74 20 69 3b 0a 20 20 69 66 p;. int i;. if
30d0: 28 20 61 72 67 63 3c 31 20 29 20 72 65 74 75 72 ( argc<1 ) retur
30e0: 6e 3b 0a 20 20 70 20 3d 20 73 71 6c 69 74 65 33 n;. p = sqlite3
30f0: 5f 61 67 67 72 65 67 61 74 65 5f 63 6f 6e 74 65 _aggregate_conte
3100: 78 74 28 63 6f 6e 74 65 78 74 2c 20 73 69 7a 65 xt(context, size
3110: 6f 66 28 2a 70 29 29 3b 0a 20 20 69 66 28 20 70 of(*p));. if( p
3120: 3d 3d 30 20 29 20 72 65 74 75 72 6e 3b 0a 20 20 ==0 ) return;.
3130: 69 66 28 20 21 70 2d 3e 69 73 49 6e 69 74 20 29 if( !p->isInit )
3140: 7b 0a 20 20 20 20 4d 44 35 49 6e 69 74 28 70 29 {. MD5Init(p)
3150: 3b 0a 20 20 7d 0a 20 20 66 6f 72 28 69 3d 30 3b ;. }. for(i=0;
3160: 20 69 3c 61 72 67 63 3b 20 69 2b 2b 29 7b 0a 20 i<argc; i++){.
3170: 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a const char *z
3180: 44 61 74 61 20 3d 20 28 63 68 61 72 2a 29 73 71 Data = (char*)sq
3190: 6c 69 74 65 33 5f 76 61 6c 75 65 5f 74 65 78 74 lite3_value_text
31a0: 28 61 72 67 76 5b 69 5d 29 3b 0a 20 20 20 20 69 (argv[i]);. i
31b0: 66 28 20 7a 44 61 74 61 20 29 7b 0a 20 20 20 20 f( zData ){.
31c0: 20 20 4d 44 35 55 70 64 61 74 65 28 70 2c 20 28 MD5Update(p, (
31d0: 75 6e 73 69 67 6e 65 64 20 63 68 61 72 2a 29 7a unsigned char*)z
31e0: 44 61 74 61 2c 20 73 74 72 6c 65 6e 28 7a 44 61 Data, strlen(zDa
31f0: 74 61 29 29 3b 0a 20 20 20 20 7d 0a 20 20 7d 0a ta));. }. }.
3200: 7d 0a 73 74 61 74 69 63 20 76 6f 69 64 20 6d 64 }.static void md
3210: 35 66 69 6e 61 6c 69 7a 65 28 73 71 6c 69 74 65 5finalize(sqlite
3220: 33 5f 63 6f 6e 74 65 78 74 20 2a 63 6f 6e 74 65 3_context *conte
3230: 78 74 29 7b 0a 20 20 4d 44 35 43 6f 6e 74 65 78 xt){. MD5Contex
3240: 74 20 2a 70 3b 0a 20 20 75 6e 73 69 67 6e 65 64 t *p;. unsigned
3250: 20 63 68 61 72 20 64 69 67 65 73 74 5b 31 36 5d char digest[16]
3260: 3b 0a 20 20 63 68 61 72 20 7a 42 75 66 5b 33 33 ;. char zBuf[33
3270: 5d 3b 0a 20 20 70 20 3d 20 73 71 6c 69 74 65 33 ];. p = sqlite3
3280: 5f 61 67 67 72 65 67 61 74 65 5f 63 6f 6e 74 65 _aggregate_conte
3290: 78 74 28 63 6f 6e 74 65 78 74 2c 20 73 69 7a 65 xt(context, size
32a0: 6f 66 28 2a 70 29 29 3b 0a 20 20 4d 44 35 46 69 of(*p));. MD5Fi
32b0: 6e 61 6c 28 64 69 67 65 73 74 2c 70 29 3b 0a 20 nal(digest,p);.
32c0: 20 44 69 67 65 73 74 54 6f 42 61 73 65 31 36 28 DigestToBase16(
32d0: 64 69 67 65 73 74 2c 20 7a 42 75 66 29 3b 0a 20 digest, zBuf);.
32e0: 20 73 71 6c 69 74 65 33 5f 72 65 73 75 6c 74 5f sqlite3_result_
32f0: 74 65 78 74 28 63 6f 6e 74 65 78 74 2c 20 7a 42 text(context, zB
3300: 75 66 2c 20 2d 31 2c 20 53 51 4c 49 54 45 5f 54 uf, -1, SQLITE_T
3310: 52 41 4e 53 49 45 4e 54 29 3b 0a 7d 0a 69 6e 74 RANSIENT);.}.int
3320: 20 4d 64 35 5f 52 65 67 69 73 74 65 72 28 73 71 Md5_Register(sq
3330: 6c 69 74 65 33 20 2a 64 62 29 7b 0a 20 20 69 6e lite3 *db){. in
3340: 74 20 72 63 20 3d 20 73 71 6c 69 74 65 33 5f 63 t rc = sqlite3_c
3350: 72 65 61 74 65 5f 66 75 6e 63 74 69 6f 6e 28 64 reate_function(d
3360: 62 2c 20 22 6d 64 35 73 75 6d 22 2c 20 2d 31 2c b, "md5sum", -1,
3370: 20 53 51 4c 49 54 45 5f 55 54 46 38 2c 20 30 2c SQLITE_UTF8, 0,
3380: 20 30 2c 20 0a 20 20 20 20 20 20 20 20 20 20 20 0, .
3390: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
33a0: 20 20 20 20 20 20 6d 64 35 73 74 65 70 2c 20 6d md5step, m
33b0: 64 35 66 69 6e 61 6c 69 7a 65 29 3b 0a 20 20 73 d5finalize);. s
33c0: 71 6c 69 74 65 33 5f 6f 76 65 72 6c 6f 61 64 5f qlite3_overload_
33d0: 66 75 6e 63 74 69 6f 6e 28 64 62 2c 20 22 6d 64 function(db, "md
33e0: 35 73 75 6d 22 2c 20 2d 31 29 3b 20 20 2f 2a 20 5sum", -1); /*
33f0: 54 6f 20 65 78 65 72 63 69 73 65 20 74 68 69 73 To exercise this
3400: 20 41 50 49 20 2a 2f 0a 20 20 72 65 74 75 72 6e API */. return
3410: 20 72 63 3b 0a 7d 0a rc;.}.