Updated files related to copyparty's argon2

This commit is contained in:
eriUNK
2026-03-03 17:02:52 -03:00
parent 8338bc3b73
commit ced732876f
4 changed files with 45 additions and 11 deletions

View File

@@ -40,6 +40,13 @@ button:hover {
cursor: pointer;
}
button:disabled {
background: #666666;
color: #aaaaaa;
cursor: not-allowed;
filter: grayscale(1);
}
.row {
display: flex;
gap: 8px

View File

@@ -19,6 +19,25 @@ gensaltBtn.addEventListener('click', async () => {
salt.value = data.salt;
});
const updateUI = () => {
const isCopyparty = algorithm.value === 'argon2_copyparty';
salt.disabled = isCopyparty;
gensaltBtn.disabled = isCopyparty;
if (isCopyparty) {
salt.value = "LVZ1TJMdAIdLyBla6nWDexFt";
salt.style.opacity = "0.5";
} else {
salt.value = "";
salt.style.opacity = "";
}
};
algorithm.addEventListener('change', updateUI);
window.addEventListener('DOMContentLoaded', updateUI);
hashBtn.addEventListener('click', async () => {
const pass = password.value || '';
const s = salt.value || '';
@@ -29,11 +48,14 @@ hashBtn.addEventListener('click', async () => {
return;
}
if (s.length < MIN_SALT_LEN || s.length > MAX_SALT_LEN) {
alert('Salt must be between ' + MIN_SALT_LEN + ' and ' + MAX_SALT_LEN + ' characters');
return;
if (alg !== 'argon2_copyparty') {
if (s.length < MIN_SALT_LEN || s.length > MAX_SALT_LEN) {
alert('Salt must be between ' + MIN_SALT_LEN + ' and ' + MAX_SALT_LEN + ' characters');
return;
}
}
const payload = { password: pass, salt: s, algorithm: alg };
const res = await fetch('/hash', {
method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload)