public static bool GetHashCode(String filePath, ref String hashValue) { //Get the plaintextHash value (SHA-256) of the file try { Byte[] hashBytes = null; using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read)) { hashBytes = SHA256Managed.Create().ComputeHash(fs); } hashValue = BinaryStream.ByteArrayToHexString(hashBytes); return(true); } catch (System.Exception) { hashValue = string.Empty; return(false); } }
private String GenerateKey() { this.Aes.GenerateKey(); return(BinaryStream.ByteArrayToHexString(this.Aes.Key)); }