10

一个utools插件——hasids加解密

 2 years ago
source link: https://anhoder.github.io/post/YMhNrwxuT/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

工作中用到了hashids加密算法,开发测试时经常需要对某个ID或hashid进行加密、解密,为了提高效率,周末花了点时间基于otp封装了一个utools插件——hashids

utools是什么就不多说了,这里主要说一下hashids插件的使用。

GitHub地址: https://github.com/anhoder/utools-hashids

添加hashids配置

hashids加解密需要配置salt及最小长度,可以使用以下关键字进去添加配置的步骤:

  • hash-add
  • hash添加配置

进入之后,依次输入名称-salt-最小长度即可保存配置。

如果有多个环境配置,多次添加即可,名称不可重复

hashids加密

hashids加密有两种方式进入,一种是使用关键字:

  • hash-encode
  • hash编码

进入之后,输入你想要加密的ID,列表中会显示你已有配置的加密结果,回车即可复制,如:

另外一种方法是直接在utools的主输入框内输入需要加密的ID,选择hash编码进入,回车即可复制。

  1. 如果你开启了utools的右键超级面板,就更方便了,只需要长按右键你的ID,选择hash编码即可。
  2. 如果你需要删除配置,在进入之后使用control+entercommand+enter即可删除选中的配置项。

hashids解密

解密和加密差不多,就不赘述了,关键字:

  • hash-decode
  • hash解码

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK