Exemplo n.º 1
0
 // Generate a relationship id for compatibility
 private string GenerateRelationshipId(string path)
 {
     using (var hashFunc = new Sha512HashFunction())
     {
         var data = System.Text.Encoding.UTF8.GetBytes(path);
         hashFunc.Update(data, 0, data.Length);
         var hash = hashFunc.GetHashBytes();
         var hex  = EncodeHexString(hash);
         return("R" + hex.Substring(0, 16));
     }
 }
Exemplo n.º 2
0
 private string CalcPsmdcpName()
 {
     if (_deterministic)
     {
         using (var hashFunc = new Sha512HashFunction())
         {
             foreach (var file in Files)
             {
                 var data = ReadAllBytes(file.GetStream());
                 hashFunc.Update(data, 0, data.Length);
             }
             return(EncodeHexString(hashFunc.GetHashBytes()).Substring(0, 32));
         }
     }
     else
     {
         return(Guid.NewGuid().ToString("N"));
     }
 }