# File lib/puppet/sslcertificates.rb, line 112
112:   def self.mkhash(dir, cert, certfile)
113:     # Make sure the hash is zero-padded to 8 chars
114:     hash = "%08x" % cert.issuer.hash
115:     hashpath = nil
116:     10.times { |i|
117:       path = File.join(dir, "#{hash}.#{i}")
118:       if FileTest.exists?(path)
119:         if FileTest.symlink?(path)
120:           dest = File.readlink(path)
121:           if dest == certfile
122:             # the correct link already exists
123:             hashpath = path
124:             break
125:           else
126:             next
127:           end
128:         else
129:           next
130:         end
131:       end
132: 
133:       File.symlink(certfile, path)
134: 
135:       hashpath = path
136:       break
137:     }
138: 
139: 
140:     hashpath
141:   end