diff options
Diffstat (limited to 'python-pycrypto.spec')
| -rw-r--r-- | python-pycrypto.spec | 207 |
1 files changed, 207 insertions, 0 deletions
diff --git a/python-pycrypto.spec b/python-pycrypto.spec new file mode 100644 index 0000000..524798b --- /dev/null +++ b/python-pycrypto.spec @@ -0,0 +1,207 @@ +%global _empty_manifest_terminate_build 0 +Name: python-pycrypto +Version: 2.6.1 +Release: 1 +Summary: Cryptographic modules for Python. +License: Public domain +URL: http://www.pycrypto.org/ +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/60/db/645aa9af249f059cc3a368b118de33889219e0362141e75d4eaf6f80f163/pycrypto-2.6.1.tar.gz +BuildArch: noarch + + +%description +This is a collection of both secure hash functions (such as SHA256 and +RIPEMD160), and various encryption algorithms (AES, DES, RSA, ElGamal, +etc.). The package is structured to make adding new modules easy. +This section is essentially complete, and the software interface will +almost certainly not change in an incompatible way in the future; all +that remains to be done is to fix any bugs that show up. If you +encounter a bug, please report it in the Launchpad bug tracker at + https://launchpad.net/products/pycrypto/+bugs +An example usage of the SHA256 module is: +>>> from Crypto.Hash import SHA256 +>>> hash = SHA256.new() +>>> hash.update('message') +>>> hash.digest() +'\xabS\n\x13\xe4Y\x14\x98+y\xf9\xb7\xe3\xfb\xa9\x94\xcf\xd1\xf3\xfb"\xf7\x1c\xea\x1a\xfb\xf0+F\x0cm\x1d' +An example usage of an encryption algorithm (AES, in this case) is: +>>> from Crypto.Cipher import AES +>>> obj = AES.new('This is a key123', AES.MODE_CBC, 'This is an IV456') +>>> message = "The answer is no" +>>> ciphertext = obj.encrypt(message) +>>> ciphertext +'\xd6\x83\x8dd!VT\x92\xaa`A\x05\xe0\x9b\x8b\xf1' +>>> obj2 = AES.new('This is a key123', AES.MODE_CBC, 'This is an IV456') +>>> obj2.decrypt(ciphertext) +'The answer is no' +One possible application of the modules is writing secure +administration tools. Another application is in writing daemons and +servers. Clients and servers can encrypt the data being exchanged and +mutually authenticate themselves; daemons can encrypt private data for +added security. Python also provides a pleasant framework for +prototyping and experimentation with cryptographic algorithms; thanks +to its arbitrary-length integers, public key algorithms are easily +implemented. +As of PyCrypto 2.1.0, PyCrypto provides an easy-to-use random number +generator: +>>> from Crypto import Random +>>> rndfile = Random.new() +>>> rndfile.read(16) +'\xf7.\x838{\x85\xa0\xd3>#}\xc6\xc2jJU' +A stronger version of Python's standard "random" module is also +provided: +>>> from Crypto.Random import random +>>> random.choice(['dogs', 'cats', 'bears']) +'bears' +Caveat: For the random number generator to work correctly, you must +call Random.atfork() in both the parent and child processes after +using os.fork() + +%package -n python3-pycrypto +Summary: Cryptographic modules for Python. +Provides: python-pycrypto +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-pycrypto +This is a collection of both secure hash functions (such as SHA256 and +RIPEMD160), and various encryption algorithms (AES, DES, RSA, ElGamal, +etc.). The package is structured to make adding new modules easy. +This section is essentially complete, and the software interface will +almost certainly not change in an incompatible way in the future; all +that remains to be done is to fix any bugs that show up. If you +encounter a bug, please report it in the Launchpad bug tracker at + https://launchpad.net/products/pycrypto/+bugs +An example usage of the SHA256 module is: +>>> from Crypto.Hash import SHA256 +>>> hash = SHA256.new() +>>> hash.update('message') +>>> hash.digest() +'\xabS\n\x13\xe4Y\x14\x98+y\xf9\xb7\xe3\xfb\xa9\x94\xcf\xd1\xf3\xfb"\xf7\x1c\xea\x1a\xfb\xf0+F\x0cm\x1d' +An example usage of an encryption algorithm (AES, in this case) is: +>>> from Crypto.Cipher import AES +>>> obj = AES.new('This is a key123', AES.MODE_CBC, 'This is an IV456') +>>> message = "The answer is no" +>>> ciphertext = obj.encrypt(message) +>>> ciphertext +'\xd6\x83\x8dd!VT\x92\xaa`A\x05\xe0\x9b\x8b\xf1' +>>> obj2 = AES.new('This is a key123', AES.MODE_CBC, 'This is an IV456') +>>> obj2.decrypt(ciphertext) +'The answer is no' +One possible application of the modules is writing secure +administration tools. Another application is in writing daemons and +servers. Clients and servers can encrypt the data being exchanged and +mutually authenticate themselves; daemons can encrypt private data for +added security. Python also provides a pleasant framework for +prototyping and experimentation with cryptographic algorithms; thanks +to its arbitrary-length integers, public key algorithms are easily +implemented. +As of PyCrypto 2.1.0, PyCrypto provides an easy-to-use random number +generator: +>>> from Crypto import Random +>>> rndfile = Random.new() +>>> rndfile.read(16) +'\xf7.\x838{\x85\xa0\xd3>#}\xc6\xc2jJU' +A stronger version of Python's standard "random" module is also +provided: +>>> from Crypto.Random import random +>>> random.choice(['dogs', 'cats', 'bears']) +'bears' +Caveat: For the random number generator to work correctly, you must +call Random.atfork() in both the parent and child processes after +using os.fork() + +%package help +Summary: Development documents and examples for pycrypto +Provides: python3-pycrypto-doc +%description help +This is a collection of both secure hash functions (such as SHA256 and +RIPEMD160), and various encryption algorithms (AES, DES, RSA, ElGamal, +etc.). The package is structured to make adding new modules easy. +This section is essentially complete, and the software interface will +almost certainly not change in an incompatible way in the future; all +that remains to be done is to fix any bugs that show up. If you +encounter a bug, please report it in the Launchpad bug tracker at + https://launchpad.net/products/pycrypto/+bugs +An example usage of the SHA256 module is: +>>> from Crypto.Hash import SHA256 +>>> hash = SHA256.new() +>>> hash.update('message') +>>> hash.digest() +'\xabS\n\x13\xe4Y\x14\x98+y\xf9\xb7\xe3\xfb\xa9\x94\xcf\xd1\xf3\xfb"\xf7\x1c\xea\x1a\xfb\xf0+F\x0cm\x1d' +An example usage of an encryption algorithm (AES, in this case) is: +>>> from Crypto.Cipher import AES +>>> obj = AES.new('This is a key123', AES.MODE_CBC, 'This is an IV456') +>>> message = "The answer is no" +>>> ciphertext = obj.encrypt(message) +>>> ciphertext +'\xd6\x83\x8dd!VT\x92\xaa`A\x05\xe0\x9b\x8b\xf1' +>>> obj2 = AES.new('This is a key123', AES.MODE_CBC, 'This is an IV456') +>>> obj2.decrypt(ciphertext) +'The answer is no' +One possible application of the modules is writing secure +administration tools. Another application is in writing daemons and +servers. Clients and servers can encrypt the data being exchanged and +mutually authenticate themselves; daemons can encrypt private data for +added security. Python also provides a pleasant framework for +prototyping and experimentation with cryptographic algorithms; thanks +to its arbitrary-length integers, public key algorithms are easily +implemented. +As of PyCrypto 2.1.0, PyCrypto provides an easy-to-use random number +generator: +>>> from Crypto import Random +>>> rndfile = Random.new() +>>> rndfile.read(16) +'\xf7.\x838{\x85\xa0\xd3>#}\xc6\xc2jJU' +A stronger version of Python's standard "random" module is also +provided: +>>> from Crypto.Random import random +>>> random.choice(['dogs', 'cats', 'bears']) +'bears' +Caveat: For the random number generator to work correctly, you must +call Random.atfork() in both the parent and child processes after +using os.fork() + +%prep +%autosetup -n pycrypto-2.6.1 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-pycrypto -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 2.6.1-1 +- Package Spec generated |
