agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
24 lines (22 loc) • 584 B
JavaScript
/**
* @file Block hash generation
* @description Responsible for generating hashes for code blocks
*/
/**
* Generates a hash for a code block
* @param {string} content - Block content
* @returns {string} Hash string
*/
function generateBlockHash(content) {
// Simple hash function for content comparison
let hash = 0;
for (let i = 0; i < content.length; i++) {
const char = content.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
hash = hash & hash; // Convert to 32-bit integer
}
return hash.toString(36);
}
module.exports = {
generateBlockHash
};