npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

n8n-nodes-crypttools

v0.1.0

Published

n8n crypto tools for encryption and decryption operations

Readme

n8n-nodes-crypttools

一个强大的 n8n 社区节点,提供全面的加密工具功能,包括加解密、哈希、HMAC、密钥派生和编码/解码等操作。

功能特性

🔐 支持的操作

  • 加密 (Encrypt): 使用多种算法加密数据
  • 解密 (Decrypt): 解密已加密的数据
  • 哈希 (Hash): 生成数据的哈希值
  • HMAC: 生成基于哈希的消息认证码
  • 密钥派生 (Key Derivation): 使用 PBKDF2 或 Scrypt 派生密钥
  • Base64 编码/解码: 转换 Base64 格式数据
  • Hex 编码/解码: 转换十六进制格式数据

🛡️ 支持的加密算法

  • AES: AES-128-CBC, AES-192-CBC, AES-256-CBC, AES-256-GCM
  • ChaCha20: ChaCha20-Poly1305
  • DES: DES-EDE3-CBC (3DES)

🔑 支持的哈希算法

  • MD5: md5
  • SHA: sha1, sha256, sha384, sha512
  • Blake2: blake2b512, blake2s256

📁 支持的输入输出格式

  • UTF-8 字符串: 普通文本
  • Base64: Base64 编码数据
  • Hex: 十六进制编码数据
  • JSON: 自动解析 JSON 格式(仅解密输出)

⚙️ 密钥处理方式

  • 原始密钥 (raw): 直接使用提供的密钥
  • SHA256 哈希: 对密钥进行 SHA256 哈希处理
  • PBKDF2 派生: 使用 PBKDF2 派生密钥

使用示例

AES-256-CBC 加密解密

加密:

Operation: Encrypt
Algorithm: AES-256-CBC
Key: mySecretKey
Input Data: Hello, World!
Key Processing: SHA256 hash
Input Format: UTF-8 string
Output Format: Base64

解密:

Operation: Decrypt
Algorithm: AES-256-CBC
Key: mySecretKey
Input Data: [加密后的Base64数据]
Key Processing: SHA256 hash
Input Format: Base64
Output Format: UTF-8 string

SHA256 哈希

Operation: Hash
Hash Algorithm: sha256
Input Data: Hello, World!
Input Format: UTF-8 string
Output Format: Hex

HMAC 签名

Operation: HMAC
Hash Algorithm: sha256
Key: mySecretKey
Input Data: Hello, World!
Input Format: UTF-8 string
Output Format: Hex

密钥派生

Operation: Key derivation
Key Derivation Method: PBKDF2
Key: password123
Key Length: 32
Iterations: 100000
Output Format: Hex

兼容原有代码

此节点可以完美替代原生 Node.js 中的 crypto 模块功能。例如,原来的这段代码:

const crypto = require('crypto');

class AESCipher {
    constructor(key) {
        const hash = crypto.createHash('sha256');
        hash.update(key);
        this.key = hash.digest();
    }

    encrypt(content, ivKey) {
        ivKey = ivKey ? Buffer.from(ivKey) : crypto.randomBytes(16);
        const cipher = crypto.createCipheriv('aes-256-cbc', this.key, ivKey);
        let encrypted = cipher.update(content);
        encrypted = Buffer.concat([encrypted, cipher.final()]);
        return Buffer.concat([ivKey, encrypted]).toString('base64');
    }

    decrypt(encrypt) {
        const encryptBuffer = Buffer.from(encrypt, 'base64');
        const ivKey = encryptBuffer.slice(0, 16);
        const encrypted = encryptBuffer.slice(16);
        const decipher = crypto.createDecipheriv('aes-256-cbc', this.key, ivKey);
        let decrypted = decipher.update(encrypted);
        decrypted = Buffer.concat([decrypted, decipher.final()]);
        return decrypted.toString();
    }
}

现在可以通过配置 CryptoTools 节点来实现相同的功能:

  • Operation: Encrypt 或 Decrypt
  • Algorithm: AES-256-CBC
  • Key Processing: SHA256 hash
  • Input Format: UTF-8 string
  • Output Format: Base64

安装

  1. 在 n8n 中打开 "Settings" -> "Community Nodes"
  2. 输入包名: n8n-nodes-crypttools
  3. 点击 "Install"

开发

# 克隆仓库
git clone <repository-url>
cd n8n-nodes-crypttools

# 安装依赖
npm install

# 构建项目
npm run build

# 代码检查
npm run lint

# 自动修复lint问题
npm run lintfix

贡献

欢迎提交 Pull Requests 和 Issues!

许可证

MIT License

版本历史

0.1.0

  • 初始版本
  • 支持加密、解密、哈希、HMAC、密钥派生等基本功能
  • 支持多种算法和格式
  • 完整的错误处理和参数验证