Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: third_party/google-endpoints/Crypto/SelfTest/Random/Fortuna/test_SHAd256.py

Issue 2666783008: Add google-endpoints to third_party/. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # -*- coding: utf-8 -*-
2 #
3 # SelfTest/Random/Fortuna/test_SHAd256.py: Self-test for the SHAd256 hash funct ion
4 #
5 # Written in 2008 by Dwayne C. Litzenberger <dlitz@dlitz.net>
6 #
7 # ===================================================================
8 # The contents of this file are dedicated to the public domain. To
9 # the extent that dedication to the public domain is not available,
10 # everyone is granted a worldwide, perpetual, royalty-free,
11 # non-exclusive license to exercise all rights associated with the
12 # contents of this file for any purpose whatsoever.
13 # No rights are reserved.
14 #
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 # SOFTWARE.
23 # ===================================================================
24
25 """Self-test suite for Crypto.Random.Fortuna.SHAd256"""
26
27 __revision__ = "$Id$"
28 from Crypto.Util.py3compat import *
29
30 # This is a list of (expected_result, input[, description]) tuples.
31 test_data = [
32 # I could not find any test vectors for SHAd256, so I made these vectors by
33 # feeding some sample data into several plain SHA256 implementations
34 # (including OpenSSL, the "sha256sum" tool, and this implementation).
35 # This is a subset of the resulting test vectors. The complete list can be
36 # found at: http://www.dlitz.net/crypto/shad256-test-vectors/
37 ('5df6e0e2761359d30a8275058e299fcc0381534545f55cf43e41983f5d4c9456',
38 '', "'' (empty string)"),
39 ('4f8b42c22dd3729b519ba6f68d2da7cc5b2d606d05daed5ad5128cc03e6c6358',
40 'abc'),
41 ('0cffe17f68954dac3a84fb1458bd5ec99209449749b2b308b7cb55812f9563af',
42 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq')
43 ]
44
45 def get_tests(config={}):
46 from Crypto.Random.Fortuna import SHAd256
47 from Crypto.SelfTest.Hash.common import make_hash_tests
48 return make_hash_tests(SHAd256, "SHAd256", test_data, 32)
49
50 if __name__ == '__main__':
51 import unittest
52 suite = lambda: unittest.TestSuite(get_tests())
53 unittest.main(defaultTest='suite')
54
55 # vim:set ts=4 sw=4 sts=4 expandtab:
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698