UNPKG

encryptionhahaha

Version:

`encryptionhahaha` 是一个趣味文本加密/解密工具,通过填充词和随机候选词组增加了加密的随机性,加解密过程完全可逆。

69 lines (51 loc) 1.56 kB
# 简介 `encryptionhahaha` 是一个趣味文本加密/解密工具,通过填充词和随机候选词组增加了加密的随机性,加解密过程完全可逆。 # 安装 ``` npm install encryptionhahaha ``` # 使用 ## 默认候选词组映射 `encryptionhahaha` 默认提供的候选词组是“佛曰”版本,你可以直接使用。 ``` import {encrypt, decrypt} from 'encryptionhahaha'; const text = "雷猴"; // 原文 const encryptedText = encrypt(text); // 加密 const decryptedText = decrypt(encryptedText); // 解密 // 打印 console.log("原文:", text); console.log("加密后:", encryptedText); console.log("解密后:", decryptedText); ``` ## 自定义候选词组映射 如果你想使用自己的候选词组映射,你可以这样做: ``` import {encrypt, decrypt} from 'encryptionhahaha'; const candidateMapping = { "0": ["喵", "咪"], "1": ["嗷", "呜"], "2": ["喔", "咕"], "3": ["哈", "哇"], "4": ["嘤", "呦"], "5": ["嗯", "嘛"], "6": ["嗨", "嘿"], "7": ["啊", "呀"], "8": ["嘻", "嘟"], "9": ["咩", "嗝"], "a": ["哼", "嘎"], "b": ["嘭", "噗"], "c": ["咻", "嗡"], "d": ["嗒", "哒"], "e": ["咔", "啪"], "f": ["嘶", "咝"] } const prefix = "喵:"; const text = "雷猴"; const encryptedText = encrypt(text, prefix, candidateMapping); const decryptedText = decrypt(encryptedText, prefix, candidateMapping); console.log("原文:", text); console.log("加密后:", encryptedText); console.log("解密后:", decryptedText); ``` # 许可证 MIT