electron11/background/service/argon2.js
2025-08-25 23:42:31 +08:00

23 lines
491 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const argon2 = require('argon2');
// argon2Test方法接收一个字符串返回其argon2哈希值
async function argon2Test(inputString) {
try {
// 使用默认配置生成argon2哈希
const hash = await argon2.hash(inputString);
return {
success: true,
hash: hash
};
} catch (error) {
console.error('argon2哈希计算失败:', error);
return {
success: false,
error: error.message
};
}
}
module.exports = {
argon2Test
};