Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
e370409c
Kaydet (Commit)
e370409c
authored
Eyl 23, 2016
tarafından
Christian Heimes
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add test cases for internal SHA3 helpers
üst
21c8c924
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
test_hashlib.py
Lib/test/test_hashlib.py
+21
-0
No files found.
Lib/test/test_hashlib.py
Dosyayı görüntüle @
e370409c
...
...
@@ -339,6 +339,9 @@ class HashLibTestCase(unittest.TestCase):
self
.
check_blocksize_name
(
'sha256'
,
64
,
32
)
self
.
check_blocksize_name
(
'sha384'
,
128
,
48
)
self
.
check_blocksize_name
(
'sha512'
,
128
,
64
)
@requires_sha3
def
test_blocksize_name_sha3
(
self
):
self
.
check_blocksize_name
(
'sha3_224'
,
144
,
28
)
self
.
check_blocksize_name
(
'sha3_256'
,
136
,
32
)
self
.
check_blocksize_name
(
'sha3_384'
,
104
,
48
)
...
...
@@ -346,6 +349,24 @@ class HashLibTestCase(unittest.TestCase):
self
.
check_blocksize_name
(
'shake_128'
,
168
,
0
,
32
)
self
.
check_blocksize_name
(
'shake_256'
,
136
,
0
,
64
)
def
check_sha3
(
self
,
name
,
capacity
,
rate
,
suffix
):
constructors
=
self
.
constructors_to_test
[
name
]
for
hash_object_constructor
in
constructors
:
m
=
hash_object_constructor
()
self
.
assertEqual
(
capacity
+
rate
,
1600
)
self
.
assertEqual
(
m
.
_capacity_bits
,
capacity
)
self
.
assertEqual
(
m
.
_rate_bits
,
rate
)
self
.
assertEqual
(
m
.
_suffix
,
suffix
)
@requires_sha3
def
test_extra_sha3
(
self
):
self
.
check_sha3
(
'sha3_224'
,
448
,
1152
,
b
'
\x06
'
)
self
.
check_sha3
(
'sha3_256'
,
512
,
1088
,
b
'
\x06
'
)
self
.
check_sha3
(
'sha3_384'
,
768
,
832
,
b
'
\x06
'
)
self
.
check_sha3
(
'sha3_512'
,
1024
,
576
,
b
'
\x06
'
)
self
.
check_sha3
(
'shake_128'
,
256
,
1344
,
b
'
\x1f
'
)
self
.
check_sha3
(
'shake_256'
,
512
,
1088
,
b
'
\x1f
'
)
@requires_blake2
def
test_blocksize_name_blake2
(
self
):
self
.
check_blocksize_name
(
'blake2b'
,
128
,
64
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment