Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yrotak/d-1
D-1 is an open source symmetric encryption algorithm
https://github.com/yrotak/d-1
crypto cryptography d-1 done encryption encryption-algorithms encryption-decryption symetric-key
Last synced: 5 days ago
JSON representation
D-1 is an open source symmetric encryption algorithm
- Host: GitHub
- URL: https://github.com/yrotak/d-1
- Owner: yrotak
- Created: 2020-05-01T22:53:51.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-09-22T13:30:12.000Z (about 3 years ago)
- Last Synced: 2024-01-20T17:36:32.942Z (10 months ago)
- Topics: crypto, cryptography, d-1, done, encryption, encryption-algorithms, encryption-decryption, symetric-key
- Language: JavaScript
- Homepage:
- Size: 127 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# D-1
D-1 is new open source symetric encryption alghorythm### Currently supported
- C#
- NodeJS
- JSIn Future updates i will release the code in php, javascript, java, C#, C++, Python.
### What is the logic behind it ?
1. We are going to format the key:
```
while result < 32:
for each byte in key:
add byte to result
reverse result
return Subsequence(result,0,32) //Get only 32 chars
```
2. Generate a base alphabet from the plain text
```
basic alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
rest = []
for each byte in plain:
if basic alphabet does not contain byte:
add byte to basic alphabet
add byte to rest
return rest & alphabet
```
3. We generate 32 base alphabet shifted by each byte of the key
```
basic alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"if the first byte of key is f then the first alphabet will be
fghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcde
```
4. For each byte in plain we take the byte at the same index in the generated alphabet
```
basic alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"if the first byte of key is f then the first alphabet will be
fghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdethen if the first byte of plain is B, index is 1 in the basic alphabet so B will be g
```
5. In the result we add the rest encoded in base64 (this is for decryption)RESUME:
```
key = TEST
Plain = HELLO
Encrypted = AIDEH
E H L O
Base alphabet: A B C D [E] F G [H] I J K [L] M N [O] P Q R S T U V W X Y Z
Key: T U V W X Y Z [A] B C D E F G [H] I J K L M N O P Q R S
E F G H [I] J K L M N O P Q R S T U V W X Y Z A B C D
S T U V W X Y Z A B C [D] E F G H I J K L M N O P Q R
T U V W X Y Z A B C D [E] F G H I J K L M N O P Q R S
```