

## Reduction example

Suppose:
- pswLength = 5
- self.charset = ```"abcdef"```
- hashstring = ```b'\x47\xbc\xe5\xc7O'``` (from an MD5 hash).
- index = 1

```
reduced_value = ""
for i in range(pswLength):
    value = hashstring[((index + i) % len(hashstring))]
    reduced_value += self.charset[value % len(self.charset)]
```

Result:

1. For ```i=0```, ```value = hashstring[1] = 188```, ```value % len(self.charset) = 188 % 6 = 2```, so ```reduced_value += 'c'```.
2. For ```i=1```, ```value = hashstring[2] = 229```, ```value % len(self.charset) = 229 % 6 = 1```, so ```reduced_value += 'b'```.
3. For ```i=2```, ```value = hashstring[3] = 199```, ```value % len(self.charset) = 199 % 6 = 1```, so ```reduced_value += 'b'```.
4. For ```i=3```, ```value = hashstring[4] = 79```, ```value % len(self.charset) = 79 % 6 = 1```, so ```reduced_value += 'b'```.
5. For ```i=4```, ```value = hashstring[5] = 71```, ```value % len(self.charset) = 71 % 6 = 5```, so ```reduced_value += 'f'```.

Final reduced password:

```
"cbbbf"
```

Compute the new hash:

```
md5("cbbf") = "6a07d1c15b502dd029471850f0b2559d" = b'j\x07\xd1\xc1[P-\xd0)G\x18P\xf0\xb2U\x9d' = 
= [106, 7, 209, 193, 91, 80, 45, 208, 41, 71, 24, 80, 240, 178, 85, 157]
```

Next iteration:

- pswLength = 5
- self.charset = ```"abcdef"```
- index = 2

Result:

1. For ```i=0```, ```value = hashstring[2] = 209```, ```value % len(self.charset) = 239 % 6 = 4```, so ```reduced_value += 'e'```.
2. For ```i=1```, ```value = hashstring[3] = 193```, ```value % len(self.charset) = 193 % 6 = 1```, so ```reduced_value += 'b'```.
3. For ```i=2```, ```value = hashstring[4] = 91```, ```value % len(self.charset) = 91 % 6 = 5```, so ```reduced_value += 'f'```.
4. For ```i=3```, ```value = hashstring[5] = 80```, ```value % len(self.charset) = 80 % 6 = 1```, so ```reduced_value += 'b'```.
5. For ```i=4```, ```value = hashstring[6] = 45```, ```value % len(self.charset) = 45 % 6 = 1```, so ```reduced_value += 'b'```.

```
"ebfbb"
```

and so on.

## Note

```
# Compute the MD5 hash for the string "cbbf"
md5_hash_cbbf = hashlib.md5("cbbf".encode('utf-8'))

# Byte representation of the MD5 hash
binary_digest_cbbf = md5_hash_cbbf.digest()

# Decimal representation of each byte
decimal_values_cbbf = list(binary_digest_cbbf)
```