Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subversion checksum algorithm

Tags:

svn

checksum

Which algorithms (SHA1, MD5...) does the Subversion use for detecting that data are not corrupted? (e.g. by a disk fault)

like image 578
Cartesius00 Avatar asked Sep 15 '11 23:09

Cartesius00


2 Answers

If you take a look at SVN 1.6 source code, you'll find that the support for both MD5 and SHA-1 hash functions is available in source code. Take a look at chacksum.c file and the following function:

svn_checksum_t *
svn_checksum_create(svn_checksum_kind_t kind,
                    apr_pool_t *pool)
{
  svn_checksum_t *checksum;

  switch (kind)
    {
      case svn_checksum_md5:
      case svn_checksum_sha1:
        checksum = apr_pcalloc(pool, sizeof(*checksum) + DIGESTSIZE(kind));
        checksum->digest = (unsigned char *)checksum + sizeof(*checksum);
        checksum->kind = kind;
        return checksum;

      default:
        return NULL;
    }
}
like image 124
Gupta Avatar answered Sep 28 '22 22:09

Gupta


For the current version (1.8.x) the checksum displayed with svn info is SHA-1, i.e. sha1sum {file} should match the checksum in svn info if the file has not been modified.

like image 42
Robert Calhoun Avatar answered Sep 29 '22 00:09

Robert Calhoun