public static ContentStreamHash ( this doc, string type = "SHA-1" ) : byte[] | ||
doc | this | Document with the content stream. |
type | string | Type of the requested hash. |
return | byte[] |
public static byte[] ContentStreamHash(this IDocument doc, string type = "SHA-1") {
if (doc.Properties == null) {
return null;
}
string prefix = string.Format("{{{0}}}", type.ToLower());
foreach (var prop in doc.Properties) {
if (prop.Id == "cmis:contentStreamHash") {
if (prop.Values != null) {
foreach (string entry in prop.Values) {
if (entry.StartsWith(prefix)) {
return StringToByteArray(entry.Substring(prefix.Length));
}
}
}
}
}
return null;
}