Skip to content

Commit 24f6872

Browse files
committed
Updated readme
1 parent 907a846 commit 24f6872

File tree

1 file changed

+68
-2
lines changed

1 file changed

+68
-2
lines changed

README.md

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ I had made this a while back while tinkering with python, forgotten about it and
55

66
I've always disliked having to open another term to verify hashsums when downloading important files. Generally speaking, any organization that creates Paas, Saas or any of the types, usually have hash checksums beside the download of their binaries. I found it a bit tedious to copy the hashsum, open a term in the directory and then run 'hashutil', 'md5sum', 'sha256sum', etc. to verify the two hashes, I'm sure there's other tools that do this, though this was fun lil project to make.
77

8+
Since this is more of an archival thing, I most likely will not be modifying or updating this program in the future.
89

910
## Examples
1011
If a match is found:
@@ -81,7 +82,7 @@ Windows: Hashcheck.exe "C:\Users\ihr rules\Desktop\domain_admin.txt"
8182

8283

8384
## Linux
84-
I initally wrote this for windows, it will execute, though, if you're running it from the command line, omit line 280 else it will yield the error of:
85+
I initally wrote this for windows, it will execute, though, if you're running it from the command line, [omit line 280](https://github.com/ihaveroot/Hashcheck/blob/907a846dbdacd990b038fd6d2bdc7524c99145aa/Hashcheck.py#L280) else it will yield the error of:
8586
```
8687
sh: 1: pause: Permission denied
8788
```
@@ -97,4 +98,69 @@ You may do the same by:
9798
- Typing in: `shell:sendto`
9899
- Adding the most recent release to the folder location
99100

100-
![Sendto](/img/run.png)
101+
![Sendto](/img/run.png)
102+
103+
104+
## Adding your own
105+
I've planned for the ability to add your own libraries if the default hashing algorithms aren't enough. Shown is what you need to modify for the capability.
106+
107+
In [`compute_file_hash`](https://github.com/ihaveroot/Hashcheck/blob/907a846dbdacd990b038fd6d2bdc7524c99145aa/Hashcheck.py#L57) add your hash type and the library for the hashing algorithm:
108+
```python
109+
...
110+
#elif hash_type == 'foobar':
111+
# hash_func = library.hashing_algorithm()
112+
elif hash_type == 'BLAKE2b':
113+
hash_func = hashlib.blake2b()
114+
...
115+
```
116+
117+
Since `foobar` is computing the file hash before `blake2b` you need to modify the [`hash_types`](https://github.com/ihaveroot/Hashcheck/blob/907a846dbdacd990b038fd6d2bdc7524c99145aa/Hashcheck.py#L199) list in [`assign`](https://github.com/ihaveroot/Hashcheck/blob/907a846dbdacd990b038fd6d2bdc7524c99145aa/Hashcheck.py#L198) so that the `foobar` identifier comes before `blake2b`
118+
```python
119+
hash_types = ['MD5',
120+
'SHA-1',
121+
'SHA256',
122+
'SHA512',
123+
'BLAKE2s',
124+
#'FOOBAR',
125+
'BLAKE2b']
126+
```
127+
128+
If the length of the `foobar` hash algorithm is of a different length then you must add it to the map variable [`hash_length_map`](https://github.com/ihaveroot/Hashcheck/blob/907a846dbdacd990b038fd6d2bdc7524c99145aa/Hashcheck.py#L137) in [`display_confidence_hashes`](https://github.com/ihaveroot/Hashcheck/blob/907a846dbdacd990b038fd6d2bdc7524c99145aa/Hashcheck.py#L135).
129+
130+
```python
131+
hash_length_map = {
132+
128: [list[3][1], list[5][1]],
133+
64: [list[2][1], list[4][1]],
134+
40: [list[1][1], list[1][1]],
135+
32: [list[0][1], list[0][1]],
136+
# foobar hash length of 16
137+
# foobar hash is in the 5th
138+
# position, and the hash is
139+
# in the first array.
140+
#16: [list[5][1], list[5][1]]
141+
}
142+
```
143+
144+
The map has the hashing lengths of `128, 64, 40, 32` since `BLAKE2b/SHA512` and `BLAKE2s/SHA256` have the same hash lengths they're mapped to the corresponding numerical length values:
145+
```python
146+
SHA512 BLAKE2b
147+
128: [list[3][1], list[5][1]],
148+
149+
SHA256 BLAKE2s
150+
64: [list[2][1], list[4][1]],
151+
...
152+
```
153+
154+
We only have one hash length of 32, it is mapped twice to the same hash, being MD5:
155+
```python
156+
MD5 MD5
157+
32: [list[0][1], list[0][1]],
158+
```
159+
160+
As such, if `foobar` doesn't have one of these hash lengths you must add it and the position of `foobar` in the `hash_length_map`:
161+
```python
162+
FOOBAR FOOBAR
163+
16: [list[5][1], list[5][1]]
164+
```
165+
166+
Pretty straight forward, see source for additional comments. I'm sure you'll figure it out.

0 commit comments

Comments
 (0)