Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pandh4cker/pandacipher
Symetrical encryption/decryption program
https://github.com/pandh4cker/pandacipher
argparse c cbc-mode keccak256 permutation s-box sha-3 substitution-cipher xor-cipher
Last synced: about 2 months ago
JSON representation
Symetrical encryption/decryption program
- Host: GitHub
- URL: https://github.com/pandh4cker/pandacipher
- Owner: PandH4cker
- Created: 2021-03-01T17:24:04.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-23T13:20:39.000Z (almost 4 years ago)
- Last Synced: 2024-08-11T11:46:20.521Z (5 months ago)
- Topics: argparse, c, cbc-mode, keccak256, permutation, s-box, sha-3, substitution-cipher, xor-cipher
- Language: C
- Homepage:
- Size: 58.6 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PandaCipher
---
## Authors:
[Raphael Dray](www.linkedin.com/in/raphaeldray), [Alex Samenaire](https://www.linkedin.com/in/alexsamenaire/)---
## Introduction:
> This program is a CLI application.
> It allows to encrypt/decrypt a string/file using its own cipher method defined by: XORing, Substitutions and Permutations.
> The avaible encryption modes are as follow:
> + CBC> In bonus.h, a function named getBestSBox(...) is defined but not used in the whole program. This function allow you to search in 210 tries
```C
int * getBestSBox(int nbBits)
{
DiffTable * diffTable = newDiffTable(nbBits);
int size = diffTable->nbElts;int * sBox = malloc(size * sizeof(int));
randomSBox(sBox, diffTable->nbBits);int * bestSBox = malloc(size * sizeof(int));
initDiffTable(diffTable, sBox);
int max = diffTable->max;
int nbMax = -1;for (int i = 0; i < 1 << 10; ++i)
{
memcpy(bestSBox, sBox, size * sizeof(int));
littleShuffle(bestSBox, size, 0.50);initDiffTable(diffTable, bestSBox);
int n = numberOfMax(bestSBox, size, diffTable->max);
if (max > diffTable->max ||
(max == diffTable->max && (nbMax == -1 || nbMax > n)))
{
max = diffTable->max;
nbMax = n;
memcpy(sBox, bestSBox, size * sizeof(int));
}
}
free(bestSBox);initDiffTable(diffTable, sBox);
printf("Max in DiffTable: %d\n", diffTable->max);
printf("Number of max: %d\n", nbMax);
return sBox;
}```
> It's written in __C programming language including some libraries like so:__
> + [SHA3 - Keccak](https://github.com/brainhub/SHA3IUF)
> + [Argp](https://github.com/coreutils/gnulib/blob/master/lib/argp.h)---
## Usage:
```
❯ ./pandaCipher --help
Usage: pandaCipher [OPTION...] ...args
PandaCipher - Symetrical encryption/decryption program
(https://github.com/MrrRaph/PandaCipher)-d, --decrypt[=DIGEST]
Specify decrypt mode
-e, --encrypt[=STR] Specify encrypt mode
-i, --input-file=FILE Input file to be encrypted/decrypted
-k, --cipher-key=KEY Key for crypting
--list-modes Print cryptographic modes that can be
used
-m, --encrypt-mode=MODE Mode to use/used in the encryption.
Specify the number of the mode that you can see by
using --list-modes command (Default: 0, CBC)
-?, --help Give this help list
--usage Give a short usage message
-V, --version Print program versionMandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.Report bugs to |.
```
### Example:
> You can encrypt/decrypt strings/files (with -i) on the command line.
> When encrypt/decrypt the program return the hex digest in case of non printable string when decrypting. Then you could use for example xxd with "-r -p" to convert hex string to string and recover the message.```
❯ ./pandaCipher -e"Les Panda c'est la vie" -k "Pandanimal"
AA2D3C4CBC6D5E0C43ACC93AA22146DB47F54A9F9DE07175D3A2D92B8E898BE8
❯ ./pandaCipher -d"AA2D3C4CBC6D5E0C43ACC93AA22146DB47F54A9F9DE07175D3A2D92B8E898BE8" -k "Pandanimal"
4C65732050616E6461206327657374206C612076696500000000000000000000
❯ ./pandaCipher -d"AA2D3C4CBC6D5E0C43ACC93AA22146DB47F54A9F9DE07175D3A2D92B8E898BE8" -k "Pandanimal" | xxd -r -p
Les Panda c'est la vie%
```