Updated hashcat.wasm, fixed borked formatting
This commit is contained in:
parent
b4298dbdbb
commit
fb6ed88584
|
@ -68,106 +68,106 @@ function WASMComplete() {
|
||||||
}
|
}
|
||||||
|
|
||||||
signupButton.addEventListener("click", () => {
|
signupButton.addEventListener("click", () => {
|
||||||
let username = usernameBox.value
|
let username = usernameBox.value
|
||||||
let password = passwordBox.value
|
let password = passwordBox.value
|
||||||
|
|
||||||
if (username === "") {
|
if (username === "") {
|
||||||
statusBox.innerText = "Username required!"
|
statusBox.innerText = "Username required!"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if ((username).length > 20) {
|
||||||
|
statusBox.innerText = "Username cannot be more than 20 characters!"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (password === "") {
|
||||||
|
statusBox.innerText = "Password required!"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if ((password).length < 8) {
|
||||||
|
statusBox.innerText = "Password must be at least 8 characters!"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
showElements(false)
|
||||||
|
statusBox.innerText = "Computing PoW Challenge... (this may take up to 5 minutes at worst, 3 seconds at best)"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compiled version of:
|
||||||
|
* hashcat-wasm (https://concord.hectabit.org/hectabit/hashcat-wasm)
|
||||||
|
* (c) Arzumify
|
||||||
|
* @license AGPL-3.0
|
||||||
|
* Since this is my software, if you use it with proprietary servers, I will make sure you will walk across hot coals (just kidding, probably).
|
||||||
|
* I'm not kidding about the license though.
|
||||||
|
* I should stop including comments into JS and possibly minify this code. Oh, well.
|
||||||
|
*/
|
||||||
|
|
||||||
|
window.resourceExtra = "I love Burgernotes!"
|
||||||
|
const go = new Go();
|
||||||
|
WebAssembly.instantiateStreaming(fetch("/static/wasm/hashcat.wasm"), go.importObject).then((result) => {
|
||||||
|
go.run(result.instance);
|
||||||
|
})
|
||||||
|
|
||||||
|
window.addEventListener("completed", async () => {
|
||||||
|
if (window.returnCode === 1) {
|
||||||
|
statusBox.innerText = "Please do not expose your computer to cosmic rays (an impossible logical event has occurred)."
|
||||||
|
showElements(true)
|
||||||
return
|
return
|
||||||
}
|
} else if (window.returnCode === 2) {
|
||||||
if ((username).length > 20) {
|
statusBox.innerText = "The PoW Challenge has failed. Please try again."
|
||||||
statusBox.innerText = "Username cannot be more than 20 characters!"
|
showElements(true)
|
||||||
return
|
|
||||||
}
|
|
||||||
if (password === "") {
|
|
||||||
statusBox.innerText = "Password required!"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if ((password).length < 8) {
|
|
||||||
statusBox.innerText = "Password must be at least 8 characters!"
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
showElements(false)
|
statusBox.innerText = "Hashing password..."
|
||||||
statusBox.innerText = "Computing PoW Challenge... (this may take up to 5 minutes at worst, 3 seconds at best)"
|
let hashedPassword = await hashpass(password)
|
||||||
|
statusBox.innerText = "Contacting server..."
|
||||||
/*
|
fetch(remote + "/api/signup", {
|
||||||
* Compiled version of:
|
method: "POST",
|
||||||
* hashcat-wasm (https://concord.hectabit.org/hectabit/hashcat-wasm)
|
body: JSON.stringify({
|
||||||
* (c) Arzumify
|
username: username,
|
||||||
* @license AGPL-3.0
|
password: hashedPassword,
|
||||||
* Since this is my software, if you use it with proprietary servers, I will make sure you will walk across hot coals (just kidding, probably).
|
stamp: window.returnVar,
|
||||||
* I'm not kidding about the license though.
|
}),
|
||||||
* I should stop including comments into JS and possibly minify this code. Oh, well.
|
headers: {
|
||||||
*/
|
"Content-Type": "application/json; charset=UTF-8",
|
||||||
|
|
||||||
const go = new Go();
|
|
||||||
WebAssembly.instantiateStreaming(fetch("/static/wasm/hashcat.wasm"), go.importObject).then((result) => {
|
|
||||||
go.run(result.instance);
|
|
||||||
})
|
|
||||||
|
|
||||||
window.addEventListener("completed", async () => {
|
|
||||||
if (window.returnCode === 1) {
|
|
||||||
statusBox.innerText = "Please do not expose your computer to cosmic rays (an impossible logical event has occurred)."
|
|
||||||
showElements(true)
|
|
||||||
return
|
|
||||||
} else if (window.returnCode === 2) {
|
|
||||||
statusBox.innerText = "The PoW Challenge has failed. Please try again."
|
|
||||||
showElements(true)
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
statusBox.innerText = "Hashing password..."
|
.then((response) => response)
|
||||||
let hashedPassword = await hashpass(password)
|
.then(async (response) => {
|
||||||
statusBox.innerText = "Contacting server..."
|
let responseData = await response.json()
|
||||||
fetch(remote + "/api/signup", {
|
if (response.status === 200) {
|
||||||
method: "POST",
|
statusBox.innerText = "Setting up encryption keys..."
|
||||||
body: JSON.stringify({
|
localStorage.setItem("DONOTSHARE-secretkey", responseData["key"])
|
||||||
username: username,
|
localStorage.setItem("DONOTSHARE-password", await hashwasm.argon2id({
|
||||||
password: hashedPassword,
|
password: password,
|
||||||
stamp: window.returnVar,
|
salt: new TextEncoder().encode("I love Burgernotes!"),
|
||||||
}),
|
parallelism: 1,
|
||||||
headers: {
|
iterations: 32,
|
||||||
"Content-Type": "application/json; charset=UTF-8",
|
memorySize: 19264,
|
||||||
|
hashLength: 32,
|
||||||
|
outputType: "hex"
|
||||||
|
}))
|
||||||
|
statusBox.innerText = "Welcome!"
|
||||||
|
await new Promise(r => setTimeout(r, 200))
|
||||||
|
window.location.href = "/app/"
|
||||||
|
} else if (response.status === 409) {
|
||||||
|
statusBox.innerText = "Username already taken!"
|
||||||
|
showElements(true)
|
||||||
|
} else if (response.status === 429) {
|
||||||
|
statusBox.innerText = "Please don't sign up to new accounts that quickly. If you are using a VPN, please turn it off!"
|
||||||
|
showElements(true)
|
||||||
|
} else if (response.status === 409) {
|
||||||
|
statusBox.innerText = "Pure bad luck... your PoW challenge was accepted, but someone else used the same PoW challenge as you. Please try again. (error: " + responseData["error"] + ")"
|
||||||
|
showElements(true)
|
||||||
|
} else if (response.status === 500) {
|
||||||
|
statusBox.innerText = responseData["error"]
|
||||||
|
showElements(true)
|
||||||
|
} else {
|
||||||
|
statusBox.innerText = "Something went wrong! (error: " + responseData["error"] + ")"
|
||||||
|
showElements(true)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then((response) => response)
|
})
|
||||||
.then(async (response) => {
|
|
||||||
let responseData = await response.json()
|
|
||||||
|
|
||||||
if (response.status === 200) {
|
|
||||||
statusBox.innerText = "Setting up encryption keys..."
|
|
||||||
localStorage.setItem("DONOTSHARE-secretkey", responseData["key"])
|
|
||||||
localStorage.setItem("DONOTSHARE-password", await hashwasm.argon2id({
|
|
||||||
password: password,
|
|
||||||
salt: new TextEncoder().encode("I love Burgernotes!"),
|
|
||||||
parallelism: 1,
|
|
||||||
iterations: 32,
|
|
||||||
memorySize: 19264,
|
|
||||||
hashLength: 32,
|
|
||||||
outputType: "hex"
|
|
||||||
}))
|
|
||||||
statusBox.innerText = "Welcome!"
|
|
||||||
await new Promise(r => setTimeout(r, 200))
|
|
||||||
window.location.href = "/app/"
|
|
||||||
} else if (response.status === 409) {
|
|
||||||
statusBox.innerText = "Username already taken!"
|
|
||||||
showElements(true)
|
|
||||||
} else if (response.status === 429) {
|
|
||||||
statusBox.innerText = "Please don't sign up to new accounts that quickly. If you are using a VPN, please turn it off!"
|
|
||||||
showElements(true)
|
|
||||||
} else if (response.status === 409) {
|
|
||||||
statusBox.innerText = "Pure bad luck... your PoW challenge was accepted, but someone else used the same PoW challenge as you. Please try again. (error: " + responseData["error"] + ")"
|
|
||||||
showElements(true)
|
|
||||||
} else if (response.status === 500) {
|
|
||||||
statusBox.innerText = responseData["error"]
|
|
||||||
showElements(true)
|
|
||||||
} else {
|
|
||||||
statusBox.innerText = "Something went wrong! (error: " + responseData["error"] + ")"
|
|
||||||
showElements(true)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// @license-end
|
// @license-end
|
||||||
|
|
Binary file not shown.
Reference in New Issue