/
dimono39
/
education-analytics
Обзор
Документация
Войти
/
dimono39
/
education-analytics
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
node_modules/http-auth/src/auth/utils.js
43 строки
863 B
dimono39
добавил файлы
08 дек 2025, 15:17
08 дек 2025, 15:17
40ee2bb
Код
Авторство
О чём код?
"use strict"; // Importing crypto module. const crypto = require('crypto'); const utils = {}; // Generates md5 hash of input. utils.md5 = (input) => { let hash = crypto.createHash('MD5'); hash.update(input); return hash.digest('hex'); }; // Generates sha1 hash of input. utils.sha1 = (input) => { let hash = crypto.createHash('sha1'); hash.update(input); return hash.digest('base64'); }; // Encode to base64 string. utils.base64 = (input) => { return new Buffer(input, 'utf8').toString('base64'); }; // Decodes base64 string. utils.decodeBase64 = (input) => { return new Buffer(input, 'base64').toString('utf8'); }; // Check if module is available. utils.isAvailable = (path) => { try { return !!require.resolve(path); } catch (err) { return false; } }; // Export utils. module.exports = utils;