/usr/lib/python2.7/dist-packages/openpyxl/chartsheet/protection.py is in python-openpyxl 2.3.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | from __future__ import absolute_import
import hashlib
from openpyxl.descriptors import (Bool, Integer, String)
from openpyxl.descriptors.excel import Base64Binary
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.worksheet.protection import (
hash_password,
_Protected
)
class ChartsheetProtection(Serialisable, _Protected):
tagname = "sheetProtection"
algorithmName = String(allow_none=True)
hashValue = Base64Binary(allow_none=True)
saltValue = Base64Binary(allow_none=True)
spinCount = Integer(allow_none=True)
content = Bool(allow_none=True)
objects = Bool(allow_none=True)
__attrs__ = ("content", "objects", "password", "hashValue", "spinCount", "saltValue", "algorithmName")
def __init__(self,
content=None,
objects=None,
hashValue=None,
spinCount=None,
saltValue=None,
algorithmName=None,
password=None,
):
self.content = content
self.objects = objects
self.hashValue = hashValue
self.spinCount = spinCount
self.saltValue = saltValue
self.algorithmName = algorithmName
if password is not None:
self.password = password
def hash_password(self, password):
self.hashValue = hashlib.sha256((self.saltValue + password).encode("utf-8")).hexdigest()
|