Skip to content

Commit 12bf375

Browse files
authored
Enhance README with usage and JSON config details
Expanded the README.md to provide detailed usage instructions, examples, and JSON configuration support for the HashifyNET Command Line Interface.
1 parent 392f358 commit 12bf375

File tree

1 file changed

+109
-2
lines changed

1 file changed

+109
-2
lines changed

README.md

Lines changed: 109 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,109 @@
1-
# HashifyNETCLI
2-
HashifyNET Command Line Interface
1+
Welcome to HashifyNET Command Line Interface
2+
--------------------------------------------
3+
4+
HashifyNET CLI is a professionnal command line utility for computing various cryptographic and non-cryptographic hash algorithms supported by [HashifyNET](https://github.com/Deskasoft/HashifyNET).
5+
6+
This CLI completely relies on the [HashifyNET](https://github.com/Deskasoft/HashifyNET) project to both demonstrate its capabilities and to offer a standardized way of computing multiple hash algorithms.
7+
8+
HashifyNET CLI uses runtime C# scripts for I/O operations. This makes it as flexible as writing a C# code without writing a complete C# code. You are able to process any input and output anything you desire without limitations.
9+
10+
We support inline command-line parameters, a file for specifying command lines (preferably for long command lines and to avoid getting stuck by operating system limitations), and JSON config files to customize your own settings for the hash algorithms you want to use.
11+
12+
Usage
13+
-----
14+
### Quick computation using CRC32
15+
```
16+
HashifyCLI -i "'Hello World'" -a "CRC" -cp "CRC=CRC32"
17+
```
18+
19+
### Quick computation using CRC32 and CRC64
20+
```
21+
HashifyCLI -i "'Hello World'" -a "CRC:1 CRC:2" -cp "CRC:1=CRC32 CRC:2=CRC64"
22+
```
23+
24+
## Quick computation of file HashifyNET.dll using MD5, CRC32 and CRC64
25+
```
26+
HashifyCLI -i "ReadAllBytes('HashifyNET.dll')" -if "Input" -a "MD5 CRC:1 CRC:2" -cp "CRC:1=CRC32 CRC:2=CRC64"
27+
```
28+
29+
Syntax and Execution
30+
--------------------
31+
The query used for algorithms and config profiles are the same, each execution is separated with spaces.
32+
A query of `CRC CRC` will be computing 2 CRC hashes, usually the same output.
33+
34+
To use the same hash algorithm more than once with different config profiles, you must use the name suffixes separated by a colon just like this:
35+
```
36+
CRC:myCrc1 CRC:myCrc2
37+
```
38+
39+
And when you are going to assign profiles to them, you do it in a very similar way as follows:
40+
```
41+
CRC:myCrc1=CRC32 CRC:myCrc2=CRC64
42+
```
43+
44+
The command line results in something like this:
45+
```
46+
HashifyCLI -i "'Hello World'" -a "CRC:myCrc1 CRC:myCrc2" -cp "CRC:myCrc1=CRC32 CRC:myCrc2=CRC64"
47+
```
48+
49+
This will generate 2 CRC hashes, one 32 bit, and the second one is 64 bit, for the same input.
50+
51+
The execution order for the entire process is as follows:
52+
```
53+
-input >> --input-finalizer >> [cyclist begin // --algorithm >> Compute >> --output-finalizer >> --output \\ cyclist end]
54+
```
55+
56+
JSON Support
57+
------------
58+
The CLI supports JSON config files to be passed with the `-cf` or `--config-file` parameter. This JSON file must contain config profiles or preferences for any supported hash algorithm that you'd use.
59+
60+
A valid JSON config is like this:
61+
```JSON
62+
{
63+
"CRC": {
64+
"profile": "CRC32"
65+
}
66+
}
67+
```
68+
69+
A custom CRC would look like this in JSON:
70+
```JSON
71+
{
72+
"CRC": {
73+
"config": {
74+
"HashSizeInBits": 32,
75+
"Polynomial": 79764919,
76+
"InitialValue": 4294967295,
77+
"ReflectIn": true,
78+
"ReflectOut": true,
79+
"XOrOut": 4294967295
80+
}
81+
}
82+
}
83+
```
84+
85+
Here's another JSON containing multiple configs:
86+
```JSON
87+
{
88+
"CRC": {
89+
"config": {
90+
"HashSizeInBits": 32,
91+
"Polynomial": 79764919,
92+
"InitialValue": 4294967295,
93+
"ReflectIn": true,
94+
"ReflectOut": true,
95+
"XOrOut": 4294967295
96+
}
97+
},
98+
"Argon2id": {
99+
"profile": "OWASP"
100+
},
101+
"FNV1a": {
102+
"profile": "Default"
103+
}
104+
}
105+
```
106+
107+
> [!NOTE]
108+
> JSON input is ignored when `-cp` or `--config-profiles` exists in the command line parameters.
109+
> Make sure to use only one of them.

0 commit comments

Comments
 (0)