Esempio n. 1
0
 /// <summary>
 /// Calculate a SHA1 hash from a string
 /// </summary>
 /// <param name="stringToConvert">The string to calculate</param>
 /// <returns></returns>
 public static SHA1Hash SHA1(this String stringToConvert)
 {
     return(SHA1Hash.FromMemory(stringToConvert.ToByteArray()));
 }
Esempio n. 2
0
 /// <summary>
 /// Calculate an SHA1 hash from a byte array
 /// </summary>
 /// <param name="b">Byte array to calculate</param>
 /// <returns></returns>
 public static SHA1Hash SHA1(this byte[] b)
 {
     return(SHA1Hash.FromMemory(b));
 }
Esempio n. 3
0
 /// <summary>
 /// Calculate an SHA1 hash from a stream
 /// </summary>
 /// <param name="s"></param>
 /// <returns></returns>
 public static SHA1Hash SHA1(this Stream s)
 {
     return(SHA1Hash.FromStream(s));
 }
Esempio n. 4
0
 /// <summary>
 /// Calculate an SHA1 hash of the file referenced by the FileInfo object
 /// </summary>
 /// <param name="fileInfoObject">The file to calculate</param>
 /// <returns></returns>
 public static SHA1Hash SHA1(this FileInfo fileInfoObject)
 {
     return(SHA1Hash.FromFile(fileInfoObject.FullName));
 }