Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ async function getTotp(text: string) {
chrome.tabs.sendMessage(id, { action: "secretqr", secret });
} else {
const encryption = new Encryption(cachedPassphrase);
const hash = CryptoJS.MD5(secret).toString();
const hash = CryptoJS.SHA256(secret).toString();
if (
!/^[2-7a-z]+=*$/i.test(secret) &&
/^[0-9a-f]+$/i.test(secret) &&
Expand Down
2 changes: 1 addition & 1 deletion src/components/Popup/AddAccountPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default Vue.extend({
issuer: "",
account: this.newAccount.account,
encrypted: false,
hash: CryptoJS.MD5(this.newAccount.secret).toString(),
hash: CryptoJS.SHA256(this.newAccount.secret).toString(),
secret: this.newAccount.secret,
counter: 0
});
Expand Down
2 changes: 1 addition & 1 deletion src/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export function getEntryDataFromOTPAuthPerLine(importCode: string) {
) {
continue;
} else {
const hash = CryptoJS.MD5(secret).toString();
const hash = CryptoJS.SHA256(secret).toString();
if (
!/^[2-7a-z]+=*$/i.test(secret) &&
/^[0-9a-f]+$/i.test(secret) &&
Expand Down
4 changes: 2 additions & 2 deletions src/models/encryption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class Encryption implements IEncryption {

getDecryptedSecret(entry: { secret: string; hash: string }): string | null {
try {
if (entry.hash === CryptoJS.MD5(entry.secret).toString()) {
if (entry.hash === CryptoJS.SHA256(entry.secret).toString()) {
return entry.secret;
}

Expand All @@ -51,7 +51,7 @@ export class Encryption implements IEncryption {
return null;
}

if (entry.hash === CryptoJS.MD5(decryptedSecret).toString()) {
if (entry.hash === CryptoJS.SHA256(decryptedSecret).toString()) {
return decryptedSecret;
}

Expand Down
4 changes: 2 additions & 2 deletions src/models/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export class EntryStorage {
data[hash].type = OTPType[OTPType.hhex];
}

const _hash = CryptoJS.MD5(data[hash].secret).toString();
const _hash = CryptoJS.SHA256(data[hash].secret).toString();
// not a valid hash
if (!/^[0-9a-f]{32}$/.test(hash)) {
data[_hash] = data[hash];
Expand Down Expand Up @@ -448,7 +448,7 @@ export class EntryStorage {
data.push(entry);

if (entry.secret !== null && !/^[0-9a-f]{32}$/.test(hash)) {
const _hash = CryptoJS.MD5(entry.secret).toString();
const _hash = CryptoJS.SHA256(entry.secret).toString();
if (hash !== _hash) {
console.warn("Invalid hash:", entry);
}
Expand Down