一、对HASHsha这个小工具进行了优化:

1、增加csv格式的导出方式;
2、舍弃臃肿的pandas,改换 import csv 和 import xlsxwriter。
第一点,可以从界面和导出文件看到:
HASHsha-simplify - 图1
HASHsha-simplify - 图2
第二点,可以从文件夹属性看到:
HASHsha-simplify - 图3

二、下面是部分代码:

1.用到的包或模块:

  1. import binascii
  2. from tkinter import *
  3. from tkinter import messagebox
  4. import os
  5. import xlsxwriter
  6. import hashlib
  7. import datetime
  8. import tkinter.ttk
  9. import csv

2.读取的16进制转化HASH值:

  1. sha224 = hashlib.sha224(xxxx.encode('utf8'))

3.Excel写入:

  1. time0 = datetime.datetime.now().timestamp()
  2. filename = "HASH(" + str(time0) + ").xlsx"
  3. workbook = xlsxwriter.Workbook(varF_2.get() + "/" + filename)
  4. worksheet = workbook.add_worksheet()
  5. worksheet.set_column('A:B', 57)
  6. worksheet.write_column('A1',listC)
  7. worksheet.write_column('B1',listD)
  8. workbook.close()

4.csv写入:

  1. rows = zip(listC, listD)
  2. print("list结果:", listC, listD)
  3. time0 = datetime.datetime.now().timestamp()
  4. filename = "HASH(" + str(time0) + ").cvs"
  5. with open(varF_2.get() + "/" + filename, "w") as f:
  6. writer = csv.writer(f)
  7. for row in rows:
  8. writer.writerow(row)

5.弹出通知:

  1. messagebox.showinfo("通知(Tips)", "完成(Run complete)")

三、程序包:

https://prodbb45198-pic10.ysjianzhan.cn/upload/HASHsha-simplify.rar