Conditions | 2 |
Total Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2.0116 |
1 | # -*- coding: utf-8 -*- |
||
9 | 10 | @classmethod |
|
10 | def encode(cls, text): |
||
11 | 10 | length = len(text) |
|
12 | 10 | padding_count = cls.block_size - length % cls.block_size |
|
13 | 10 | if padding_count == 0: |
|
14 | padding_count = cls.block_size |
||
15 | 10 | padding = to_binary(chr(padding_count)) |
|
16 | 10 | return text + padding * padding_count |
|
17 | |||
24 |