Created
July 17, 2012 14:48
-
-
Save vquaiato/3129839 to your computer and use it in GitHub Desktop.
Nuget Install Command Generate Token implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://nuget.codeplex.com/SourceControl/changeset/view/435b2c2e1ddd#src%2fCommandLine%2fCommands%2fInstallCommand.cs | |
private static string GenerateUniqueToken(IPackageManager packageManager, string packageId, SemanticVersion version) { | |
var packagePath = packageManager.FileSystem.GetFullPath(packageManager.PathResolver.GetPackageFileName(packageId, version)); | |
var pathBytes = Encoding.UTF8.GetBytes(packagePath); | |
var hashProvider = new CryptoHashProvider("SHA256"); | |
return Convert.ToBase64String(hashProvider.CalculateHash(pathBytes)).ToUpperInvariant(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment