AGENT SKILL

Hash Toolkit

Content hashing for deduplication with MD5, SHA256, and perceptual hashing

License 许可
MIT
最近更新
2026-06-07
Stars
★ 0
Forks
1

01 前言 Front Matter

id
hash-toolkit
name
Hash Toolkit
tags
[ "hashing", "deduplication", "md5", "sha256" ]
author
NeoClaw Team
version
1.0.0
category
utility
description
Content hashing for deduplication with MD5, SHA256, and perceptual hashing
dependencies
[]

03 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 < 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
}

04 同仓库更多 Skills

javimosch
javimosch/open-claw-skills

crowd-prompting

A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.

★ 0
javimosch
javimosch/open-claw-skills

ceaser

Interact with the Ceaser privacy protocol on Base L2 using the ceaser-mcp MCP tools. This skill uses the ceaser-mcp npm package for ALL operations -- shield, unshield, note management, and protocol queries. All ceaser tool calls use CLI subcommands (npx -y ceaser-mcp <subcommand>). Ceaser is a privacy-preserving ETH wrapper using Noir/UltraHonk zero-knowledge proofs on Base L2 (chain ID 8453).

★ 0
javimosch
javimosch/open-claw-skills

ceaser-send

Fully automated private ETH transfer via Ceaser Protocol on Base L2 using the ceaser-mcp MCP tools. This skill uses the ceaser-mcp npm package for ALL operations -- all ceaser tool calls use CLI subcommands (npx -y ceaser-mcp <subcommand>). WARNING -- creates observable on-chain links between user wallet and hot wallet (see Privacy Warning). Generates an ephemeral hot wallet with BIP-39 mnemonic recovery, user funds it, agent signs and broadcasts the Shield TX automatically. Exactly one manual step required (funding the hot wallet with ETH). Uses Noir/UltraHonk zero-knowledge proofs.

★ 0
javimosch
javimosch/open-claw-skills

dilemm-ai

Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).

★ 0
javimosch
javimosch/open-claw-skills

moldium

Post and manage content on the Moldium blog platform. Triggered by "post to Moldium", "write a blog post", "publish an article", etc.

★ 0
javimosch
javimosch/open-claw-skills

arxiv-paper-reviews

Interact with arXiv Crawler API to fetch papers, read reviews, submit comments, search papers, and import papers. Use when working with arXiv papers, fetching paper lists by date/category/interest, viewing paper details with comments, submitting paper reviews, searching papers by title, or importing papers from arXiv URLs via API at http://weakaccept.top:8000/.

★ 0