Share via


WriteProtection.Hash Property

Definition

Password Hash

Represents the following attribute in the schema: w:hash

[DocumentFormat.OpenXml.SchemaAttr(23, "hash")]
public DocumentFormat.OpenXml.Base64BinaryValue Hash { get; set; }
public DocumentFormat.OpenXml.Base64BinaryValue Hash { get; set; }
[DocumentFormat.OpenXml.SchemaAttr(23, "hash")]
public DocumentFormat.OpenXml.Base64BinaryValue? Hash { get; set; }
[DocumentFormat.OpenXml.SchemaAttr("w:hash")]
public DocumentFormat.OpenXml.Base64BinaryValue? Hash { get; set; }
public DocumentFormat.OpenXml.Base64BinaryValue? Hash { get; set; }
member this.Hash : DocumentFormat.OpenXml.Base64BinaryValue with get, set
[<DocumentFormat.OpenXml.SchemaAttr(23, "hash")>]
member this.Hash : DocumentFormat.OpenXml.Base64BinaryValue with get, set
[<DocumentFormat.OpenXml.SchemaAttr("w:hash")>]
member this.Hash : DocumentFormat.OpenXml.Base64BinaryValue with get, set
Public Property Hash As Base64BinaryValue

Property Value

Returns StringValue.

Attributes

Remarks

The following information from the ECMA International Standard ECMA-376 can be useful when working with this class.

Specifies the hash value for the password stored with this document. This value shall be compared with the resulting hash value after hashing the user-supplied password using the algorithm specified by the preceding attributes and parent XML element, and if the two values match, the protection shall no longer be enforced.

If this value is omitted, then no password shall be associated with the protection, and it may be turned off without supplying any password.

Consider a WordprocessingML document with the following information stored in one of its protection elements:

<w:… w:cryptAlgorithmClass="hash"   
  w:cryptAlgorithmType="typeAny"   
  w:cryptAlgorithmSid="1"  
  w:hash="9oN7nWkCAyEZib1RomSJTjmPpCY=" />  

The hash attribute value of 9oN7nWkCAyEZib1RomSJTjmPpCY= specifies that the user-supplied password shall be hashed using the pre-processing defined by the parent element (if any) followed by the SHA-1 algorithm (specified via the cryptAlgorithmSid attribute value of 1) and that the resulting has value must be 9oN7nWkCAyEZib1RomSJTjmPpCY= for the protection to be disabled.

The possible values for this attribute are defined by the XML Schema base64Binary data type.

Applies to