Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/theme-particlex/hexo-helper-crypto
A Hexo helper for encryption and decryption using Crypto-js.
https://github.com/theme-particlex/hexo-helper-crypto
crypto-js encryption-decryption helper hexo hexo-plugin
Last synced: 2 days ago
JSON representation
A Hexo helper for encryption and decryption using Crypto-js.
- Host: GitHub
- URL: https://github.com/theme-particlex/hexo-helper-crypto
- Owner: theme-particlex
- License: mit
- Created: 2022-12-08T08:20:00.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-08-20T16:21:02.000Z (3 months ago)
- Last Synced: 2024-11-09T17:15:43.862Z (7 days ago)
- Topics: crypto-js, encryption-decryption, helper, hexo, hexo-plugin
- Language: JavaScript
- Homepage:
- Size: 30.3 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hexo-Helper-Crypto
[Hexo-Helper-Crypto](https://github.com/theme-particlex/hexo-helper-crypto) 插件,用于在模板文件内加/解密数据,使用 [CryptoJS](https://github.com/brix/crypto-js)。
# 1. 安装
```bash
pnpm add hexo-helper-crypto
```# 2. 使用
在模板文件(以下使用 EJS 模板引擎)中,添加:
```ejs
<% const CryptoJS = getCryptoJS(); %>
```然后可以直接使用 `CryptoJS`,和 [CryptoJS](https://github.com/brix/crypto-js) 接口一样。
以下例子获取了页面标题的 SHA256 值,并用 Base64 编码。
```ejs
<% const CryptoJS = getCryptoJS(); %>
<%= CryptoJS.SHA256(page.title).toString(CryptoJS.enc.Base64) %>
```