1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-29 10:58:21 +00:00

fix flake8 issues

This commit is contained in:
Pavol Rusnak 2018-05-28 15:23:37 +02:00
parent d1800e0256
commit 307f7baecf
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 17 additions and 17 deletions

View File

@ -25,7 +25,7 @@ def encode(s: bytes) -> str:
# leftover bit of c1 and tack it onto c2. Then we take the 2 leftover # leftover bit of c1 and tack it onto c2. Then we take the 2 leftover
# bits of c2 and tack them onto c3. The shifts and masks are intended # bits of c2 and tack them onto c3. The shifts and masks are intended
# to give us values of exactly 5 bits in width. # to give us values of exactly 5 bits in width.
c1, c2, c3 = unpack('!HHB', s[i*5:(i+1)*5]) c1, c2, c3 = unpack('!HHB', s[i * 5:(i + 1) * 5])
c2 += (c1 & 1) << 16 # 17 bits wide c2 += (c1 & 1) << 16 # 17 bits wide
c3 += (c2 & 3) << 8 # 10 bits wide c3 += (c2 & 3) << 8 # 10 bits wide
encoded += bytes([_b32tab[c1 >> 11], # bits 1 - 5 encoded += bytes([_b32tab[c1 >> 11], # bits 1 - 5

View File

@ -24,12 +24,12 @@ class TestCryptoBase32(unittest.TestCase):
(b'zlutoucky kun upel dabelske ody', 'PJWHK5DPOVRWW6JANN2W4IDVOBSWYIDEMFRGK3DTNNSSA33EPE======'), (b'zlutoucky kun upel dabelske ody', 'PJWHK5DPOVRWW6JANN2W4IDVOBSWYIDEMFRGK3DTNNSSA33EPE======'),
(b'中文', '4S4K3ZUWQ4======'), (b'中文', '4S4K3ZUWQ4======'), # noqa:E999
(b'中文1', '4S4K3ZUWQ4YQ===='), (b'中文1', '4S4K3ZUWQ4YQ===='), # noqa:E999
(b'中文12', '4S4K3ZUWQ4YTE==='), (b'中文12', '4S4K3ZUWQ4YTE==='), # noqa:E999
(b'aécio', 'MHB2SY3JN4======'), (b'aécio', 'MHB2SY3JN4======'), # noqa:E999
(b'𠜎', '6CQJZDQ='), (b'𠜎', '6CQJZDQ='), # noqa:E999
(b'Base64是一種基於64個可列印字元來表示二進制資料的表示方法', (b'Base64是一種基於64個可列印字元來表示二進制資料的表示方法', # noqa:E999
'IJQXGZJWGTTJRL7EXCAOPKFO4WP3VZUWXQ3DJZMARPSY7L7FRCL6LDNQ4WWZPZMFQPSL5BXIUGUOPJF24S5IZ2MAWLSYRNXIWOD6NFUZ46NIJ2FBVDT2JOXGS246NM4V') 'IJQXGZJWGTTJRL7EXCAOPKFO4WP3VZUWXQ3DJZMARPSY7L7FRCL6LDNQ4WWZPZMFQPSL5BXIUGUOPJF24S5IZ2MAWLSYRNXIWOD6NFUZ46NIJ2FBVDT2JOXGS246NM4V')
] ]