Package: hks-pylib
hks_pylibA Python 3 utility library ofhuykingsofm. It has some modules, including:logger: A module is used to print notifications to the console screen or write logs to file. It is special because you can disable the print/write statement by modifying a few parameters without commenting or deleting them manually.cryptography: A wrapper crypto module bases on and is followed by the implementation style ofcryptography. It is easier to use than the original one and fits many procedures in our projects.done: A module defines a class (Done) for returning complex values more conveniently.http: A module is used to parse or generate raw HTTP packets.math: A module implements some no-builtin mathematic operations.hksenum: A wrapper module ofEnumis more convenient than the original.files: A file processing module.How to buildOur library is only supported by Python>=3.7.1. Now we test it only on Python 3.7.1. If you meet any problems, even if with other versions, you couldcreate an issueto notify us. We will solve them as quickly as possible.Create Virtual Environment (optional but IMPORTANT)If you had your virtual environment, you can ignore this step.You ought to create a virtual environment to avoid conflicting with other applications on your machine when installing our module. The virtual environment must be installed withPython 3.I highly recommend you to useAnacondabecause of its utilities. The command of creating a virtual environment in Anaconda is:$condacreate-nyour_venv_namepython=3.7.1
$condaactivateyour_venv_name(your_venv_name)$_Or usePython venv:$python-mvenvpath/to/your/venv
$path/to/your/venv/Scripts/activate.bat(your_venv_name)$_Method 1: Install the stablest version (PyPI)(your_venv_name)$pipinstallhks_pylibMethod 2: Install the newest version (Github)(your_venv_name)$gitclonehttps://github.com/huykingsofm/hks_pylib.git(your_venv_name)$cdhks_pylib(your_venv_name)hks_pylib$pipinstall-e.How to useJust useimportstatement and enjoy it. We will write documentation and tutorials as soon as possible so that you can understand our library easier.# A Done object can be used to substitute# complex return valuesfromhks_pylib.doneimportDone# Example: return Done(True, reason="OK")# A class is used to print/write# logs to console/filefromhks_pylib.loggerimportStandardLogger# A class is used to generate StandardLogger objects.# You should use this class instead of# using StandardLogger directlyfromhks_pylib.loggerimportStandardLoggerGenerator# You may use our console_output instead of print builtin function# in a multithread programfromhks_pylib.loggerimportacprintacprint("Something")# Some common ciphersfromhks_pylib.cipherimportNoCipher,AES_CBC,HybridCipher# You can parse or generate raw HTTP packets with these classfromhks_pylib.httpimportHTTPParser,HTTPPacket# You can encrypt or decrypt your data with our cryptography modulefromhks_pylib.cryptography.ciphers.symmetricsimportAES_CTR,AES_CBCfromhks_pylib.cryptography.ciphers.asymmetricsimportRSAKey,RSACipher# or hash functionsfromhks_pylib.cryptography.hashesimportSHA1,SHA256# or Diffie Hellmanfromhks_pylib.cryptography.protocolsimportDiffieHellmanExchangeChange logVersion 0.0.7 -- 0.0.8Fix the error ofInvisibleLogger.Fixreset()inAES_CTRandAES_CBC.Fixsave...()andload...()inRSAKey.Add theacprint(.)for avoid conflicting print.Add@as_objectdecorator.AddMD5tohashes.AddKeyGeneratortociphers.Version 0.0.6Change .gitignore to template of Python.Change thehttpstyle.Change theloggertoHKSEnumstyle.AddInvisibleLoggerGenerator,InvisibleLoggerfor more convenient.Add some utility methods toHKSEnumandDone.Change many error types and replace some errors tohkserror.Version 0.0.5Change allmost all generic exceptions to highly identified exceptions (in modules ofhks_pylib.errors).Add theOutputclass tohks_pylib.logger.config. Now logger can easily avoid conflicting in printing.Add a wrapper modulehks_pylib.hksenumof builtin python classEnum. Change many constants toHKSEnumtype.Divide modulehks_pylib.cryptography.ciphersinto multiple submodules and move them to foldercryptography/ciphers/.Divide modulehks_pylib.loggerinto multiple submodules and move them to folderlogger/.Removerequirements.txt.AddBitwiseoperator tomath.Addbatchcryptmodule tohks_pylib.cryptography.Add an example ofbatchcryptin folderexamples/.