Updated files related to copyparty's argon2
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user