src/eric7/Utilities/crypto/py3AES.py

Sat, 23 Dec 2023 15:48:12 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 23 Dec 2023 15:48:12 +0100
branch
eric7
changeset 10439
21c28b0f9e41
parent 10433
328f3ec4b77a
child 10692
9becf9ca115c
permissions
-rw-r--r--

Updated copyright for 2024.

4544
5145cf800bb0 Fixed usage of some old style string formattings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
1 # -*- coding: utf-8 -*-
5145cf800bb0 Fixed usage of some old style string formattings.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
2
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
3 #
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 # aes.py: implements AES - Advanced Encryption Standard
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5 # from the SlowAES project, http://code.google.com/p/slowaes/
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 #
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 # Copyright (c) 2008 Josh Davis ( http://www.josh-davis.org ),
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 # Alex Martelli ( http://www.aleax.it )
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9 #
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
10 # Ported from C code written by Laurent Haan
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
11 # ( http://www.progressive-coding.com )
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 #
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 # Licensed under the Apache License, Version 2.0
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 # http://www.apache.org/licenses/
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 #
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 #
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 # Ported to Python3
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 #
10439
21c28b0f9e41 Updated copyright for 2024.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10433
diff changeset
20 # Copyright (c) 2011 - 2024 Detlev Offenbach <detlev@die-offenbachs.de>
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 #
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 Module implementing classes for encryption according
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 Advanced Encryption Standard.
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
28 import math
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 import os
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 def append_PKCS7_padding(b):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 Function to pad the given data to a multiple of 16-bytes by PKCS7 padding.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
35
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
36 @param b data to be padded
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
37 @type bytes
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
38 @return padded data
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
39 @rtype bytes
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 numpads = 16 - (len(b) % 16)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 return b + numpads * bytes(chr(numpads), encoding="ascii")
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 def strip_PKCS7_padding(b):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 Function to strip off PKCS7 padding.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
48
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
49 @param b data to be stripped
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
50 @type bytes
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
51 @return stripped data
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
52 @rtype bytes
3019
7912530a33e2 Fixed a few documentation strings that got broken while doing the line shortening job. That concludes the later.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2997
diff changeset
53 @exception ValueError data padding is invalid
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 if len(b) % 16 or not b:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
56 raise ValueError("Data of len {0} can't be PCKS7-padded".format(len(b)))
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 numpads = b[-1]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 if numpads > 16:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
59 raise ValueError("Data ending with {0} can't be PCKS7-padded".format(b[-1]))
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 return b[:-numpads]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62
8207
d359172d11be Applied some more code simplifications suggested by the new Simplify checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8205
diff changeset
63 class AES:
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 Class implementing the Advanced Encryption Standard algorithm.
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
67
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 # valid key sizes
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 KeySize = {
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 "SIZE_128": 16,
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 "SIZE_192": 24,
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 "SIZE_256": 32,
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 }
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 # Rijndael S-box
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
76 sbox = [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
77 0x63,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
78 0x7C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
79 0x77,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
80 0x7B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
81 0xF2,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
82 0x6B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
83 0x6F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
84 0xC5,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
85 0x30,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
86 0x01,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
87 0x67,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
88 0x2B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
89 0xFE,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
90 0xD7,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
91 0xAB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
92 0x76,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
93 0xCA,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
94 0x82,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
95 0xC9,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
96 0x7D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
97 0xFA,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
98 0x59,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
99 0x47,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
100 0xF0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
101 0xAD,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
102 0xD4,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
103 0xA2,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
104 0xAF,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
105 0x9C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
106 0xA4,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
107 0x72,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
108 0xC0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
109 0xB7,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
110 0xFD,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
111 0x93,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
112 0x26,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
113 0x36,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
114 0x3F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
115 0xF7,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
116 0xCC,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
117 0x34,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
118 0xA5,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
119 0xE5,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
120 0xF1,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
121 0x71,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
122 0xD8,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
123 0x31,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
124 0x15,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
125 0x04,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
126 0xC7,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
127 0x23,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
128 0xC3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
129 0x18,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
130 0x96,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
131 0x05,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
132 0x9A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
133 0x07,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
134 0x12,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
135 0x80,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
136 0xE2,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
137 0xEB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
138 0x27,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
139 0xB2,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
140 0x75,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
141 0x09,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
142 0x83,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
143 0x2C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
144 0x1A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
145 0x1B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
146 0x6E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
147 0x5A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
148 0xA0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
149 0x52,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
150 0x3B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
151 0xD6,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
152 0xB3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
153 0x29,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
154 0xE3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
155 0x2F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
156 0x84,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
157 0x53,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
158 0xD1,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
159 0x00,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
160 0xED,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
161 0x20,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
162 0xFC,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
163 0xB1,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
164 0x5B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
165 0x6A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
166 0xCB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
167 0xBE,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
168 0x39,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
169 0x4A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
170 0x4C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
171 0x58,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
172 0xCF,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
173 0xD0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
174 0xEF,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
175 0xAA,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
176 0xFB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
177 0x43,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
178 0x4D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
179 0x33,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
180 0x85,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
181 0x45,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
182 0xF9,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
183 0x02,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
184 0x7F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
185 0x50,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
186 0x3C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
187 0x9F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
188 0xA8,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
189 0x51,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
190 0xA3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
191 0x40,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
192 0x8F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
193 0x92,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
194 0x9D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
195 0x38,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
196 0xF5,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
197 0xBC,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
198 0xB6,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
199 0xDA,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
200 0x21,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
201 0x10,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
202 0xFF,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
203 0xF3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
204 0xD2,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
205 0xCD,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
206 0x0C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
207 0x13,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
208 0xEC,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
209 0x5F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
210 0x97,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
211 0x44,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
212 0x17,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
213 0xC4,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
214 0xA7,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
215 0x7E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
216 0x3D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
217 0x64,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
218 0x5D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
219 0x19,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
220 0x73,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
221 0x60,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
222 0x81,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
223 0x4F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
224 0xDC,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
225 0x22,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
226 0x2A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
227 0x90,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
228 0x88,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
229 0x46,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
230 0xEE,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
231 0xB8,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
232 0x14,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
233 0xDE,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
234 0x5E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
235 0x0B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
236 0xDB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
237 0xE0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
238 0x32,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
239 0x3A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
240 0x0A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
241 0x49,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
242 0x06,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
243 0x24,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
244 0x5C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
245 0xC2,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
246 0xD3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
247 0xAC,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
248 0x62,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
249 0x91,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
250 0x95,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
251 0xE4,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
252 0x79,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
253 0xE7,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
254 0xC8,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
255 0x37,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
256 0x6D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
257 0x8D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
258 0xD5,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
259 0x4E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
260 0xA9,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
261 0x6C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
262 0x56,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
263 0xF4,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
264 0xEA,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
265 0x65,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
266 0x7A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
267 0xAE,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
268 0x08,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
269 0xBA,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
270 0x78,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
271 0x25,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
272 0x2E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
273 0x1C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
274 0xA6,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
275 0xB4,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
276 0xC6,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
277 0xE8,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
278 0xDD,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
279 0x74,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
280 0x1F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
281 0x4B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
282 0xBD,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
283 0x8B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
284 0x8A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
285 0x70,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
286 0x3E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
287 0xB5,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
288 0x66,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
289 0x48,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
290 0x03,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
291 0xF6,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
292 0x0E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
293 0x61,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
294 0x35,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
295 0x57,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
296 0xB9,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
297 0x86,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
298 0xC1,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
299 0x1D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
300 0x9E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
301 0xE1,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
302 0xF8,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
303 0x98,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
304 0x11,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
305 0x69,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
306 0xD9,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
307 0x8E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
308 0x94,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
309 0x9B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
310 0x1E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
311 0x87,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
312 0xE9,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
313 0xCE,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
314 0x55,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
315 0x28,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
316 0xDF,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
317 0x8C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
318 0xA1,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
319 0x89,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
320 0x0D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
321 0xBF,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
322 0xE6,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
323 0x42,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
324 0x68,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
325 0x41,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
326 0x99,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
327 0x2D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
328 0x0F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
329 0xB0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
330 0x54,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
331 0xBB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
332 0x16,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
333 ]
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 # Rijndael Inverted S-box
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
336 rsbox = [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
337 0x52,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
338 0x09,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
339 0x6A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
340 0xD5,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
341 0x30,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
342 0x36,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
343 0xA5,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
344 0x38,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
345 0xBF,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
346 0x40,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
347 0xA3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
348 0x9E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
349 0x81,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
350 0xF3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
351 0xD7,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
352 0xFB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
353 0x7C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
354 0xE3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
355 0x39,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
356 0x82,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
357 0x9B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
358 0x2F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
359 0xFF,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
360 0x87,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
361 0x34,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
362 0x8E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
363 0x43,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
364 0x44,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
365 0xC4,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
366 0xDE,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
367 0xE9,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
368 0xCB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
369 0x54,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
370 0x7B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
371 0x94,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
372 0x32,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
373 0xA6,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
374 0xC2,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
375 0x23,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
376 0x3D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
377 0xEE,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
378 0x4C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
379 0x95,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
380 0x0B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
381 0x42,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
382 0xFA,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
383 0xC3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
384 0x4E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
385 0x08,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
386 0x2E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
387 0xA1,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
388 0x66,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
389 0x28,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
390 0xD9,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
391 0x24,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
392 0xB2,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
393 0x76,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
394 0x5B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
395 0xA2,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
396 0x49,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
397 0x6D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
398 0x8B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
399 0xD1,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
400 0x25,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
401 0x72,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
402 0xF8,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
403 0xF6,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
404 0x64,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
405 0x86,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
406 0x68,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
407 0x98,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
408 0x16,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
409 0xD4,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
410 0xA4,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
411 0x5C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
412 0xCC,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
413 0x5D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
414 0x65,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
415 0xB6,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
416 0x92,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
417 0x6C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
418 0x70,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
419 0x48,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
420 0x50,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
421 0xFD,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
422 0xED,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
423 0xB9,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
424 0xDA,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
425 0x5E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
426 0x15,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
427 0x46,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
428 0x57,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
429 0xA7,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
430 0x8D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
431 0x9D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
432 0x84,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
433 0x90,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
434 0xD8,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
435 0xAB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
436 0x00,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
437 0x8C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
438 0xBC,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
439 0xD3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
440 0x0A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
441 0xF7,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
442 0xE4,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
443 0x58,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
444 0x05,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
445 0xB8,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
446 0xB3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
447 0x45,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
448 0x06,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
449 0xD0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
450 0x2C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
451 0x1E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
452 0x8F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
453 0xCA,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
454 0x3F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
455 0x0F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
456 0x02,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
457 0xC1,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
458 0xAF,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
459 0xBD,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
460 0x03,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
461 0x01,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
462 0x13,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
463 0x8A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
464 0x6B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
465 0x3A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
466 0x91,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
467 0x11,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
468 0x41,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
469 0x4F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
470 0x67,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
471 0xDC,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
472 0xEA,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
473 0x97,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
474 0xF2,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
475 0xCF,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
476 0xCE,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
477 0xF0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
478 0xB4,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
479 0xE6,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
480 0x73,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
481 0x96,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
482 0xAC,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
483 0x74,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
484 0x22,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
485 0xE7,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
486 0xAD,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
487 0x35,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
488 0x85,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
489 0xE2,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
490 0xF9,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
491 0x37,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
492 0xE8,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
493 0x1C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
494 0x75,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
495 0xDF,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
496 0x6E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
497 0x47,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
498 0xF1,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
499 0x1A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
500 0x71,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
501 0x1D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
502 0x29,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
503 0xC5,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
504 0x89,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
505 0x6F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
506 0xB7,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
507 0x62,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
508 0x0E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
509 0xAA,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
510 0x18,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
511 0xBE,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
512 0x1B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
513 0xFC,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
514 0x56,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
515 0x3E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
516 0x4B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
517 0xC6,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
518 0xD2,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
519 0x79,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
520 0x20,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
521 0x9A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
522 0xDB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
523 0xC0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
524 0xFE,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
525 0x78,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
526 0xCD,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
527 0x5A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
528 0xF4,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
529 0x1F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
530 0xDD,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
531 0xA8,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
532 0x33,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
533 0x88,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
534 0x07,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
535 0xC7,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
536 0x31,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
537 0xB1,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
538 0x12,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
539 0x10,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
540 0x59,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
541 0x27,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
542 0x80,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
543 0xEC,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
544 0x5F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
545 0x60,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
546 0x51,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
547 0x7F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
548 0xA9,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
549 0x19,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
550 0xB5,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
551 0x4A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
552 0x0D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
553 0x2D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
554 0xE5,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
555 0x7A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
556 0x9F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
557 0x93,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
558 0xC9,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
559 0x9C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
560 0xEF,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
561 0xA0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
562 0xE0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
563 0x3B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
564 0x4D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
565 0xAE,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
566 0x2A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
567 0xF5,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
568 0xB0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
569 0xC8,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
570 0xEB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
571 0xBB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
572 0x3C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
573 0x83,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
574 0x53,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
575 0x99,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
576 0x61,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
577 0x17,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
578 0x2B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
579 0x04,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
580 0x7E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
581 0xBA,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
582 0x77,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
583 0xD6,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
584 0x26,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
585 0xE1,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
586 0x69,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
587 0x14,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
588 0x63,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
589 0x55,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
590 0x21,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
591 0x0C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
592 0x7D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
593 ]
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
594
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
595 # Rijndael Rcon
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
596 Rcon = [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
597 0x8D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
598 0x01,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
599 0x02,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
600 0x04,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
601 0x08,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
602 0x10,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
603 0x20,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
604 0x40,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
605 0x80,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
606 0x1B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
607 0x36,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
608 0x6C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
609 0xD8,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
610 0xAB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
611 0x4D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
612 0x9A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
613 0x2F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
614 0x5E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
615 0xBC,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
616 0x63,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
617 0xC6,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
618 0x97,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
619 0x35,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
620 0x6A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
621 0xD4,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
622 0xB3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
623 0x7D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
624 0xFA,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
625 0xEF,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
626 0xC5,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
627 0x91,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
628 0x39,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
629 0x72,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
630 0xE4,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
631 0xD3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
632 0xBD,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
633 0x61,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
634 0xC2,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
635 0x9F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
636 0x25,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
637 0x4A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
638 0x94,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
639 0x33,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
640 0x66,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
641 0xCC,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
642 0x83,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
643 0x1D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
644 0x3A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
645 0x74,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
646 0xE8,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
647 0xCB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
648 0x8D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
649 0x01,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
650 0x02,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
651 0x04,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
652 0x08,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
653 0x10,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
654 0x20,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
655 0x40,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
656 0x80,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
657 0x1B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
658 0x36,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
659 0x6C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
660 0xD8,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
661 0xAB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
662 0x4D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
663 0x9A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
664 0x2F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
665 0x5E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
666 0xBC,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
667 0x63,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
668 0xC6,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
669 0x97,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
670 0x35,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
671 0x6A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
672 0xD4,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
673 0xB3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
674 0x7D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
675 0xFA,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
676 0xEF,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
677 0xC5,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
678 0x91,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
679 0x39,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
680 0x72,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
681 0xE4,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
682 0xD3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
683 0xBD,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
684 0x61,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
685 0xC2,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
686 0x9F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
687 0x25,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
688 0x4A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
689 0x94,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
690 0x33,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
691 0x66,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
692 0xCC,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
693 0x83,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
694 0x1D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
695 0x3A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
696 0x74,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
697 0xE8,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
698 0xCB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
699 0x8D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
700 0x01,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
701 0x02,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
702 0x04,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
703 0x08,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
704 0x10,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
705 0x20,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
706 0x40,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
707 0x80,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
708 0x1B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
709 0x36,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
710 0x6C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
711 0xD8,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
712 0xAB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
713 0x4D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
714 0x9A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
715 0x2F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
716 0x5E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
717 0xBC,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
718 0x63,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
719 0xC6,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
720 0x97,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
721 0x35,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
722 0x6A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
723 0xD4,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
724 0xB3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
725 0x7D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
726 0xFA,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
727 0xEF,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
728 0xC5,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
729 0x91,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
730 0x39,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
731 0x72,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
732 0xE4,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
733 0xD3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
734 0xBD,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
735 0x61,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
736 0xC2,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
737 0x9F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
738 0x25,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
739 0x4A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
740 0x94,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
741 0x33,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
742 0x66,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
743 0xCC,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
744 0x83,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
745 0x1D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
746 0x3A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
747 0x74,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
748 0xE8,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
749 0xCB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
750 0x8D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
751 0x01,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
752 0x02,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
753 0x04,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
754 0x08,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
755 0x10,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
756 0x20,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
757 0x40,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
758 0x80,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
759 0x1B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
760 0x36,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
761 0x6C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
762 0xD8,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
763 0xAB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
764 0x4D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
765 0x9A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
766 0x2F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
767 0x5E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
768 0xBC,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
769 0x63,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
770 0xC6,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
771 0x97,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
772 0x35,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
773 0x6A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
774 0xD4,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
775 0xB3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
776 0x7D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
777 0xFA,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
778 0xEF,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
779 0xC5,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
780 0x91,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
781 0x39,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
782 0x72,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
783 0xE4,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
784 0xD3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
785 0xBD,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
786 0x61,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
787 0xC2,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
788 0x9F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
789 0x25,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
790 0x4A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
791 0x94,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
792 0x33,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
793 0x66,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
794 0xCC,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
795 0x83,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
796 0x1D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
797 0x3A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
798 0x74,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
799 0xE8,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
800 0xCB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
801 0x8D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
802 0x01,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
803 0x02,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
804 0x04,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
805 0x08,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
806 0x10,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
807 0x20,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
808 0x40,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
809 0x80,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
810 0x1B,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
811 0x36,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
812 0x6C,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
813 0xD8,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
814 0xAB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
815 0x4D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
816 0x9A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
817 0x2F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
818 0x5E,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
819 0xBC,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
820 0x63,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
821 0xC6,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
822 0x97,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
823 0x35,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
824 0x6A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
825 0xD4,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
826 0xB3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
827 0x7D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
828 0xFA,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
829 0xEF,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
830 0xC5,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
831 0x91,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
832 0x39,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
833 0x72,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
834 0xE4,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
835 0xD3,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
836 0xBD,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
837 0x61,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
838 0xC2,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
839 0x9F,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
840 0x25,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
841 0x4A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
842 0x94,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
843 0x33,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
844 0x66,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
845 0xCC,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
846 0x83,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
847 0x1D,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
848 0x3A,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
849 0x74,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
850 0xE8,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
851 0xCB,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
852 ]
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
853
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
854 def __getSBoxValue(self, num):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
855 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
856 Private method to retrieve a given S-Box value.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
857
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
858 @param num position of the value
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
859 @type int
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
860 @return value of the S-Box
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
861 @rtype int
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
862 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
863 return self.sbox[num]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
864
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
865 def __getSBoxInvert(self, num):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
866 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
867 Private method to retrieve a given Inverted S-Box value.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
868
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
869 @param num position of the value
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
870 @type int
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
871 @return value of the Inverted S-Box
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
872 @rtype int
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
873 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
874 return self.rsbox[num]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
875
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
876 def __rotate(self, data):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
877 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
878 Private method performing Rijndael's key schedule rotate operation.
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
879
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
880 Rotate the data word eight bits to the left: eg,
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
881 rotate(1d2c3a4f) == 2c3a4f1d.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
882
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
883 @param data data of size 4
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
884 @type bytearray
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
885 @return rotated data
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
886 @rtype bytearray
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
887 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
888 return data[1:] + data[:1]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
889
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
890 def __getRconValue(self, num):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
891 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
892 Private method to retrieve a given Rcon value.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
893
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
894 @param num position of the value
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
895 @type int
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
896 @return Rcon value
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
897 @rtype int
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
898 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
899 return self.Rcon[num]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
900
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
901 def __core(self, data, iteration):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
902 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
903 Private method performing the key schedule core operation.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
904
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
905 @param data data to operate on
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
906 @type bytearray
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
907 @param iteration iteration counter
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
908 @type int
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
909 @return modified data
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
910 @rtype bytearray
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
911 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
912 # rotate the 32-bit word 8 bits to the left
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
913 data = self.__rotate(data)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
914 # apply S-Box substitution on all 4 parts of the 32-bit word
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
915 for i in range(4):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
916 data[i] = self.__getSBoxValue(data[i])
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
917 # XOR the output of the rcon operation with i to the first part
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
918 # (leftmost) only
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
919 data[0] = data[0] ^ self.__getRconValue(iteration)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
920 return data
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
921
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
922 def __expandKey(self, key, size, expandedKeySize):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
923 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
924 Private method performing Rijndael's key expansion.
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
925
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
926 Expands a 128, 192 or 256 bit key into a 176, 208 or 240 bit key.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
927
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
928 @param key key to be expanded
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
929 @type bytes or bytearray
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
930 @param size size of the key in bytes (16, 24 or 32)
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
931 @type int
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
932 @param expandedKeySize size of the expanded key
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
933 @type int
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
934 @return expanded key
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
935 @rtype bytearray
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
936 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
937 # current expanded keySize, in bytes
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
938 currentSize = 0
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
939 rconIteration = 1
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
940 expandedKey = bytearray(expandedKeySize)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
941
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
942 # set the 16, 24, 32 bytes of the expanded key to the input key
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
943 for j in range(size):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
944 expandedKey[j] = key[j]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
945 currentSize += size
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
946
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
947 while currentSize < expandedKeySize:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
948 # assign the previous 4 bytes to the temporary value t
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
949 t = expandedKey[currentSize - 4 : currentSize]
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
950
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
951 # every 16, 24, 32 bytes we apply the core schedule to t
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
952 # and increment rconIteration afterwards
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
953 if currentSize % size == 0:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
954 t = self.__core(t, rconIteration)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
955 rconIteration += 1
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
956 # For 256-bit keys, we add an extra sbox to the calculation
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
957 if size == self.KeySize["SIZE_256"] and ((currentSize % size) == 16):
7628
f904d0eef264 Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
958 for ll in range(4):
f904d0eef264 Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
959 t[ll] = self.__getSBoxValue(t[ll])
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
960
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
961 # We XOR t with the four-byte block 16, 24, 32 bytes before the new
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
962 # expanded key. This becomes the next four bytes in the expanded
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
963 # key.
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
964 for m in range(4):
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
965 expandedKey[currentSize] = expandedKey[currentSize - size] ^ t[m]
10180
3a595df36c9a Simplified some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
966 currentSize += 1 # noqa: Y113
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
967
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
968 return expandedKey
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
969
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
970 def __addRoundKey(self, state, roundKey):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
971 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
972 Private method to add (XORs) the round key to the state.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
973
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
974 @param state state to be changed
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
975 @type bytearray
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
976 @param roundKey key to be used for the modification
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
977 @type bytearray
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
978 @return modified state
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
979 @rtype bytearray
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
980 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
981 buf = state[:]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
982 for i in range(16):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
983 buf[i] ^= roundKey[i]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
984 return buf
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
985
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
986 def __createRoundKey(self, expandedKey, roundKeyPointer):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
987 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
988 Private method to create a round key.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
989
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
990 @param expandedKey expanded key to be used
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
991 @type bytearray
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
992 @param roundKeyPointer position within the expanded key
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
993 @type int
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
994 @return round key
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
995 @rtype bytearray
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
996 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
997 roundKey = bytearray(16)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
998 for i in range(4):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
999 for j in range(4):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1000 roundKey[j * 4 + i] = expandedKey[roundKeyPointer + i * 4 + j]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1001 return roundKey
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1002
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1003 def __galois_multiplication(self, a, b):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1004 """
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
1005 Private method to perform a Galois multiplication of 8 bit characters
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
1006 a and b.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1007
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1008 @param a first factor
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1009 @type bytes
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1010 @param b second factor
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1011 @type bytes
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1012 @return result
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1013 @rtype bytes
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1014 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1015 p = 0
6188
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
1016 for _counter in range(8):
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1017 if b & 1:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1018 p ^= a
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1019 hi_bit_set = a & 0x80
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1020 a <<= 1
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1021 # keep a 8 bit
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1022 a &= 0xFF
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1023 if hi_bit_set:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1024 a ^= 0x1B
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1025 b >>= 1
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1026 return p
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1027
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1028 def __subBytes(self, state, isInv):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1029 """
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
1030 Private method to substitute all the values from the state with the
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
1031 value in the SBox using the state value as index for the SBox.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1032
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1033 @param state state to be worked on
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1034 @type bytearray
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1035 @param isInv flag indicating an inverse operation
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1036 @type bool
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1037 @return modified state
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1038 @rtype bytearray
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1039 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1040 state = state[:]
8235
78e6d29eb773 Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator) (batch 3).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8220
diff changeset
1041 getter = self.__getSBoxInvert if isInv else self.__getSBoxValue
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1042 for i in range(16):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1043 state[i] = getter(state[i])
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1044 return state
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1045
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1046 def __shiftRows(self, state, isInv):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1047 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1048 Private method to iterate over the 4 rows and call __shiftRow() with
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1049 that row.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1050
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1051 @param state state to be worked on
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1052 @type bytearray
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1053 @param isInv flag indicating an inverse operation
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1054 @type bool
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1055 @return modified state
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1056 @rtype bytearray
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1057 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1058 state = state[:]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1059 for i in range(4):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1060 state = self.__shiftRow(state, i * 4, i, isInv)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1061 return state
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1062
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1063 def __shiftRow(self, state, statePointer, nbr, isInv):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1064 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1065 Private method to shift the bytes of a row to the left.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1066
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1067 @param state state to be worked on
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1068 @type bytearray
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1069 @param statePointer index into the state
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1070 @type int
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1071 @param nbr number of positions to shift
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1072 @type int
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1073 @param isInv flag indicating an inverse operation
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1074 @type bool
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1075 @return modified state
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1076 @rtype bytearray
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1077 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1078 state = state[:]
6188
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
1079 for _ in range(nbr):
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1080 if isInv:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1081 state[statePointer : statePointer + 4] = (
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1082 state[statePointer + 3 : statePointer + 4]
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1083 + state[statePointer : statePointer + 3]
7259
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1084 )
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1085 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1086 state[statePointer : statePointer + 4] = (
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1087 state[statePointer + 1 : statePointer + 4]
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1088 + state[statePointer : statePointer + 1]
7259
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1089 )
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1090 return state
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1091
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1092 def __mixColumns(self, state, isInv):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1093 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1094 Private method to perform a galois multiplication of the 4x4 matrix.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1095
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1096 @param state state to be worked on
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1097 @type bytearray
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1098 @param isInv flag indicating an inverse operation
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1099 @type bool
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1100 @return modified state
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1101 @rtype bytearray
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1102 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1103 state = state[:]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1104 # iterate over the 4 columns
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1105 for i in range(4):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1106 # construct one column by slicing over the 4 rows
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1107 column = state[i : i + 16 : 4]
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1108 # apply the __mixColumn on one column
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1109 column = self.__mixColumn(column, isInv)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1110 # put the values back into the state
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1111 state[i : i + 16 : 4] = column
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1112
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1113 return state
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1114
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1115 # galois multiplication of 1 column of the 4x4 matrix
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1116 def __mixColumn(self, column, isInv):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1117 """
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
1118 Private method to perform a galois multiplication of 1 column the
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
1119 4x4 matrix.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1120
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1121 @param column column to be worked on
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1122 @type bytearray
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1123 @param isInv flag indicating an inverse operation
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1124 @type bool
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1125 @return modified column
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1126 @rtype bytearray
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1127 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1128 column = column[:]
8235
78e6d29eb773 Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator) (batch 3).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8220
diff changeset
1129 mult = [14, 9, 13, 11] if isInv else [2, 1, 1, 3]
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1130 cpy = column[:]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1131 g = self.__galois_multiplication
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1132
5664
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5604
diff changeset
1133 column[0] = (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1134 g(cpy[0], mult[0])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1135 ^ g(cpy[3], mult[1])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1136 ^ g(cpy[2], mult[2])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1137 ^ g(cpy[1], mult[3])
5664
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5604
diff changeset
1138 )
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5604
diff changeset
1139 column[1] = (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1140 g(cpy[1], mult[0])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1141 ^ g(cpy[0], mult[1])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1142 ^ g(cpy[3], mult[2])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1143 ^ g(cpy[2], mult[3])
5664
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5604
diff changeset
1144 )
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5604
diff changeset
1145 column[2] = (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1146 g(cpy[2], mult[0])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1147 ^ g(cpy[1], mult[1])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1148 ^ g(cpy[0], mult[2])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1149 ^ g(cpy[3], mult[3])
5664
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5604
diff changeset
1150 )
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5604
diff changeset
1151 column[3] = (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1152 g(cpy[3], mult[0])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1153 ^ g(cpy[2], mult[1])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1154 ^ g(cpy[1], mult[2])
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1155 ^ g(cpy[0], mult[3])
5664
9b318fcb1ee2 Removed some code complexity issues detected by the new complexity checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5604
diff changeset
1156 )
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1157 return column
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1158
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1159 def __aes_round(self, state, roundKey):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1160 """
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
1161 Private method to apply the 4 operations of the forward round in
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
1162 sequence.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1163
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1164 @param state state to be worked on
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1165 @type bytearray
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1166 @param roundKey round key to be used
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1167 @type bytearray
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1168 @return modified state
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1169 @rtype bytearray
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1170 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1171 state = self.__subBytes(state, False)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1172 state = self.__shiftRows(state, False)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1173 state = self.__mixColumns(state, False)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1174 state = self.__addRoundKey(state, roundKey)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1175 return state
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1176
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1177 def __aes_invRound(self, state, roundKey):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1178 """
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
1179 Private method to apply the 4 operations of the inverse round in
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
1180 sequence.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1181
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1182 @param state state to be worked on
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1183 @type bytearray
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1184 @param roundKey round key to be used
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1185 @type bytearray
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1186 @return modified state
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1187 @rtype bytearray
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1188 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1189 state = self.__shiftRows(state, True)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1190 state = self.__subBytes(state, True)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1191 state = self.__addRoundKey(state, roundKey)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1192 state = self.__mixColumns(state, True)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1193 return state
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1194
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1195 def __aes_main(self, state, expandedKey, nbrRounds):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1196 """
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
1197 Private method to do the AES encryption for one round.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1198
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
1199 Perform the initial operations, the standard round, and the
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
1200 final operations of the forward AES, creating a round key for
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
1201 each round.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1202
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1203 @param state state to be worked on
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1204 @type bytearray
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1205 @param expandedKey expanded key to be used
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1206 @type bytearray
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1207 @param nbrRounds number of rounds to be done
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1208 @type int
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1209 @return modified state
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1210 @rtype bytearray
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1211 """
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1212 state = self.__addRoundKey(state, self.__createRoundKey(expandedKey, 0))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1213 i = 1
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1214 while i < nbrRounds:
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1215 state = self.__aes_round(state, self.__createRoundKey(expandedKey, 16 * i))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1216 i += 1
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1217 state = self.__subBytes(state, False)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1218 state = self.__shiftRows(state, False)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1219 state = self.__addRoundKey(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1220 state, self.__createRoundKey(expandedKey, 16 * nbrRounds)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1221 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1222 return state
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1223
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1224 def __aes_invMain(self, state, expandedKey, nbrRounds):
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1225 """
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1226 Private method to do the inverse AES encryption for one round.
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1227
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1228 Perform the initial operations, the standard round, and the
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1229 final operations of the inverse AES, creating a round key for
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1230 each round.
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1231
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1232 @param state state to be worked on
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1233 @type bytearray
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1234 @param expandedKey expanded key to be used
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1235 @type bytearray
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1236 @param nbrRounds number of rounds to be done
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1237 @type int
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1238 @return modified state
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1239 @rtype bytearray
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1240 """
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
1241 state = self.__addRoundKey(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1242 state, self.__createRoundKey(expandedKey, 16 * nbrRounds)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1243 )
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1244 i = nbrRounds - 1
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1245 while i > 0:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1246 state = self.__aes_invRound(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1247 state, self.__createRoundKey(expandedKey, 16 * i)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1248 )
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1249 i -= 1
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1250 state = self.__shiftRows(state, True)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1251 state = self.__subBytes(state, True)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1252 state = self.__addRoundKey(state, self.__createRoundKey(expandedKey, 0))
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1253 return state
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1254
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1255 def encrypt(self, iput, key, size):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1256 """
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
1257 Public method to encrypt a 128 bit input block against the given key
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
1258 of size specified.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1259
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1260 @param iput input data
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1261 @type bytearray
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1262 @param key key to be used
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1263 @type bytes or bytearray
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1264 @param size key size (16, 24 or 32)
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1265 @type int
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1266 @return encrypted data
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1267 @rtype bytes
3019
7912530a33e2 Fixed a few documentation strings that got broken while doing the line shortening job. That concludes the later.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2997
diff changeset
1268 @exception ValueError key size is invalid
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1269 """
8205
4a0f1f896341 Applied some code simplifications suggested by the new Simplify checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
1270 if size not in self.KeySize.values():
4a0f1f896341 Applied some code simplifications suggested by the new Simplify checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
1271 raise ValueError("Wrong key size given ({0}).".format(size))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1272
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1273 output = bytearray(16)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1274 # the number of rounds
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1275 nbrRounds = 0
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1276 # the 128 bit block to encode
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1277 block = bytearray(16)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1278 # set the number of rounds
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1279 if size == self.KeySize["SIZE_128"]:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1280 nbrRounds = 10
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1281 elif size == self.KeySize["SIZE_192"]:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1282 nbrRounds = 12
8205
4a0f1f896341 Applied some code simplifications suggested by the new Simplify checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
1283 else:
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1284 nbrRounds = 14
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1285
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1286 # the expanded keySize
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1287 expandedKeySize = 16 * (nbrRounds + 1)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1288
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1289 # Set the block values, for the block:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1290 # a0,0 a0,1 a0,2 a0,3
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1291 # a1,0 a1,1 a1,2 a1,3
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1292 # a2,0 a2,1 a2,2 a2,3
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1293 # a3,0 a3,1 a3,2 a3,3
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1294 # the mapping order is a0,0 a1,0 a2,0 a3,0 a0,1 a1,1 ... a2,3 a3,3
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1295 #
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1296 # iterate over the columns
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1297 for i in range(4):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1298 # iterate over the rows
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1299 for j in range(4):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1300 block[i + j * 4] = iput[i * 4 + j]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1301
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1302 # expand the key into an 176, 208, 240 bytes key
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1303 # the expanded key
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1304 expandedKey = self.__expandKey(key, size, expandedKeySize)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1305
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1306 # encrypt the block using the expandedKey
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1307 block = self.__aes_main(block, expandedKey, nbrRounds)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1308
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1309 # unmap the block again into the output
7628
f904d0eef264 Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1310 for kk in range(4):
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1311 # iterate over the rows
7628
f904d0eef264 Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1312 for ll in range(4):
f904d0eef264 Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1313 output[kk * 4 + ll] = block[kk + ll * 4]
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1314 return bytes(output)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1315
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1316 # decrypts a 128 bit input block against the given key of size specified
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1317 def decrypt(self, iput, key, size):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1318 """
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
1319 Public method to decrypt a 128 bit input block against the given key
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
1320 of size specified.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1321
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1322 @param iput input data
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1323 @type bytearray
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1324 @param key key to be used
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1325 @type bytes or bytearray
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1326 @param size key size (16, 24 or 32)
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1327 @type int
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1328 @return decrypted data
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1329 @rtype bytes
3019
7912530a33e2 Fixed a few documentation strings that got broken while doing the line shortening job. That concludes the later.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2997
diff changeset
1330 @exception ValueError key size is invalid
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1331 """
8205
4a0f1f896341 Applied some code simplifications suggested by the new Simplify checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
1332 if size not in self.KeySize.values():
4a0f1f896341 Applied some code simplifications suggested by the new Simplify checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
1333 raise ValueError("Wrong key size given ({0}).".format(size))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1334
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1335 output = bytearray(16)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1336 # the number of rounds
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1337 nbrRounds = 0
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1338 # the 128 bit block to decode
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1339 block = bytearray(16)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1340 # set the number of rounds
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1341
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1342 if size == self.KeySize["SIZE_128"]:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1343 nbrRounds = 10
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1344 elif size == self.KeySize["SIZE_192"]:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1345 nbrRounds = 12
8205
4a0f1f896341 Applied some code simplifications suggested by the new Simplify checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
1346 else:
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1347 nbrRounds = 14
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1348
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1349 # the expanded keySize
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1350 expandedKeySize = 16 * (nbrRounds + 1)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1351
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1352 # Set the block values, for the block:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1353 # a0,0 a0,1 a0,2 a0,3
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1354 # a1,0 a1,1 a1,2 a1,3
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1355 # a2,0 a2,1 a2,2 a2,3
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1356 # a3,0 a3,1 a3,2 a3,3
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1357 # the mapping order is a0,0 a1,0 a2,0 a3,0 a0,1 a1,1 ... a2,3 a3,3
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1358
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1359 # iterate over the columns
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1360 for i in range(4):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1361 # iterate over the rows
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1362 for j in range(4):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1363 block[i + j * 4] = iput[i * 4 + j]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1364 # expand the key into an 176, 208, 240 bytes key
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1365 expandedKey = self.__expandKey(key, size, expandedKeySize)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1366 # decrypt the block using the expandedKey
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1367 block = self.__aes_invMain(block, expandedKey, nbrRounds)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1368 # unmap the block again into the output
7628
f904d0eef264 Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1369 for kk in range(4):
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1370 # iterate over the rows
7628
f904d0eef264 Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1371 for ll in range(4):
f904d0eef264 Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1372 output[kk * 4 + ll] = block[kk + ll * 4]
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1373 return output
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1374
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1375
8207
d359172d11be Applied some more code simplifications suggested by the new Simplify checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8205
diff changeset
1376 class AESModeOfOperation:
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1377 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1378 Class implementing the different AES mode of operations.
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1379 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1380
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1381 aes = AES()
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1382
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1383 # structure of supported modes of operation
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1384 ModeOfOperation = {
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1385 "OFB": 0,
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1386 "CFB": 1,
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1387 "CBC": 2,
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1388 }
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1389
5604
b047181a4a33 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1390 def __extractBytes(self, inputData, start, end, mode):
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1391 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1392 Private method to extract a range of bytes from the input.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1393
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1394 @param inputData input data
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1395 @type bytes
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1396 @param start start index
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1397 @type int
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1398 @param end end index
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1399 @type int
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1400 @param mode mode of operation (0, 1, 2)
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1401 @type int
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1402 @return extracted bytes
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1403 @rtype bytearray
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1404 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1405 if end - start > 16:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1406 end = start + 16
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1407 ar = bytearray(16) if mode == self.ModeOfOperation["CBC"] else bytearray()
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1408
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1409 i = start
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1410 j = 0
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1411 while len(ar) < end - start:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1412 ar.append(0)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1413 while i < end:
5604
b047181a4a33 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1414 ar[j] = inputData[i]
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1415 j += 1
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1416 i += 1
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1417 return ar
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1418
5604
b047181a4a33 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1419 def encrypt(self, inputData, mode, key, size, IV):
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1420 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1421 Public method to perform the encryption operation.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1422
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1423 @param inputData data to be encrypted
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1424 @type bytes
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1425 @param mode mode of operation (0, 1 or 2)
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1426 @type int
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1427 @param key key to be used
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1428 @type bytes
1682
0eefcc28fa74 Changed the hash iterations for sync encryption to 100 and made the key length user configurable (user can optimize for speed).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
1429 @param size length of the key (16, 24 or 32)
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1430 @type int
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1431 @param IV initialisation vector
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1432 @type bytearray
5604
b047181a4a33 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1433 @return tuple with mode of operation, length of the input data and
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1434 the encrypted data
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1435 @rtype tuple of (int, int, bytes)
3019
7912530a33e2 Fixed a few documentation strings that got broken while doing the line shortening job. That concludes the later.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2997
diff changeset
1436 @exception ValueError key size is invalid or decrypted data is invalid
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1437 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1438 if len(key) % size:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1439 raise ValueError("Illegal size ({0}) for key '{1}'.".format(size, key))
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1440 if len(IV) % 16:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1441 raise ValueError("IV is not a multiple of 16.")
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1442 # the AES input/output
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1443 iput = bytearray(16)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1444 output = bytearray()
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1445 ciphertext = bytearray(16)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1446 # the output cipher string
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1447 cipherOut = bytearray()
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1448 # char firstRound
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1449 firstRound = True
5604
b047181a4a33 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1450 if inputData:
b047181a4a33 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1451 for j in range(int(math.ceil(float(len(inputData)) / 16))):
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1452 start = j * 16
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1453 end = j * 16 + 16
5604
b047181a4a33 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1454 if end > len(inputData):
b047181a4a33 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1455 end = len(inputData)
b047181a4a33 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1456 plaintext = self.__extractBytes(inputData, start, end, mode)
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1457 if mode == self.ModeOfOperation["CFB"]:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1458 if firstRound:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1459 output = self.aes.encrypt(IV, key, size)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1460 firstRound = False
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1461 else:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1462 output = self.aes.encrypt(iput, key, size)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1463 for i in range(16):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1464 if len(plaintext) - 1 < i:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1465 ciphertext[i] = 0 ^ output[i]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1466 elif len(output) - 1 < i:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1467 ciphertext[i] = plaintext[i] ^ 0
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1468 elif len(plaintext) - 1 < i and len(output) < i:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1469 ciphertext[i] = 0 ^ 0
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1470 else:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1471 ciphertext[i] = plaintext[i] ^ output[i]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1472 for k in range(end - start):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1473 cipherOut.append(ciphertext[k])
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1474 iput = ciphertext
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1475 elif mode == self.ModeOfOperation["OFB"]:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1476 if firstRound:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1477 output = self.aes.encrypt(IV, key, size)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1478 firstRound = False
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1479 else:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1480 output = self.aes.encrypt(iput, key, size)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1481 for i in range(16):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1482 if len(plaintext) - 1 < i:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1483 ciphertext[i] = 0 ^ output[i]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1484 elif len(output) - 1 < i:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1485 ciphertext[i] = plaintext[i] ^ 0
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1486 elif len(plaintext) - 1 < i and len(output) < i:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1487 ciphertext[i] = 0 ^ 0
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1488 else:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1489 ciphertext[i] = plaintext[i] ^ output[i]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1490 for k in range(end - start):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1491 cipherOut.append(ciphertext[k])
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1492 iput = output
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1493 elif mode == self.ModeOfOperation["CBC"]:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1494 for i in range(16):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1495 if firstRound:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1496 iput[i] = plaintext[i] ^ IV[i]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1497 else:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1498 iput[i] = plaintext[i] ^ ciphertext[i]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1499 firstRound = False
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1500 ciphertext = self.aes.encrypt(iput, key, size)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1501 # always 16 bytes because of the padding for CBC
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1502 for k in range(16):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1503 cipherOut.append(ciphertext[k])
5604
b047181a4a33 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
1504 return mode, len(inputData), bytes(cipherOut)
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1505
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1506 # Mode of Operation Decryption
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1507 # cipherIn - Encrypted String
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1508 # originalsize - The unencrypted string length - required for CBC
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1509 # mode - mode of type modeOfOperation
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1510 # key - a number array of the bit length size
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1511 # size - the bit length of the key
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1512 # IV - the 128 bit number array Initilization Vector
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1513 def decrypt(self, cipherIn, originalsize, mode, key, size, IV):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1514 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1515 Public method to perform the decryption operation.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1516
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1517 @param cipherIn data to be decrypted
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1518 @type bytes
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1519 @param originalsize unencrypted string length (required for CBC)
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1520 @type int
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1521 @param mode mode of operation (0, 1 or 2)
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1522 @type int
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1523 @param key key to be used
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1524 @type bytes
1682
0eefcc28fa74 Changed the hash iterations for sync encryption to 100 and made the key length user configurable (user can optimize for speed).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
1525 @param size length of the key (16, 24 or 32)
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1526 @type int
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1527 @param IV initialisation vector
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1528 @type bytearray
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1529 @return decrypted data
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1530 @rtype bytes
3019
7912530a33e2 Fixed a few documentation strings that got broken while doing the line shortening job. That concludes the later.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2997
diff changeset
1531 @exception ValueError key size is invalid or decrypted data is invalid
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1532 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1533 if len(key) % size:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1534 raise ValueError("Illegal size ({0}) for key '{1}'.".format(size, key))
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1535 if len(IV) % 16:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1536 raise ValueError("IV is not a multiple of 16.")
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1537 # the AES input/output
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1538 ciphertext = bytearray()
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1539 iput = bytearray()
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1540 output = bytearray()
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1541 plaintext = bytearray(16)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1542 # the output bytes
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1543 bytesOut = bytearray()
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1544 # char firstRound
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1545 firstRound = True
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3019
diff changeset
1546 if cipherIn is not None:
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1547 for j in range(int(math.ceil(float(len(cipherIn)) / 16))):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1548 start = j * 16
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1549 end = j * 16 + 16
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1550 if j * 16 + 16 > len(cipherIn):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1551 end = len(cipherIn)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1552 ciphertext = cipherIn[start:end]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1553 if mode == self.ModeOfOperation["CFB"]:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1554 if firstRound:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1555 output = self.aes.encrypt(IV, key, size)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1556 firstRound = False
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1557 else:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1558 output = self.aes.encrypt(iput, key, size)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1559 for i in range(16):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1560 if len(output) - 1 < i:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1561 plaintext[i] = 0 ^ ciphertext[i]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1562 elif len(ciphertext) - 1 < i:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1563 plaintext[i] = output[i] ^ 0
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1564 elif len(output) - 1 < i and len(ciphertext) < i:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1565 plaintext[i] = 0 ^ 0
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1566 else:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1567 plaintext[i] = output[i] ^ ciphertext[i]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1568 for k in range(end - start):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1569 bytesOut.append(plaintext[k])
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1570 iput = ciphertext
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1571 elif mode == self.ModeOfOperation["OFB"]:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1572 if firstRound:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1573 output = self.aes.encrypt(IV, key, size)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1574 firstRound = False
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1575 else:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1576 output = self.aes.encrypt(iput, key, size)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1577 for i in range(16):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1578 if len(output) - 1 < i:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1579 plaintext[i] = 0 ^ ciphertext[i]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1580 elif len(ciphertext) - 1 < i:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1581 plaintext[i] = output[i] ^ 0
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1582 elif len(output) - 1 < i and len(ciphertext) < i:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1583 plaintext[i] = 0 ^ 0
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1584 else:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1585 plaintext[i] = output[i] ^ ciphertext[i]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1586 for k in range(end - start):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1587 bytesOut.append(plaintext[k])
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1588 iput = output
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1589 elif mode == self.ModeOfOperation["CBC"]:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1590 output = self.aes.decrypt(ciphertext, key, size)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1591 for i in range(16):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1592 if firstRound:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1593 plaintext[i] = IV[i] ^ output[i]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1594 else:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1595 plaintext[i] = iput[i] ^ output[i]
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1596 firstRound = False
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1597 if originalsize is not None and originalsize < end:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1598 for k in range(originalsize - start):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1599 bytesOut.append(plaintext[k])
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1600 else:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1601 for k in range(end - start):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1602 bytesOut.append(plaintext[k])
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1603 iput = ciphertext
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1604 return bytes(bytesOut)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1605
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1606
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1607 def encryptData(key, data, mode=AESModeOfOperation.ModeOfOperation["CBC"]):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1608 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1609 Module function to encrypt the given data with the given key.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1610
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1611 @param key key to be used for encryption
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1612 @type bytes
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1613 @param data data to be encrypted
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1614 @type bytes
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1615 @param mode mode of operations (0, 1 or 2)
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1616 @type int
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1617 @return encrypted data prepended with the initialization vector
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1618 @rtype bytes
7628
f904d0eef264 Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1619 @exception ValueError raised to indicate an invalid key size
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1620 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1621 key = bytearray(key)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1622 if mode == AESModeOfOperation.ModeOfOperation["CBC"]:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1623 data = append_PKCS7_padding(data)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1624 keysize = len(key)
7628
f904d0eef264 Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1625 if keysize not in AES.KeySize.values():
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1626 raise ValueError("invalid key size: {0}".format(keysize))
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1627 # create a new iv using random data
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1628 iv = bytearray([i for i in os.urandom(16)])
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1629 moo = AESModeOfOperation()
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1630 mode, length, ciph = moo.encrypt(data, mode, key, keysize, iv)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1631 # With padding, the original length does not need to be known. It's a bad
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1632 # idea to store the original message length.
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1633 # prepend the iv.
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1634 return bytes(iv) + bytes(ciph)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1635
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1636
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1637 def decryptData(key, data, mode=AESModeOfOperation.ModeOfOperation["CBC"]):
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1638 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1639 Module function to decrypt the given data with the given key.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1640
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1641 @param key key to be used for decryption
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1642 @type bytes
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
1643 @param data data to be decrypted (with initialization vector prepended)
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1644 @type bytes
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1645 @param mode mode of operations (0, 1 or 2)
10433
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1646 @type int
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1647 @return decrypted data
328f3ec4b77a Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10180
diff changeset
1648 @rtype bytes
7628
f904d0eef264 Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1649 @exception ValueError raised to indicate an invalid key size
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1650 """
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1651 key = bytearray(key)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1652 keysize = len(key)
7628
f904d0eef264 Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
1653 if keysize not in AES.KeySize.values():
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
1654 raise ValueError("invalid key size: {0}".format(keysize))
1127
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1655 # iv is first 16 bytes
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1656 iv = bytearray(data[:16])
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1657 data = bytearray(data[16:])
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1658 moo = AESModeOfOperation()
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1659 decr = moo.decrypt(data, None, mode, key, keysize, iv)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1660 if mode == AESModeOfOperation.ModeOfOperation["CBC"]:
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1661 decr = strip_PKCS7_padding(decr)
b1802ebe0066 Added capability to encrypt saved passwords with a master password and rearranged some configuration parameters related to security.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1662 return bytes(decr)

eric ide

mercurial