07.05.2014 Views

The Microsoft Excel File Format - OpenOffice.org

The Microsoft Excel File Format - OpenOffice.org

The Microsoft Excel File Format - OpenOffice.org

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.18 Worksheet/Workbook Protection<br />

4.18.3 Workbook Protection (BIFF5-BIFF8)<br />

Definition: Workbook Protection Block<br />

<strong>The</strong> Workbook Protection Block in the Workbook Globals Substream determines the protected items in the entire<br />

workbook.<br />

<strong>The</strong> PROTECT record protects the workbook contents and the WINDOWPROTECT record protects the window<br />

settings. <strong>The</strong> PASSWORD record contains the hash value of the password used to protect the workbook (➜4.18.4). All<br />

the mentioned records occur always, if the file was written by <strong>Excel</strong>, but may be omitted.<br />

If a protection password is set in the PASSWORD record, the read/write file protection (➜4.19) will be enabled, which<br />

causes encryption of the file (➜4.19.1) in every case. If this protection is not enabled manually while saving the file, the<br />

built-in password “VelvetSweatshop” is used, not the password set for workbook protection.<br />

Structure of the Workbook Protection Block:<br />

○ WINDOWPROTECT Window settings: 1 = protected (➜5.111)<br />

○ PROTECT Workbook contents: 1 = protected (➜5.82)<br />

○ PASSWORD Hash value of the password; 0 = no password (➜5.76)<br />

○ PROT4REV Shared workbook: 1 = protected<br />

○ PROT4REVPASS Hash value of the shared password; 0 = no password<br />

4.18.4 Password Hash Value<br />

In several records the hash value of a password is stored, used for later verification of an entered password. <strong>The</strong> length of<br />

the password is restricted to 15 characters.<br />

<strong>The</strong> following pseudo-code algorithm shows how to create such a hash value from a given byte-string password:<br />

ALGORITHM Get_Password_Hash( password )<br />

1) hash ← 0 ; char_index ← char_count ← character count of password<br />

2) char_index ← char_index - 1<br />

3) char ← character from password with index char_index {0 is leftmost character}<br />

4) hash ← hash XOR char<br />

5) rotate the lower 15 bits of hash left by 1 bit<br />

6) IF char_index > 0 THEN JUMP 2)<br />

7) RETURN hash XOR char_count XOR CE4B H<br />

115

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!