<PackageReference Include="Relativity.Transfer.Client" Version="7.1.40" />

PrimaryKeyGenerator

using Relativity.Transfer.Resources; using System; using System.Security.Cryptography; using System.Text; namespace Relativity.Transfer { internal class PrimaryKeyGenerator : ITransferPathKeyGenerator { private static readonly object SyncRoot = new object(); public static long CreateKey(TransferPath path) { if (path == (TransferPath)null) throw new ArgumentNullException("path"); return CreateKey(path.SourcePath); } public static long CreateKey(string path) { if (string.IsNullOrEmpty(path)) throw new ArgumentNullException("path", CoreStrings.SourcePathArgumentExceptionMessage); lock (SyncRoot) { using (SHA256 sHA = SHA256.Create()) { byte[] value = sHA.ComputeHash(Encoding.UTF8.GetBytes(path.ToUpperInvariant())); return BitConverter.ToInt64(value, 0); } } } public long GetKey(string path) { return CreateKey(path); } public long GetKey(TransferPath path) { return CreateKey(path); } } }