-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDataStructure.py
More file actions
92 lines (64 loc) · 2.22 KB
/
DataStructure.py
File metadata and controls
92 lines (64 loc) · 2.22 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
class XMSSPrivateKey:
def __init__(self):
self.wots_private_keys = None
self.idx = None
self.SK_PRF = None
self.root_value = None
self.SEED = None
class XMSSPublicKey:
def __init__(self):
self.OID = None
self.root_value = None
self.SEED = None
class XMSSKeypair:
def __init__(self, SK, PK):
self.SK = SK
self.PK = PK
class SigXMSS:
def __init__(self, idx_sig, r, sig, SK, M2):
self.idx_sig = idx_sig
self.r = r
self.sig = sig
self.SK = SK
self.M2 = M2
class SigWithAuthPath:
def __init__(self, sig_ots, auth):
self.sig_ots = sig_ots
self.auth = auth
class ADRS:
def __init__(self):
self.layerAddress = bytes(4)
self.treeAddress = bytes(8)
self.type = bytes(4)
self.first_word = bytes(4)
self.second_word = bytes(4)
self.third_word = bytes(4)
self.keyAndMask = bytes(4)
def setType(self, type_value):
self.type = type_value.to_bytes(4, byteorder='big')
self.first_word = bytearray(4)
self.second_word = bytearray(4)
self.third_word = bytearray(4)
self.keyAndMask = bytearray(4)
def getTreeHeight(self):
return self.second_word
def getTreeIndex(self):
return self.third_word
def setHashAddress(self, value):
self.third_word = value.to_bytes(4, byteorder='big')
def setKeyAndMask(self, value):
self.keyAndMask = value.to_bytes(4, byteorder='big')
def setChainAddress(self, value):
self.second_word = value.to_bytes(4, byteorder='big')
def setTreeHeight(self, value):
self.second_word = value.to_bytes(4, byteorder='big')
def setTreeIndex(self, value):
self.third_word = value.to_bytes(4, byteorder='big')
def setOTSAddress(self, value):
self.first_word = value.to_bytes(4, byteorder='big')
def setLTreeAddress(self, value):
self.first_word = value.to_bytes(4, byteorder='big')
def setLayerAddress(self, value):
self.layerAddress = value.to_bytes(4, byteorder='big')
def setTreeAddress(self, value):
self.treeAddress = value.to_bytes(4, byteorder='big')