用emoji可视化散列和字节。
hashmoji的Python项目详细描述
hashmoji是一个简单的python 3程序和库,用于将内容哈希可视化为emoji。
关于
hashmoji其实只是一个可执行的笑话。它不是为了安全或满足严重的需求 生意。但这是有趣的阿尔法质量的东西,你可能会喜欢。
安装
确保已安装Python 3。在Mac OS X上,您可以安装 通过自制的python 3:
brew update brew install python3
一旦安装了python 3,就可以克隆这个存储库并安装它:
git clone git@github.com:mcroydon/hashmoji.git cd hashmoji python3 setup.py install
或者如果您有PIP(推荐):
pip3 install hashmoji
您还可以考虑在Virtualenv中安装hashmoji。
命令行用法
Hashmoji同时作为可执行实用程序和Python模块提供,您可以使用它来可视化 hashlib或任何可被4字节整除的字节对象
使用类似sha1sum的hashmoji:
$ hashmoji.py README.rst ? ? ? ??
要查看所有可用选项,请运行hashmoji.py --help:
mattbookpro:hashmoji mcroydon$ python3 hashmoji.py -h Usage: hashmoji.py [options] FILE or no arguments for stdin Options: --version show program's version number and exit -h, --help show this help message and exit -a ALGORITHM, --algorithm=ALGORITHM Use ALGORITHM from hashlib. Choices: ['SHA512', 'sha512', 'sha384', 'ecdsa-with-SHA1', 'SHA256', 'dsaEncryption', 'SHA384', 'MDC2', 'SHA224', 'RIPEMD160', 'dsaWithSHA', 'MD4', 'sha', 'MD5', 'sha224', 'md4', 'md5', 'sha1', 'sha256', 'mdc2', 'DSA-SHA', 'ripemd160', 'DSA', 'SHA1', 'SHA'] -n, --no-hash Treat the content as binary data divisible by 4 bytes suitable for conversion to emoji Format Options: -t, --text Read the file in text mode (default). -b, --binary Read the file in binary mode. -x, --hex Read the file as hexidecimal encoded binary data, such as a hexdigest. Implies --no-hash. -e ENCODING, --encoding=ENCODING Encoding to be used for text. (default is utf-8)
您可以使用基于hashlib可用算法的特定哈希算法:
$ hashmoji.py -a sha512 README.rst ? ? ? ? ?? ? ? ? ? ? ✔ ? ? ? ??
在0.1.2中新增,您还可以省略FILE,并将stdin管道传输到hashmoji。这在与十六进制格式结合时特别有用 用于可视化包含一行十六进制编码数据的程序的输出,例如git或md5 -q:
$ git rev-parse HEAD | hashmoji.py -x ♦ ? ? ??
Hashmoji只在Terminal.app中的macosx10.8和10.9上测试过它在屏幕会话中肯定不起作用。相信我
库使用
hashmoji被设计用于处理bytes对象或hashlib digest:
>>> from hashmoji import hashmoji # Use with hashlib >>> import hashlib >>> hashmoji(hashlib.sha1(b"This is my test string.")) '? ? ? ??' # Use with bytes as long as the bytes are divisible by 4 bytes >>> mybytes = b'\x916\xb8|\x1b\xf7&\xaa\x92(;OQX\x95^w\x1c\xb2\xd6\xbe\xb9_\x8b\xcf\xdcO\xa3\x8f\xcf\xdbq\x89\xd0\nF\xce1\x81\xca\xdd\x15\xf4\xe1\x10\x807\x19\x1b\x0f\xe8\x86\x08\xf7O\x19\xf1\x16\xf3\x93\x97\xfa{\x81' >>> len(mybytes) 64 >>> len(mybytes) % 4 0 >>> hashmoji(mybytes) '? ? ? ? ? ? ? ? ⚡ ? ? ➗ ? ➡ ??'
待办事项
- 有时不要将文件内容加载到内存中。
许可证
Hashmoji是根据3条BSD许可证发布的