Subversion checksum algorithm
Which algorithms (SHA1, MD5...) does the Subversion use for detecting 开发者_StackOverflow中文版that data are not corrupted? (e.g. by a disk fault)
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;
}
}
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.
精彩评论