/ Check-in [fb276815]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix an undersized buffer in the SHA1 implementation.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dbhash
Files: files | file ages | folders
SHA1: fb2768154c513881886e89801e906bea959197b3
User & Date: drh 2016-06-08 13:59:35
Context
2016-06-08
14:04
Add the "dbhash.exe" utility program that computes a SHA1 hash over the invariant content of an SQLite database file. Free space in the file, the page size, auto_vacuum status, text encoding, and so forth do not change the hash. Only the content matters. check-in: f48a4ad3 user: drh tags: trunk
13:59
Fix an undersized buffer in the SHA1 implementation. Closed-Leaf check-in: fb276815 user: drh tags: dbhash
13:49
Fix the dbhash utility so that it ignores the root page number when hashing the sqlite_master table. Add new command-line options. Add the ability to hash multiple databases with a single command. check-in: 44f157e0 user: drh tags: dbhash
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tool/dbhash.c.

205
206
207
208
209
210
211
212
213
214
215
216
217
218
219

/* Add padding and compute and output the message digest. */
static void hash_finish(const char *zName){
  unsigned int i;
  unsigned char finalcount[8];
  unsigned char digest[20];
  static const char zEncode[] = "0123456789abcdef";
  char zOut[40];

  for (i = 0; i < 8; i++){
    finalcount[i] = (unsigned char)((g.cx.count[(i >= 4 ? 0 : 1)]
       >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */
  }
  hash_step((const unsigned char *)"\200", 1);
  while ((g.cx.count[0] & 504) != 448){







|







205
206
207
208
209
210
211
212
213
214
215
216
217
218
219

/* Add padding and compute and output the message digest. */
static void hash_finish(const char *zName){
  unsigned int i;
  unsigned char finalcount[8];
  unsigned char digest[20];
  static const char zEncode[] = "0123456789abcdef";
  char zOut[41];

  for (i = 0; i < 8; i++){
    finalcount[i] = (unsigned char)((g.cx.count[(i >= 4 ? 0 : 1)]
       >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */
  }
  hash_step((const unsigned char *)"\200", 1);
  while ((g.cx.count[0] & 504) != 448){