diff --git a/src/encrypt.ts b/src/encrypt.ts index 6c6d5ea..097621e 100644 --- a/src/encrypt.ts +++ b/src/encrypt.ts @@ -6,7 +6,7 @@ import { arrayBufferToHex, } from "./misc"; -const DEFAULT_ITER = 10000; +const DEFAULT_ITER = 20000; // base32.stringify(Buffer.from('Salted__')) export const MAGIC_ENCRYPTED_PREFIX_BASE32 = "KNQWY5DFMRPV"; diff --git a/tests/encrypt.test.ts b/tests/encrypt.test.ts index 072e53b..0bdedb1 100644 --- a/tests/encrypt.test.ts +++ b/tests/encrypt.test.ts @@ -60,10 +60,10 @@ describe("Encryption tests", () => { ); // two command returns same result: - // cat ./sometext.txt | openssl enc -p -aes-256-cbc -S 8302F586FAB491EC -pbkdf2 -iter 10000 -base64 -pass pass:somepassword - // openssl enc -p -aes-256-cbc -S 8302F586FAB491EC -pbkdf2 -iter 10000 -base64 -pass pass:somepassword -in ./sometext.txt + // cat ./sometext.txt | openssl enc -p -aes-256-cbc -S 8302F586FAB491EC -pbkdf2 -iter 20000 -base64 -pass pass:somepassword + // openssl enc -p -aes-256-cbc -S 8302F586FAB491EC -pbkdf2 -iter 20000 -base64 -pass pass:somepassword -in ./sometext.txt const opensslBase64Res = - "U2FsdGVkX1+DAvWG+rSR7MSa+yJav1zCE7SSXiBooqwI5Q+LMpIthpk/pXkLj+25"; + "U2FsdGVkX1+DAvWG+rSR7BPXMnlvSSVGMdjsx7kE1CTH+28P+yAZRdDGgFWMGkMd"; // we output base32, so we need some transformation const opensslBase32Res = base64ToBase32(opensslBase64Res); @@ -89,6 +89,8 @@ describe("Encryption tests", () => { await fs.readFileSync(path.join(testFolder, testFileName + ".enc")) ); + // openssl enc -p -aes-256-cbc -S 8302F586FAB491EC -pbkdf2 -iter 20000 -pass pass:somepassword -in mona_lisa/1374px-Mona_Lisa,_by_Leonardo_da_Vinci,_from_C2RMF_retouched.jpg -out mona_lisa/1374px-Mona_Lisa,_by_Leonardo_da_Vinci,_from_C2RMF_retouched.jpg.enc + expect(Buffer.from(enc).equals(Buffer.from(opensslArrBuf))).to.be.true; }); diff --git a/tests/static_assets/mona_lisa/1374px-Mona_Lisa,_by_Leonardo_da_Vinci,_from_C2RMF_retouched.jpg.enc b/tests/static_assets/mona_lisa/1374px-Mona_Lisa,_by_Leonardo_da_Vinci,_from_C2RMF_retouched.jpg.enc index a28a5b7..1728efa 100644 --- a/tests/static_assets/mona_lisa/1374px-Mona_Lisa,_by_Leonardo_da_Vinci,_from_C2RMF_retouched.jpg.enc +++ b/tests/static_assets/mona_lisa/1374px-Mona_Lisa,_by_Leonardo_da_Vinci,_from_C2RMF_retouched.jpg.enc @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cf67abd791f1e230bce57dd47150f262424247cbefb8be16efcd57d13955576a +oid sha256:7687eaf60ed93f754b107dc86a437aa97fad7bedd40432171b08c22cded7b559 size 1141568