diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
commit | 4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch) | |
tree | ba5f07bf3f9d22d82e54a462313f5d244036c768 /dev-python/whirlpool |
reinit the tree, so we can have metadata
Diffstat (limited to 'dev-python/whirlpool')
-rw-r--r-- | dev-python/whirlpool/Manifest | 6 | ||||
-rw-r--r-- | dev-python/whirlpool/files/tests.py | 96 | ||||
-rw-r--r-- | dev-python/whirlpool/metadata.xml | 12 | ||||
-rw-r--r-- | dev-python/whirlpool/whirlpool-0.3-r1.ebuild | 37 |
4 files changed, 151 insertions, 0 deletions
diff --git a/dev-python/whirlpool/Manifest b/dev-python/whirlpool/Manifest new file mode 100644 index 000000000000..db683bcd3819 --- /dev/null +++ b/dev-python/whirlpool/Manifest @@ -0,0 +1,6 @@ +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-r1.ebuild 823 SHA256 efa06abb516849cd91a005e72ca62939765a3154fadf926e26d3b32e1ddb96dd SHA512 9bab8b90f0b55079b88aac21ba9f9699977096209c2a04db83df7b998fdf59901a1dc87dfce78bd742a34dc48cde8394130987f9dcbdb1acc99c1b73fc0e226e WHIRLPOOL 7b7f731c5c66eb2dc31fcb33f2d87362aa588a6373512f423ad64a45424eb9db7cffd1b18f8680417a4002c46652f8e77c1ff490bc58913dac0de3ab956bf483 +MISC ChangeLog 2594 SHA256 7ea98957024b32b851aff41770ab43c9242df8653d731b4f6ab4aba0660a3819 SHA512 bde120861fd77669ef9cf37713873fcb5db9f0645b23073d4b1445680750d59b22cbc2df805a34f4a2389c33611ea888e1f288b615aae8cf6210c54137bf2db3 WHIRLPOOL 2fff0ab4e8e33bfbe88bf0df5dce8d805f2813fac95973ddb49061f967b06e724a07cecc6dc57d2c54d60220e19344e59cdde03d1c749e05fe04ee98cb25fcc0 +MISC ChangeLog-2015 1059 SHA256 5f76c1e33dbe9d8402d4b65f0822de71fa7dc15b0bf292221c793320106c094b SHA512 2eb76e23ea9a8ee63f602125e41d5aa557d5b3dc274380abb68113541fd3b3c8b3099af71c485393ef675b51082c62d22671a1062f3c49a9533b2c778d8b2f86 WHIRLPOOL 71bfbf3438b1cd0593e8c4c5f47fd0e50f69ed0eff842a019cc6179a8fd18f6f269a1db67a8d26691fe83b04e12df7eba74a15077275acd9ec3ccc916e491531 +MISC metadata.xml 393 SHA256 c9d25b104979bce792a8c0751cf8eeb0597358ec73f5461cfe856bcf252a415a SHA512 000576de3ac4f057e226b3ee265bb2a6709140df133f992e2d3d6d00d9507b32addd36bcfd6a70793244f085ae258539e37a16b0428d4f9c7f9c657a1e6de4dc WHIRLPOOL 578556ed1d861637a53e16b9cbb309331c7fe702d683c209770b04a24c273d766d546ed6e2605bd4f13668afb59c25c9515ae7e1e1d2e9a7e357dc9e1616cac3 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..1e7c21380a07 --- /dev/null +++ b/dev-python/whirlpool/metadata.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>python@gentoo.org</email> + <name>Python</name> + </maintainer> + <upstream> + <remote-id type="pypi">Whirlpool</remote-id> + <remote-id type="github">radiosilence/python-whirlpool</remote-id> + </upstream> +</pkgmetadata> diff --git a/dev-python/whirlpool/whirlpool-0.3-r1.ebuild b/dev-python/whirlpool/whirlpool-0.3-r1.ebuild new file mode 100644 index 000000000000..75d9969db99b --- /dev/null +++ b/dev-python/whirlpool/whirlpool-0.3-r1.ebuild @@ -0,0 +1,37 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +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} + dev-python/setuptools[${PYTHON_USEDEP}]" + +S="${WORKDIR}"/${MY_P} + +python_prepare_all() { + sed \ + -e "/data_files/s:whirlpool:share/whirlpool:g" \ + -i setup.py || die + distutils-r1_python_prepare_all +} + +python_test() { + ${PYTHON} "${FILESDIR}"/tests.py || die +} |