JavaScript:实现加密哈希SHA-1 算法(附完整源码)

苏鸿志
2023-12-01


// main variables
const CHAR_SIZE = 8

/**
 * Adds padding to binary/hex string representation
 *
 * @param {string} str - string representation (binary/hex)
 * @param {int} bits - total number of bits wanted
 * @return {string} - string representation padding with empty (0) bits
 *
 * @example
 *      pad("10011", 8); // "00010011"
 */
function pad (str, bits) {
   
 类似资料: