Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoalh committed Dec 19, 2024
1 parent 4ca7b57 commit 1410766
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ An ES (JavaScript & TypeScript) module to provide an easier symmetric crypto.
const cryptor = await createSymmetricCryptor("<PassWord123456>!!");
const encrypted = await cryptor.encrypt(data);
console.log(encrypted);
// "lST)L-9$J[MPqk)3Pe1qa(;,i)Wi]"4oD9+OE(Hc"
// "lST)L-9$J[MPqk)3Pe1qa(;,i)Wi]\"4oD9+OE(Hc"
const decrypted = await cryptor.decrypt(encrypted);
console.log(decrypted);
// "qwertyuiop"
Expand Down
44 changes: 21 additions & 23 deletions mod.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,43 @@ Sanctus veniam rebum eleifend magna amet est sanctus no accusam rebum in nisl ea
Sit minim accusam elitr vulputate adipiscing vero consectetuer sea no no consequat facilisis ipsum consetetur. Diam clita ipsum duis sea esse vel sit at erat. Et vel quod velit nonummy dolore eirmod diam erat in sit hendrerit ipsum sea consetetur duis dignissim labore feugiat. Ut stet elitr lorem aliquyam euismod clita sit. Justo vero praesent. Tation ut nonumy et nonumy sit ut euismod consetetur diam sea nonumy aliquyam ea ut ad et velit. Et tempor eirmod nostrud ipsum dolor ullamcorper sanctus rebum et duis ex dolores ipsum possim sanctus sanctus sanctus aliquyam. Lobortis mazim no at dolor gubergren no ullamcorper diam et sit. No clita invidunt et erat kasd ex velit augue sanctus et labore minim molestie sed odio amet eirmod. Iusto tincidunt vero vero eos sed stet justo invidunt adipiscing sit aliquyam nibh at aliquam.
Duo eos accumsan sit tempor vero tempor aliquip accusam no amet qui at nonumy vero nonumy ipsum euismod labore. Ullamcorper clita stet nostrud sadipscing erat diam duis diam gubergren sea sit dolore invidunt sit amet feugiat gubergren dignissim. Et eos accusam justo justo eirmod iriure autem voluptua et sit magna invidunt dolores volutpat. Ipsum et et molestie labore sadipscing vero kasd qui. Est hendrerit aliquam. Elitr nonumy no dolor ut dolore sed dolor in sadipscing. Duis vulputate consequat delenit sadipscing kasd et. Rebum no ut diam dolore ipsum diam dolores kasd et accusam diam invidunt. Imperdiet amet sea. Eirmod dolore et amet vel in sed rebum accusam sanctus dolor ea facilisis tempor accusam sit est nonumy. Ipsum voluptua tempor facilisis et delenit labore. Et consequat molestie diam erat nam accusam et diam lobortis option sea. Autem duo dolore et facilisis.
Et ut diam assum takimata. No sit nonummy dolores praesent ut vel vero consetetur amet justo ea duo. Sanctus ea dolor delenit sanctus. Tempor et sea.
Accusam dolores et eirmod erat sadipscing lorem illum erat commodo vero gubergren. Ipsum facilisis et elit nonumy amet clita nonumy duis eirmod lorem dolores aliquip in sed at. Vero eirmod duo laoreet magna duo consetetur et et takimata. Dolore dignissim erat dolore accumsan stet diam diam gubergren eirmod aliquyam accusam et accusam et nulla et stet. Illum ut quod dolor magna ut elitr elit ullamcorper duis. Erat diam sed hendrerit vero sed ut eos veniam sanctus magna. Ea lorem iriure enim ut suscipit possim labore et volutpat. Placerat qui nisl at ipsum dolor diam dolor accusam. Diam sadipscing diam gubergren vulputate dolor dolore eirmod lorem gubergren blandit duo aliquyam. Rebum consetetur invidunt takimata voluptua et no voluptua aliquyam vel. Vero ut dolores. Feugait erat et. Sanctus dolor takimata lorem et clita sea accusam labore iusto et. Esse eirmod sed facilisis kasd. Diam elitr eos diam.
Nibh et luptatum iriure praesent. Sed aliquyam aliquyam tempor suscipit diam vero diam ad stet consectetuer amet at accusam nisl feugait labore invidunt. Est diam vel nonumy magna eirmod et nonummy sed dolor sit amet duis est amet. In in dolore ipsum amet sanctus ut dolores amet euismod consetetur ea. Sed dolores facilisi illum ullamcorper erat vero diam sed dolore est eum wisi aliquyam diam clita. Eos sed voluptua diam erat magna ipsum accusam sea. Possim lorem duis. Consetetur labore autem lorem et.
Takimata sea takimata est sit kasd et est lorem nibh in est diam. Ipsum vulputate erat amet invidunt justo te ipsum eos ipsum sed dolor. Amet no et diam. Amet ut et gubergren amet ut sed accusam duis et. Iriure kasd amet amet. In dolor sit hendrerit gubergren nulla et sea autem sanctus diam eos. Magna nonummy labore delenit clita lorem vero eirmod et nonumy sadipscing et ipsum elitr vel consetetur nonumy. Praesent eum at lobortis consequat dolor ut sanctus sadipscing sit. Accusam consetetur no velit aliquam et lorem assum in illum sed sea et et aliquip sea quod amet. Dolor zzril ut et sadipscing vero ut id dolore eu veniam velit kasd. Erat lorem sit consequat feugiat tation at sed dolore dolor sea autem in sadipscing dolore sed.`;
const sample2UInt8 = new TextEncoder().encode(sample2String);
Deno.test("String AES-CBC 1", { permissions: "none" }, async () => {
Deno.test("Decrypt String 1", { permissions: "none" }, async () => {
const cryptor = await createSymmetricCryptor("<PassWord123456>!!");
assertEquals((await cryptor.decrypt("lST)L-9$J[MPqk)3Pe1qa(;,i)Wi]\"4oD9+OE(Hc")), sample1String);
});
Deno.test("Full String AES-CBC 1", { permissions: "none" }, async () => {
const cryptor = await createSymmetricCryptor("<PassWord123456>!!");
const encrypted = await cryptor.encrypt(sample1String);
console.log(encrypted);
const decrypted = await cryptor.decrypt(encrypted);
assertEquals(decrypted, sample1String);
});
Deno.test("String AES-CBC 100", { permissions: "none" }, async () => {
Deno.test("Full String AES-CBC 100", { permissions: "none" }, async () => {
const cryptor = await createSymmetricCryptor("<PassWord123456>!!", { times: 100 });
const encrypted = await cryptor.encrypt(sample1String);
console.log(encrypted);
const decrypted = await cryptor.decrypt(encrypted);
assertEquals(decrypted, sample1String);
});
Deno.test("UInt8 AES-CBC 1", { permissions: "none" }, async () => {
Deno.test("Full UInt8 AES-CBC 1", { permissions: "none" }, async () => {
const cryptor = await createSymmetricCryptor("<PassWord123456>!!");
const encrypted = await cryptor.encrypt(sample1UInt8);
console.log(encrypted);
const decrypted = await cryptor.decrypt(encrypted);
assertEquals(decrypted, sample1UInt8);
});
Deno.test("UInt8 AES-CBC 100", { permissions: "none" }, async () => {
Deno.test("Full UInt8 AES-CBC 100", { permissions: "none" }, async () => {
const cryptor = await createSymmetricCryptor("<PassWord123456>!!", { times: 100 });
const encrypted = await cryptor.encrypt(sample1UInt8);
console.log(encrypted);
const decrypted = await cryptor.decrypt(encrypted);
assertEquals(decrypted, sample1UInt8);
});
Deno.test("String AES-CTR 1", { permissions: "none" }, async () => {
Deno.test("Full String AES-CTR 1", { permissions: "none" }, async () => {
const cryptor = await createSymmetricCryptor({
algorithm: "AES-CTR",
key: "<PassWord123456>!!"
Expand All @@ -60,7 +58,7 @@ Deno.test("String AES-CTR 1", { permissions: "none" }, async () => {
const decrypted = await cryptor.decrypt(encrypted);
assertEquals(decrypted, sample1String);
});
Deno.test("String AES-CTR 100", { permissions: "none" }, async () => {
Deno.test("Full String AES-CTR 100", { permissions: "none" }, async () => {
const cryptor = await createSymmetricCryptor({
algorithm: "AES-CTR",
key: "<PassWord123456>!!"
Expand All @@ -70,7 +68,7 @@ Deno.test("String AES-CTR 100", { permissions: "none" }, async () => {
const decrypted = await cryptor.decrypt(encrypted);
assertEquals(decrypted, sample1String);
});
Deno.test("UInt8 AES-CTR 1", { permissions: "none" }, async () => {
Deno.test("Full UInt8 AES-CTR 1", { permissions: "none" }, async () => {
const cryptor = await createSymmetricCryptor({
algorithm: "AES-CTR",
key: "<PassWord123456>!!"
Expand All @@ -80,7 +78,7 @@ Deno.test("UInt8 AES-CTR 1", { permissions: "none" }, async () => {
const decrypted = await cryptor.decrypt(encrypted);
assertEquals(decrypted, sample1UInt8);
});
Deno.test("UInt8 AES-CTR 100", { permissions: "none" }, async () => {
Deno.test("Full UInt8 AES-CTR 100", { permissions: "none" }, async () => {
const cryptor = await createSymmetricCryptor({
algorithm: "AES-CTR",
key: "<PassWord123456>!!"
Expand All @@ -90,7 +88,7 @@ Deno.test("UInt8 AES-CTR 100", { permissions: "none" }, async () => {
const decrypted = await cryptor.decrypt(encrypted);
assertEquals(decrypted, sample1UInt8);
});
Deno.test("String AES-GCM 1", { permissions: "none" }, async () => {
Deno.test("Full String AES-GCM 1", { permissions: "none" }, async () => {
const cryptor = await createSymmetricCryptor({
algorithm: "AES-GCM",
key: "<PassWord123456>!!"
Expand All @@ -100,7 +98,7 @@ Deno.test("String AES-GCM 1", { permissions: "none" }, async () => {
const decrypted = await cryptor.decrypt(encrypted);
assertEquals(decrypted, sample1String);
});
Deno.test("String AES-GCM 100", { permissions: "none" }, async () => {
Deno.test("Full String AES-GCM 100", { permissions: "none" }, async () => {
const cryptor = await createSymmetricCryptor({
algorithm: "AES-GCM",
key: "<PassWord123456>!!"
Expand All @@ -110,7 +108,7 @@ Deno.test("String AES-GCM 100", { permissions: "none" }, async () => {
const decrypted = await cryptor.decrypt(encrypted);
assertEquals(decrypted, sample1String);
});
Deno.test("UInt8 AES-GCM 1", { permissions: "none" }, async () => {
Deno.test("Full UInt8 AES-GCM 1", { permissions: "none" }, async () => {
const cryptor = await createSymmetricCryptor({
algorithm: "AES-GCM",
key: "<PassWord123456>!!"
Expand All @@ -120,7 +118,7 @@ Deno.test("UInt8 AES-GCM 1", { permissions: "none" }, async () => {
const decrypted = await cryptor.decrypt(encrypted);
assertEquals(decrypted, sample1UInt8);
});
Deno.test("UInt8 AES-GCM 100", { permissions: "none" }, async () => {
Deno.test("Full UInt8 AES-GCM 100", { permissions: "none" }, async () => {
const cryptor = await createSymmetricCryptor({
algorithm: "AES-GCM",
key: "<PassWord123456>!!"
Expand All @@ -130,7 +128,7 @@ Deno.test("UInt8 AES-GCM 100", { permissions: "none" }, async () => {
const decrypted = await cryptor.decrypt(encrypted);
assertEquals(decrypted, sample1UInt8);
});
Deno.test("String AES-CBC,AES-CTR,AES-GCM", { permissions: "none" }, async () => {
Deno.test("Full String AES-CBC,AES-CTR,AES-GCM", { permissions: "none" }, async () => {
const cryptor = await createSymmetricCryptor([
{ algorithm: "AES-CBC", key: "<PassWord123456>!!" },
{ algorithm: "AES-CTR", key: "<PassWord123456>!!" },
Expand All @@ -141,7 +139,7 @@ Deno.test("String AES-CBC,AES-CTR,AES-GCM", { permissions: "none" }, async () =>
const decrypted = await cryptor.decrypt(encrypted);
assertEquals(decrypted, sample1String);
});
Deno.test("UInt8 AES-CBC,AES-CTR,AES-GCM", { permissions: "none" }, async () => {
Deno.test("Full UInt8 AES-CBC,AES-CTR,AES-GCM", { permissions: "none" }, async () => {
const cryptor = await createSymmetricCryptor([
{ algorithm: "AES-CBC", key: "<PassWord123456>!!" },
{ algorithm: "AES-CTR", key: "<PassWord123456>!!" },
Expand All @@ -152,7 +150,7 @@ Deno.test("UInt8 AES-CBC,AES-CTR,AES-GCM", { permissions: "none" }, async () =>
const decrypted = await cryptor.decrypt(encrypted);
assertEquals(decrypted, sample1UInt8);
});
Deno.test("String Large AES-CBC,AES-CTR,AES-GCM", { permissions: "none" }, async () => {
Deno.test("Full String Large AES-CBC,AES-CTR,AES-GCM", { permissions: "none" }, async () => {
const cryptor = await createSymmetricCryptor([
{ algorithm: "AES-CBC", key: "<PassWord123456>!!" },
{ algorithm: "AES-CTR", key: "<PassWord987654>!!" },
Expand All @@ -163,7 +161,7 @@ Deno.test("String Large AES-CBC,AES-CTR,AES-GCM", { permissions: "none" }, async
const decrypted = await cryptor.decrypt(encrypted);
assertEquals(decrypted, sample2String);
});
Deno.test("UInt8 Large AES-CBC,AES-CTR,AES-GCM", { permissions: "none" }, async () => {
Deno.test("Full UInt8 Large AES-CBC,AES-CTR,AES-GCM", { permissions: "none" }, async () => {
const cryptor = await createSymmetricCryptor([
{ algorithm: "AES-CBC", key: "<PassWord123456>!!" },
{ algorithm: "AES-CTR", key: "<PassWord987654>!!" },
Expand All @@ -174,7 +172,7 @@ Deno.test("UInt8 Large AES-CBC,AES-CTR,AES-GCM", { permissions: "none" }, async
const decrypted = await cryptor.decrypt(encrypted);
assertEquals(decrypted, sample2UInt8);
});
Deno.test("File Large AES-CBC,AES-CTR,AES-GCM", {
Deno.test("Full File Large AES-CBC,AES-CTR,AES-GCM", {
ignore,
permissions: {
read: true,
Expand Down

0 comments on commit 1410766

Please sign in to comment.