[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: what do I hash to get .subversion/auth/svn.simple file name?

From: Stefan Sperling <stsp_at_elego.de>
Date: Mon, 6 Jan 2014 21:03:53 +0100

On Mon, Jan 06, 2014 at 01:40:58PM -0600, Tristan Slominski wrote:
> Hi,
>
> I thought this was going to be easy to find out, but after hours
> researching this and trying different things, I still don't know how to
> answer the question.
>
> I posted it on stack overflow here:
> http://stackoverflow.com/questions/20952004/subversion-auth-svn-simple-hash-algorithm
>
> It boils down to this:
>
> Given ~/.subversion/auth/svn.simple/5671adf2865e267db74f09ba6f872c28 with
> the contents of:
>
> K 8
> username
> V 3
> joe
> K 8
> password
> V 4
> blah
> K 15
> svn:realmstring
> V 45
> <https://svn.domain.com:443> Joe's repository
> END
>
> What string to I hash to get 5671adf2865e267db74f09ba6f872c28?

The creds file's name is indeed the MD5 checksum of the realmstring.
This code generates the name (in subversion/libsvn_subr/config_auth.c):

      /* Construct the basename of the creds file. It's just the
         realmstring converted into an md5 hex string. */
      SVN_ERR(svn_checksum(&checksum, svn_checksum_md5, realmstring,
                           strlen(realmstring), pool));
      hexname = svn_checksum_to_cstring(checksum, pool);

      *path = svn_dirent_join(authdir_path, hexname, pool);

> https://svn.domain.com:443> Joe's repository"), and I can't find one that
> generates the correct hash.

I'm not sure why your example doesn't work, but with a data set
of mine I get the right hash:

$ cd ~/.subversion/auth/svn.simple
$ echo -n "<https://svn.apache.org:443> ASF Committers:443> ASF Committers" | md5
d3c8a345b14f6a1b42251aef8027ab57
$ grep ASF ./d3c8a345b14f6a1b42251aef8027ab57
<https://svn.apache.org:443> ASF Committers
$
Received on 2014-01-06 21:05:50 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.