diff options
author | Justin Lecher <jlec@gentoo.org> | 2013-06-03 19:49:24 +0000 |
---|---|---|
committer | Justin Lecher <jlec@gentoo.org> | 2013-06-03 19:49:24 +0000 |
commit | c890a373a8e43fe58d066ebeebf6e0045ef75358 (patch) | |
tree | 7ac6d2f073acb3defa35f70307c09c4f91a2dd23 /dev-python/whirlpool | |
parent | www-client/httrack: Remove src_test of 3.47.17 that should not have been comi... (diff) | |
download | gentoo-2-c890a373a8e43fe58d066ebeebf6e0045ef75358.tar.gz gentoo-2-c890a373a8e43fe58d066ebeebf6e0045ef75358.tar.bz2 gentoo-2-c890a373a8e43fe58d066ebeebf6e0045ef75358.zip |
dev-python/whirlpool: New addition
(Portage version: 2.2.0_alpha177/cvs/Linux x86_64, signed Manifest commit with key 8009D6F070EB7916)
Diffstat (limited to 'dev-python/whirlpool')
-rw-r--r-- | dev-python/whirlpool/ChangeLog | 10 | ||||
-rw-r--r-- | dev-python/whirlpool/Manifest | 5 | ||||
-rw-r--r-- | dev-python/whirlpool/files/tests.py | 96 | ||||
-rw-r--r-- | dev-python/whirlpool/metadata.xml | 8 | ||||
-rw-r--r-- | dev-python/whirlpool/whirlpool-0.3.ebuild | 31 |
5 files changed, 150 insertions, 0 deletions
diff --git a/dev-python/whirlpool/ChangeLog b/dev-python/whirlpool/ChangeLog new file mode 100644 index 000000000000..f8c5e56afec6 --- /dev/null +++ b/dev-python/whirlpool/ChangeLog @@ -0,0 +1,10 @@ +# ChangeLog for dev-python/whirlpool +# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/dev-python/whirlpool/ChangeLog,v 1.1 2013/06/03 19:49:24 jlec Exp $ + +*whirlpool-0.3 (03 Jun 2013) + + 03 Jun 2013; Justin Lecher <jlec@gentoo.org> +whirlpool-0.3.ebuild, + +files/tests.py, +metadata.xml: + New addition + diff --git a/dev-python/whirlpool/Manifest b/dev-python/whirlpool/Manifest new file mode 100644 index 000000000000..d6019ec0f020 --- /dev/null +++ b/dev-python/whirlpool/Manifest @@ -0,0 +1,5 @@ +AUX tests.py 3759 SHA256 bfcc6a613c42cec5b97d9766d11e524ed5134749471d27ad289623dfb987de7c SHA512 902c785311f1d09331df53e4531274c2211e107cb45f0687bfbf6c5922f572ed0a614cd52ce4575e7d9093e79f715b8a3b20a2a6fb40c438779538bf1d404fe2 WHIRLPOOL a9c974538df2122718f73bdb4dd0a9826e7f016c40bd193ca40909fe8a18a5a6c3cf49ad10a2d810676c70b2c28c375b42cce2ee16a91ec409371227f2495c81 +DIST Whirlpool-0.3.tar.gz 34508 SHA256 27702b350b0cb6ea944cbe048419b48e0a66186fd89e0ef1b293d92dbd05f551 SHA512 d9fed84ff0af885534e70f537c0c17f19ad46d31b2b1d77749328e6cba37a805bb8e178539d09a479b0d7a7e93d11f69858db5b3fdc6c3fad9a89fc727004770 WHIRLPOOL 6c25f8fbeec916e65b594da51a28cabbc6a982e82eea3a0d76e71b8a9b46d98cef0f8d733e5c43d0716f878c9a86177918ebba6612d4007777362e53956604ca +EBUILD whirlpool-0.3.ebuild 711 SHA256 472a2f0ed1af694e0b362d2364d222e33e82f0c2013998ed2c1e8e7049e24071 SHA512 1e8655c837e7a18d5126d7a853f60ba3ec14d03f497aa54a592d8f6609e2954181618de604c805089970b3bfcd2ad3f2f4241cad3c9453f093e356c83b225e1b WHIRLPOOL 34b52985e45106c7d5767877deeb3612c39b39c612bf280b0ae8273dc05f448ef3dffee14fe30472585b70b25ded4fe01330890eb12aa1c342afe1dd9078e16c +MISC ChangeLog 271 SHA256 11fff78797f9ff36af8636100e162107db16afc6544759793e85ce648ad2bcfe SHA512 5379f9086710b1f9f6223e687278b3047d603ca7a0c44972b35dd6f4d5f954c3fc013e9229d632c4bed6b56445cabc54cb7997e8cdc0feaab012419679f73135 WHIRLPOOL 340edcfe5e9eef44933f90da78791fb633daf174cf27c1639904670fdb4bb20f0fab3092845d9914b68f50203688353973280b4140d4512788c8dd72cc1fdf7a +MISC metadata.xml 227 SHA256 aef43758cae524923aefea72b3a1f2896b3dcca8d0135dc75a08149549388105 SHA512 40677314811b092252949d13d1d07aaf721f7e8ba47da28ac21239f881e7c919bcad9384d2f0bf0eff95e11912443aa1f2bab7e94e1a3029c9aa97a3654795dc WHIRLPOOL 1ce8a3cc4ae9ce91daa6bd030e5be25fdbee0fc29e14b943024c932cff8d6da58c6d152d02fb8703fc285331f3dd010ec832f8a5ddb18c7cd33c9ae97507dd76 diff --git a/dev-python/whirlpool/files/tests.py b/dev-python/whirlpool/files/tests.py new file mode 100644 index 000000000000..521148b33edb --- /dev/null +++ b/dev-python/whirlpool/files/tests.py @@ -0,0 +1,96 @@ +import unittest + +import whirlpool + +from binascii import b2a_hex + + +results = { + 'empty' : '19fa61d75522a4669b44e39c1d2e1726c530232130d407f89afee0964997f7a73e83be698b288febcf88e3e03c4f0757ea8964e59b63d93708b138cc42a66eb3', + 'tqbfjotld' : 'b97de512e91e3828b40d2b0fdce9ceb3c4a71f9bea8d88e75c4fa854df36725fd2b52eb6544edcacd6f8beddfea403cb55ae31f03ad62a5ef54e42ee82c3fb35', + 'tqbfjotle' : 'c27ba124205f72e6847f3e19834f925cc666d0974167af915bb462420ed40cc50900d85a1f923219d832357750492d5c143011a76988344c2635e69d06f2d38c', + 'tqbf' : '317edc3c5172ea5987902aa9c4f1defedf4d5aa59209bdf7574cc6da0039852c24b8da70ecb07997ff83e86d32d2851215d3dcbd6bb9736bdef21c349d483e6d', +} + + +class TestWhirlpool(unittest.TestCase): + + def test_hash_empty(self): + self.assertEqual(b2a_hex(whirlpool.hash('')), results['empty']) + + def test_hash_fox(self): + self.assertEqual( + b2a_hex(whirlpool.hash('The quick brown fox jumps over the lazy dog')), + results['tqbfjotld']) + self.assertEqual( + b2a_hex(whirlpool.hash('The quick brown fox jumps over the lazy eog')), + results['tqbfjotle']) + + def test_new_empty(self): + wp = whirlpool.new() + self.assertEqual(b2a_hex(wp.digest()), results['empty']) + self.assertEqual(wp.hexdigest(), results['empty']) + + def test_new_fox(self): + wp1 = whirlpool.new('The quick brown fox jumps over the lazy dog') + self.assertEqual(b2a_hex(wp1.digest()), results['tqbfjotld']) + self.assertEqual(wp1.hexdigest(), results['tqbfjotld']) + + wp2 = whirlpool.new('The quick brown fox jumps over the lazy eog') + self.assertEqual(b2a_hex(wp2.digest()), results['tqbfjotle']) + self.assertEqual(wp2.hexdigest(), results['tqbfjotle']) + + def test_update_copy(self): + wp1 = whirlpool.new() + wp2 = wp1.copy() + wp1.update('The quick brown fox') + wp3 = wp1.copy() + + self.assertEqual(b2a_hex(wp1.digest()), results['tqbf']) + self.assertEqual(wp1.hexdigest(), results['tqbf']) + + self.assertEqual(b2a_hex(wp2.digest()), results['empty']) + self.assertEqual(wp2.hexdigest(), results['empty']) + + self.assertEqual(b2a_hex(wp3.digest()), results['tqbf']) + self.assertEqual(wp3.hexdigest(), results['tqbf']) + + wp1.update(' jumps over the lazy dog') + + self.assertEqual(b2a_hex(wp1.digest()), results['tqbfjotld']) + self.assertEqual(wp1.hexdigest(), results['tqbfjotld']) + + self.assertEqual(b2a_hex(wp2.digest()), results['empty']) + self.assertEqual(wp2.hexdigest(), results['empty']) + + self.assertEqual(b2a_hex(wp3.digest()), results['tqbf']) + self.assertEqual(wp3.hexdigest(), results['tqbf']) + + wp3.update(' jumps over the lazy eog') + + self.assertEqual(b2a_hex(wp1.digest()), results['tqbfjotld']) + self.assertEqual(wp1.hexdigest(), results['tqbfjotld']) + + self.assertEqual(b2a_hex(wp2.digest()), results['empty']) + self.assertEqual(wp2.hexdigest(), results['empty']) + + self.assertEqual(b2a_hex(wp3.digest()), results['tqbfjotle']) + self.assertEqual(wp3.hexdigest(), results['tqbfjotle']) + + def test_digest_size(self): + wp = whirlpool.new() + self.assertEqual(wp.digest_size, 64) + with self.assertRaisesRegexp(AttributeError, + 'digest_size.*not writable'): + wp.digest_size = 32 + + def test_block_size(self): + wp = whirlpool.new() + self.assertEqual(wp.block_size, 64) + with self.assertRaisesRegexp(AttributeError, + 'block_size.*not writable'): + wp.block_size = 32 + + +if __name__ == '__main__': + unittest.main() diff --git a/dev-python/whirlpool/metadata.xml b/dev-python/whirlpool/metadata.xml new file mode 100644 index 000000000000..6c90e346eb69 --- /dev/null +++ b/dev-python/whirlpool/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <herd>python</herd> + <maintainer> + <email>jlec@gentoo.org</email> + </maintainer> +</pkgmetadata> diff --git a/dev-python/whirlpool/whirlpool-0.3.ebuild b/dev-python/whirlpool/whirlpool-0.3.ebuild new file mode 100644 index 000000000000..56963b4a8d3a --- /dev/null +++ b/dev-python/whirlpool/whirlpool-0.3.ebuild @@ -0,0 +1,31 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-python/whirlpool/whirlpool-0.3.ebuild,v 1.1 2013/06/03 19:49:24 jlec Exp $ + +EAPI=5 + +PYTHON_COMPAT=( python2_7 ) + +inherit distutils-r1 + +MY_PN="Whirlpool" +MY_P="${MY_PN}-${PV}" + +DESCRIPTION="Bindings for whirlpool hash reference implementation" +HOMEPAGE="https://pypi.python.org/pypi/Whirlpool https://github.com/radiosilence/python-whirlpool" +SRC_URI="mirror://pypi/${MY_PN:0:1}/${MY_PN}/${MY_P}.tar.gz" + +SLOT="0" +LICENSE="public-domain" +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux" +IUSE="test" + +RDEPEND="" +DEPEND="${RDEPEND} + test? ( virtual/python-unittest2[${PYTHON_USEDEP}] )" + +S="${WORKDIR}"/${MY_P} + +python_test() { + ${PYTHON} "${FILESDIR}"/tests.py || die +} |