diff options
author | Yen Chi Hsuan <[email protected]> | 2017-02-27 18:50:19 +0800 |
---|---|---|
committer | Yen Chi Hsuan <[email protected]> | 2017-02-28 22:10:31 +0800 |
commit | f48409c7ac186fa38bbeb2df2b210e37a18eb04b (patch) | |
tree | 8046e12170bfafc7b0e62bd37e968833d1ce1156 /test/test_utils.py | |
parent | c9619f0a17927086c49e4b443202be296d734a76 (diff) | |
download | youtube-dl-f48409c7ac186fa38bbeb2df2b210e37a18eb04b.tar.gz youtube-dl-f48409c7ac186fa38bbeb2df2b210e37a18eb04b.zip |
[utils] Add pkcs1pad
Used in daisuki.net (#4738)
Diffstat (limited to 'test/test_utils.py')
-rw-r--r-- | test/test_utils.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py index 3cdb21d40..aefd94518 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -52,6 +52,7 @@ from youtube_dl.utils import ( parse_filesize, parse_count, parse_iso8601, + pkcs1pad, read_batch_urls, sanitize_filename, sanitize_path, @@ -1104,6 +1105,14 @@ The first line ohdave_rsa_encrypt(b'aa111222', e, N), '726664bd9a23fd0c70f9f1b84aab5e3905ce1e45a584e9cbcf9bcc7510338fc1986d6c599ff990d923aa43c51c0d9013cd572e13bc58f4ae48f2ed8c0b0ba881') + def test_pkcs1pad(self): + data = [1, 2, 3] + padded_data = pkcs1pad(data, 32) + self.assertEqual(padded_data[:2], [0, 2]) + self.assertEqual(padded_data[28:], [0, 1, 2, 3]) + + self.assertRaises(ValueError, pkcs1pad, data, 8) + def test_encode_base_n(self): self.assertEqual(encode_base_n(0, 30), '0') self.assertEqual(encode_base_n(80, 30), '2k') |