-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor!: rewrite AES and Blowfish logic
- AES and Blowfish performance significantly improved - added example to README.md - added more tests - dev dependencies moved to dev_deps.ts BREAKING CHANGE: Block modes are now separated from encryption logic and can be instantiated directly, e.g. AesEcb
- Loading branch information
Showing
24 changed files
with
864 additions
and
954 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.vscode/ | ||
.vscode/ | ||
.coverage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,35 @@ | ||
# Crypto | ||
![ci](https://github.com/aykxt/crypto/workflows/ci/badge.svg) | ||
|
||
![ci](https://github.com/aykxt/crypto/workflows/ci/badge.svg) | ||
|
||
A collection of useful crypto algorithms written in Typescript. | ||
|
||
> ⚠ This project is still in an early stage of development. Expect **breaking | ||
> changes**. | ||
## Supported algorithms | ||
|
||
### Block ciphers | ||
- AES | ||
|
||
- AES (Advanced Encryption Standard) | ||
- Blowfish | ||
- ECB and CBC block modes | ||
|
||
## Examples | ||
|
||
```ts | ||
import { AesEcb } from "https://deno.land/x/crypto/aes.ts"; | ||
import { assertEquals } from "https://deno.land/std/testing/asserts.ts"; | ||
|
||
//deno-fmt-ignore | ||
const key = new Uint8Array([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]); | ||
|
||
const cipher = new AesEcb(key); | ||
|
||
//deno-fmt-ignore | ||
const data = new Uint8Array([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]); | ||
|
||
const encrypted = cipher.encrypt(data); | ||
|
||
assertEquals(cipher.decrypt(encrypted), data); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { AesCbc, AesEcb } from "./src/aes/mod.ts"; | ||
export { Padding } from "./src/utils/padding.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { BlowfishCbc, BlowfishEcb } from "./src/blowfish/mod.ts"; | ||
export { Padding } from "./src/utils/padding.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export { | ||
bench, | ||
runBenchmarks, | ||
} from "https://deno.land/std@0.90.0/testing/bench.ts"; | ||
export { | ||
assertEquals, | ||
assertThrows, | ||
} from "https://deno.land/std@0.90.0/testing/asserts.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { Blowfish } from "./src/blowfish/mod.ts"; | ||
export { AES } from "./src/aes/mod.ts"; | ||
export { BlowfishCbc, BlowfishEcb } from "./blowfish.ts"; | ||
export { AesCbc, AesEcb } from "./aes.ts"; | ||
export { Padding } from "./src/utils/padding.ts"; |
Oops, something went wrong.