← 返回 Skills 市场
raghulpasupathi

Hash Toolkit

作者 raghulpasupathi · GitHub ↗ · v1.0.0
cross-platform ✓ 安全检测通过
642
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install hash-toolkit
功能描述
Content hashing for deduplication with MD5, SHA256, and perceptual hashing
使用说明 (SKILL.md)

Hash Toolkit

Multi-algorithm hashing for content deduplication and verification.

Implementation

const crypto = require('crypto');

/**
 * Generate hash using specified algorithm
 * @param {string|Buffer} content - Content to hash
 * @param {string} algorithm - Hash algorithm
 * @returns {string} Hash string
 */
function generateHash(content, algorithm = 'sha256') {
  const hash = crypto.createHash(algorithm);
  hash.update(Buffer.isBuffer(content) ? content : String(content));
  return hash.digest('hex');
}

/**
 * Generate multiple hashes at once
 */
function generateMultipleHashes(content) {
  return {
    md5: generateHash(content, 'md5'),
    sha1: generateHash(content, 'sha1'),
    sha256: generateHash(content, 'sha256'),
    sha512: generateHash(content, 'sha512').substring(0, 32) // Truncated
  };
}

/**
 * Generate perceptual hash (for images/content similarity)
 * Simplified implementation
 */
function generatePerceptualHash(content) {
  // Simplified perceptual hash
  // In production: use actual perceptual hashing algorithm
  const normalized = String(content).toLowerCase().replace(/\s+/g, ' ');
  return generateHash(normalized, 'sha256').substring(0, 16);
}

/**
 * Check if content is duplicate based on hash
 */
function checkDuplicate(contentHash, knownHashes) {
  return {
    isDuplicate: knownHashes.has(contentHash),
    hash: contentHash,
    algorithm: 'sha256'
  };
}

/**
 * Calculate similarity between two hashes
 * (for perceptual hashes)
 */
function calculateHashSimilarity(hash1, hash2) {
  if (hash1.length !== hash2.length) return 0;

  let matches = 0;
  for (let i = 0; i \x3C hash1.length; i++) {
    if (hash1[i] === hash2[i]) matches++;
  }

  return matches / hash1.length;
}

// Export for OpenClaw
module.exports = {
  generateHash,
  generateMultipleHashes,
  generatePerceptualHash,
  checkDuplicate,
  calculateHashSimilarity
};

Usage

// Generate SHA256 hash
const hash = skills.hashToolkit.generateHash(content, 'sha256');

// Generate multiple hashes
const hashes = skills.hashToolkit.generateMultipleHashes(content);
console.log(hashes.md5, hashes.sha256);

// Check for duplicates
const knownHashes = new Set(['abc123...']);
const result = skills.hashToolkit.checkDuplicate(hash, knownHashes);
if (result.isDuplicate) {
  console.log('Duplicate content detected');
}

// Perceptual hash for similarity
const phash = skills.hashToolkit.generatePerceptualHash(imageData);

Configuration

{
  "defaultAlgorithm": "sha256",
  "enablePerceptual": true
}
安全使用建议
This skill appears to do what it says: local hashing and simple deduplication helpers. It does not request credentials or install software. Before using in production, note these caveats: MD5 and SHA-1 are cryptographically weak — avoid them for security-sensitive integrity or auth; the sha512 result is truncated which reduces entropy and could cause more collisions; the perceptual-hash implementation is only a placeholder and is not suitable for image-similarity detection — use a dedicated pHash/dHash/aHash library; similarity comparison operates on hex characters rather than bit-level Hamming distance. If you need cryptographic guarantees or reliable perceptual matching, replace the placeholder methods with vetted libraries and test on representative data.
功能分析
Type: OpenClaw Skill Name: hash-toolkit Version: 1.0.0 The skill bundle provides standard hashing functionalities (MD5, SHA256, etc.) using Node.js's built-in `crypto` module. The code strictly adheres to its stated purpose, performing only cryptographic hashing and comparisons. There are no file system operations, network calls, environment variable access, or child process executions. The `SKILL.md` content is purely descriptive and lacks any prompt injection attempts or instructions for the AI agent to perform malicious actions. The direct use of the `algorithm` parameter in `crypto.createHash()` is a standard design for a hashing utility and does not present a meaningful security risk within the skill itself.
能力评估
Purpose & Capability
Name and description (content hashing, MD5/SHA256, perceptual hashing) match the SKILL.md content. The examples and exported functions implement hashing and duplicate checks; no unrelated binaries, env vars, or external services are requested.
Instruction Scope
All instructions and code are local and self-contained. However, the perceptual hash is a placeholder (lowercasing and hashing) and will not produce meaningful image perceptual hashes; calculateHashSimilarity compares hex-character equality rather than bitwise Hamming distance. generateMultipleHashes includes weaker algorithms (md5, sha1) and truncates sha512 to 32 hex chars, which may mislead users about strength.
Install Mechanism
Instruction-only skill with no install spec and no external downloads. No code is written to disk by an installer. Low installation risk.
Credentials
No environment variables, credentials, or config paths are requested. The required surface is proportional to the stated purpose.
Persistence & Privilege
Does not request always-on inclusion, does not modify other skills or system settings. Normal agent-invocation defaults apply.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install hash-toolkit
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /hash-toolkit 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of Hash Toolkit (v1.0.0) - Provides content hashing with MD5, SHA1, SHA256, and SHA512 algorithms - Includes simplified perceptual hashing for content similarity detection - Supports checking for duplicate content using hash comparison - Exposes utility functions: generateHash, generateMultipleHashes, generatePerceptualHash, checkDuplicate, and calculateHashSimilarity
元数据
Slug hash-toolkit
版本 1.0.0
许可证
累计安装 1
当前安装数 1
历史版本数 1
常见问题

Hash Toolkit 是什么?

Content hashing for deduplication with MD5, SHA256, and perceptual hashing. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 642 次。

如何安装 Hash Toolkit?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install hash-toolkit」即可一键安装,无需额外配置。

Hash Toolkit 是免费的吗?

是的,Hash Toolkit 完全免费(开源免费),可自由下载、安装和使用。

Hash Toolkit 支持哪些平台?

Hash Toolkit 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Hash Toolkit?

由 raghulpasupathi(@raghulpasupathi)开发并维护,当前版本 v1.0.0。

💬 留言讨论