added crypto-js for http instance
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Successful in 11s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Successful in 13s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Successful in 11s

This commit is contained in:
wt committed 2025-09-01 15:21:34 +07:00
1 parent c1839acbd2
commit 8d6c5132b4
4 files changed
+13 -8

No files matched your search

+9 -6
View File
@@ -1,8 +1,11 @@
const hashPassword = async (password) => {
const encoder = new TextEncoder()
const data = encoder.encode(password)
const hashBuffer = await crypto.subtle.digest('SHA-256', data)
const hashArray = Array.from(new Uint8Array(hashBuffer))
const hashHex = hashArray.map(b=>('00' + b.toString(16)).slice(-2)).join('')
return hashHex
if (crypto && crypto.subtle) {
const encoder = new TextEncoder()
const data = encoder.encode(password)
const hashBuffer = await crypto.subtle.digest('SHA-256', data)
const hashArray = Array.from(new Uint8Array(hashBuffer))
const hashHex = hashArray.map(b=>('00' + b.toString(16)).slice(-2)).join('')
return hashHex
}
return CryptoJS.SHA256(password).toString()
}